Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Traffic Quota with IPFW or PF?

    Scheduled Pinned Locked Moved Firewalling
    5 Posts 3 Posters 890 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      thales
      last edited by

      Hello!

      Does anybody know how to use IPFW or PF to provide web traffic quota per host in a network?
      For example, say I want to limit every host to a 1GB amount of web traffic per day.

      I heard IPFW is only used for the Captive Portal. I think the web GUI doesn't allow this to be configured, but I don't mind doing stuff on the terminal.
      If it works, I may even start developing a package for web interfacing it.  :)

      Thanks a lot.

      1 Reply Last reply Reply Quote 0
      • KOMK Offline
        KOM
        last edited by

        Yes, Captive Portal uses ipfw and that is the only baked-in way to do traffic quotas, from what I understand of it.

        1 Reply Last reply Reply Quote 0
        • T Offline
          thales
          last edited by

          @KOM:

          Yes, Captive Portal uses ipfw and that is the only baked-in way to do traffic quotas, from what I understand of it.

          Thanks a lot, KOM.

          Could you, please, give me some examples on how to configure it?
          I'm not really familiar with either IPFW or PF and the online tutorials I've found haven't been much helpful. =/

          Thank you.

          1 Reply Last reply Reply Quote 0
          • KOMK Offline
            KOM
            last edited by

            I've never used it.  To get the quotas, I think you also need to hook RADIUS accounting into the mix.

            1 Reply Last reply Reply Quote 0
            • J Offline
              jazzl0ver
              last edited by

              Just for the reference. Here is a snippet to get current traffic usage:

              require_once("functions.inc");
              require_once("captiveportal.inc");
              
              $sent = (pfSense_ipfw_table_lookup("test_auth_up", $_SERVER['REMOTE_ADDR']))[bytes];
              $received = (pfSense_ipfw_table_lookup("test_auth_down", $_SERVER['REMOTE_ADDR']))[bytes];
              $used = $sent + $received;
              
              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.