How to make pfSense limit max count of simultaneously opened connections from one IP…
- User
How to make pfSense limit max count of simultaneously opened connections from one IP address?
- Assistant
In pfSense, you can limit the maximum number of simultaneous connections from a single IP address by using the Firewall Rules with State Limits. This is commonly done to prevent abuse or DoS attacks where one IP opens too many connections.
Here's how to configure this:
Steps to Limit Max Simultaneous Connections Per IP Address in pfSense
-
Log into pfSense WebGUI.
-
Go to Firewall > Rules.
-
Select the interface (e.g., WAN or LAN) where you want to apply the limit. Usually, you'd apply this on WAN interface for incoming traffic or LAN for restricting internal devices.
-
Edit or Add a Rule
- Either edit an existing rule or create a new firewall rule that matches the traffic you want to limit.
- For example, a rule that passes TCP traffic on port 80 if you want to limit connections to a webserver.
-
Set State Limits
- Scroll down to the “Advanced features” section in the rule edit page.
- Find the State Options:
- Look for the parameter “Maximum state entries” or “Maximum states per client ip” depending on pfSense version.
- Alternatively, in newer pfSense versions:
- Expand “State Type” and choose “Synproxy” if you want to mitigate SYN flood attacks.
- For limiting per IP, check the “State Timeout” options and limits.
- To specifically limit max simultaneous connections per single IP:
- You need to enable “State Limits - Maximum states per host”.
- This is found under Firewall > Rules at the bottom in the "State Type" section or within the advanced options of each rule.
- Set Maximum states per host (e.g., 50) - this limits the number of simultaneous connections from a single source IP.
-
Save and Apply Changes.
-
Test
- Try to open multiple connections from the same IP and see if exceeding the limit results in connections being dropped.
Example
If you want to limit a single IP address to only 50 concurrent connections on port 80 incoming from WAN:
- Go to Firewall > Rules > WAN.
-
- User
maximum state entries and max connections per host difference
- Assistant