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

    rate limiting / policer

    Scheduled Pinned Locked Moved General pfSense Questions
    10 Posts 3 Posters 900 Views
    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.
    • M
      michmoor LAYER 8 Rebel Alliance
      last edited by michmoor

      Hello everyone,
      Looking to see if my application here is sound when applying limiters.
      Part of DoS protection i need to liit icmp and tcp traffic to the firewall. Basically rate limiting.
      Ive configured limiters to help me with this. Each limiters is set to 1Mbps
      a94e55e7-b1f6-461a-b282-c8327cd626c4-image.png

      I then created a floating rule and have it match on all interfaces except WAN in the In Direction. My thinking is that to protect the and test this rule from the inside first before I apply it to the WAN side as we do allow icmp. Is this correct so far?

      My next step is i would of apply a limiter to each of my different service ports - I am in Fintech so ports need to be open from the Internet but we do tighten it down to whitelist source IPs of clients.
      So for example clients hitting my NAT at x.x.x.x/32 on port 1840 will be limited to 20Mbps.
      Does of any this seem reasonable or doable? Do I have the Floating Rules direction accurate? I dont think it matters to much as the 1Mbps ICMP limit is the same regardless of direction.

      edit: using hping3 on my Ubuntu box i can validate that the 1Mbps icmp flood protection i put in is working.

      f308c2a4-c14b-4b3c-bd08-063f87be494a-image.png

      Firewall: NetGate,Palo Alto-VM,Juniper SRX
      Routing: Juniper, Arista, Cisco
      Switching: Juniper, Arista, Cisco
      Wireless: Unifi, Aruba IAP
      JNCIP,CCNP Enterprise

      M 1 Reply Last reply Reply Quote 0
      • M
        michmoor LAYER 8 Rebel Alliance @michmoor
        last edited by

        Should I use a Mask??

        4c0d2fa8-6441-4a65-99b4-8b31ded7bcdd-image.png

        Firewall: NetGate,Palo Alto-VM,Juniper SRX
        Routing: Juniper, Arista, Cisco
        Switching: Juniper, Arista, Cisco
        Wireless: Unifi, Aruba IAP
        JNCIP,CCNP Enterprise

        S 1 Reply Last reply Reply Quote 0
        • S
          SteveITS Galactic Empire @michmoor
          last edited by

          @michmoor Inbound I’m not terribly effective at DoS because the traffic has already filled your pipe before it gets to pfSense. Is it necessary to respond to pings at all?

          A mask can be used to have multiple queues/limits, so for example each LAN IP is limited to 1 Mbps, as opposed to all sharing 1 Mbps.

          Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
          When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
          Upvote 👍 helpful posts!

          M 1 Reply Last reply Reply Quote 0
          • M
            michmoor LAYER 8 Rebel Alliance @SteveITS
            last edited by michmoor

            @SteveITS
            The goal is not to prevent an ddos attack rather to limit resource consumption of the firewall. For pings it still needs to create state in the table as it’s allowed. CPU utilization will be high so just reducing the impact and still making the firewall usable is the goal. It’s not just about WAN. We have LAN traversing other interfaces such as DMZ. Firewall can’t function if it’s hammered on the WAN. .Plus policing it to a low level gives us enough time to investigate and work with our upstream

            Firewall: NetGate,Palo Alto-VM,Juniper SRX
            Routing: Juniper, Arista, Cisco
            Switching: Juniper, Arista, Cisco
            Wireless: Unifi, Aruba IAP
            JNCIP,CCNP Enterprise

            S 1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              I would probably try to set actual states limits on the rule rather than using Limiters. So set a maximum number of states and/or maximum source IPs:
              https://docs.netgate.com/pfsense/en/latest/firewall/configure.html#maximum-state-entries-this-rule-can-create
              That wouldn't prevent a single host sending a ping flood though.

              M 1 Reply Last reply Reply Quote 0
              • M
                michmoor LAYER 8 Rebel Alliance @stephenw10
                last edited by

                @stephenw10
                Is there a way to see what the CPS is for a rule?

                Firewall: NetGate,Palo Alto-VM,Juniper SRX
                Routing: Juniper, Arista, Cisco
                Switching: Juniper, Arista, Cisco
                Wireless: Unifi, Aruba IAP
                JNCIP,CCNP Enterprise

                1 Reply Last reply Reply Quote 0
                • S
                  SteveITS Galactic Empire @michmoor
                  last edited by

                  @michmoor I was just going to write that ☝ .

                  re: floating rules direction, look at the state table. It's not always immediately obvious, for instance "download from web server" is an inbound connection on port 443 and the reply uses that, it's not an outbound direction.

                  What I usually do is run the wizard, pick one of high/medium/low and then copy and/or change the IPs to fit the actual needs. (or in our case now I just copy from another router).

                  re: rule data, the firewall rule will have the number of currently open states in the left column.

                  Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                  When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                  Upvote 👍 helpful posts!

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    michmoor LAYER 8 Rebel Alliance @SteveITS
                    last edited by

                    @SteveITS said in rate limiting / policer:

                    What I usually do is run the wizard, pick one of high/medium/low an

                    You mean the Shaper wizard, right?

                    @SteveITS said in rate limiting / policer:

                    re: rule data, the firewall rule will have the number of currently open states in the left column.

                    Yep thats a good way to figure out the open connections now. Give maybe a 10% overhead

                    Firewall: NetGate,Palo Alto-VM,Juniper SRX
                    Routing: Juniper, Arista, Cisco
                    Switching: Juniper, Arista, Cisco
                    Wireless: Unifi, Aruba IAP
                    JNCIP,CCNP Enterprise

                    S 1 Reply Last reply Reply Quote 0
                    • stephenw10S
                      stephenw10 Netgate Administrator
                      last edited by

                      The shaping wizard only creates AltQ based shaping. You could add Limiters to the match rules it creates but it probably doesn't make much sense for this if you're Limiters at least.

                      1 Reply Last reply Reply Quote 0
                      • S
                        SteveITS Galactic Empire @michmoor
                        last edited by

                        @michmoor said in rate limiting / policer:

                        Shaper wizard

                        Yeah sorry, low on coffee. Same general idea though...

                        LAN outbound to *:443 limit 10 Mbps is one pipe.

                        LAN outbound to *:443 limit 10 Mbps with a mask of /32 is one 10 Mbps pipe per device.

                        "When a limiter is set for Source Address or Destination Address, the pipe bandwidth limit will be applied on a per-IP address basis or a subnet basis, depending on the masking bits, using the direction chosen in the masking."

                        Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                        When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                        Upvote 👍 helpful posts!

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.