Rate limiting behind NAT can prevent a single public Wi-Fi user from overwhelming the connection and taking the entire venue offline—common when one device floods the network with traffic, exhausting bandwidth and device capacity. This guide shows how to configure rate limiting at the router or firewall level to isolate and cap traffic per user, ensuring stable access for everyone. You’ll need administrative access to your Wi-Fi router or firewall and basic networking knowledge.
What You'll Need
- Admin access to your Wi-Fi router or firewall (e.g., Ubiquiti UniFi,pfSense, MikroTik, or enterprise-grade hardware)
- Current firmware installed on your device
- Network diagram or list of connected devices to identify public vs. private zones
- Basic understanding of NAT, DHCP, and QoS concepts
Step-by-Step
- Log in to your router or firewall’s admin interface (usually via HTTPS at an internal IP like 192.168.1.1 or 10.0.0.1). Use admin credentials—not default ones—and ensure you’re on a trusted, secure connection.
- Navigate to the Firewall or QoS section. On pfSense, use Services > Quality of Service. On MikroTik, go to IP > Firewall > Mangle and then Queue Tree.
- Create a new firewall rule to mark traffic from public Wi-Fi users. In most systems, this is done in the Mangle or Rules tab. Set the chain to prerouting (for input traffic) or forward (for routed traffic), and apply it to the public LAN interface (e.g., br-lan or vlan20). Use source address lists if available—target the DHCP range assigned to guest users (e.g., 192.168.50.0/24).
- Assign a connection mark (e.g., public-user-mark) to all traffic from that subnet. This allows downstream rate limiting to apply consistently per user, not just per connection. In pfSense, use Filter Rules > Advanced Options > Match to set a tag; in MikroTik, use action=mark-connection and specify new-connection-mark.
- Create a queue entry for rate limiting. In Ubiquiti, under the same network’s Advanced Options, enable Bandwidth Control and set both Upload and Download limits per client (e.g., 5 Mbps up/down). In pfSense, configure a Queue under Services > Quality of Service > Queues with a parent queue tied to your WAN interface, then assign bandwidth caps (e.g., 1024 kbps up, 2048 kbps down per user). In MikroTik, add a Queue Tree entry under parent=global-in (for download) and global-out (for upload), and set max-limit and bucket-size to enforce steady throttling without burst spikes.
- Apply the rule to the correct interface and zone. Ensure the rate limit applies only to public/guest traffic—not internal networks (like staff VLANs). Double-check interface assignments: misassigning to LAN instead of Guest LAN will throttle staff or admin traffic.
- Save, then apply the configuration. Test by connecting a device to the public Wi-Fi and running a speed test. Confirm the result matches your cap (e.g., ~5 Mbps). Use tools like
iperf3or built-in router dashboards to verify sustained throughput.
Common Mistakes
Many deployments fail because of subtle configuration errors. First, setting rate limits too high (e.g., 25+ Mbps per user) won’t prevent a single user from saturating a 100 Mbps uplink—aim for 5–10 Mbps per user for venues with 20+ guests. Second, forgetting to apply the rule to the forward chain (not just input) means traffic between clients or to the internet bypasses the limit. Third, using only bandwidth control without connection marking can cause inconsistent behavior when multiple connections (e.g., HTTP/HTTPS, DNS, and UDP) aren’t grouped under one user quota. Fourth, enabling rate limiting on the wrong VLAN or subnet (e.g., applying it to staff VLAN instead of guest) locks out internal operations. Finally, ignoring burst settings can cause short-term slowdowns followed by sudden overages—tune burst parameters (e.g., MikroTik’s burst-limit and burst-threshold) for smoother performance.
Tips
Start conservatively: set limits lower than expected, then gradually raise them if users complain. Monitor via the router’s dashboard—Ubiquiti’s Monitor > Uptime or pfSense’s Status > Traffic Graph can show real-time per-user usage. Use separate queues per subnet or VLAN to isolate heavy users without penalizing others. For large venues, consider per-SSID rate limiting (e.g., one SSID for guests with caps, another for staff without). Enable logging for firewall rules to catch abuse patterns (e.g., repeated SYN floods). And always keep a backup config—especially before applying firewall changes, which can accidentally lock you out if misconfigured.
Troubleshooting
If rate limiting doesn’t take effect, first verify the firewall rule is enabled and placed above any allow all rules—order matters. Check that the source subnet matches your guest DHCP range (log into the router and confirm under DHCP Server > Leases). If using QoS, ensure the rule is bound to the correct WAN interface and queue hierarchy. If speed tests still exceed the cap, restart the router—some systems cache rules and require a reboot to apply changes. If users report intermittent connectivity, reduce the burst limit and increase queue depth to prevent packet drops. For NAT-related issues, confirm your NAT masquerade rule isn’t overriding rate limits; on pfSense, this means checking NAT > Outbound Mode is set to Manual Outbound NAT Rule Generation so QoS can apply before NAT translation. If all else fails, revert to a known backup config and reapply changes incrementally.
Frequently Asked Questions
Does rate limiting behind NAT slow down internal staff traffic?
No—if configured correctly, rate limits apply only to the public/guest VLAN or subnet. Staff networks (e.g., VLAN 10) should have separate firewall rules or no caps applied.
Can I rate limit by user instead of IP?
Only with additional steps: integrate RADIUS authentication (e.g., via UniFi’s Guest Control) to assign per-user quotas, or use DHCP reservations to lock IPs to users. Basic NAT routers don’t support per-user limits without extra infrastructure.
Will rate limiting stop DDoS or port scans?
Partially. Rate limiting reduces bandwidth consumption from floods, but it doesn’t block malicious packets. Combine it with firewall rules that drop suspicious traffic (e.g., excessive SYN packets) for full protection.
Do I need enterprise gear for this?
Not necessarily. Mid-range routers like the Ubiquiti UniFi Dream Machine Pro, pfSense on a small form factor PC, or MikroTik hEX S can handle basic rate limiting. Avoid consumer-grade routers—they often lack per-user QoS or VLAN support.
Why does one user still dominate the Wi-Fi after limiting?
Check if the rule applies to both upload and download. Some venues only cap download, but a user running a large upload (e.g., cloud backup) can saturate your upstream. Also verify the rule isn’t bypassed by split tunneling or direct LAN access.
How do I test if rate limiting is working?
Use a device on the guest network, run a multi-threaded download (e.g., via aria2c orSpeedtest CLI), and watch real-time graphs in your router’s dashboard. Traffic should plateau at your configured cap within seconds.