Yes, OPNsense provides QoS under Firewall ‣ Shaper. Pipes set bandwidth caps, queues can share a pipe by weight, and rules send matching traffic to a pipe or queue. For WAN bufferbloat, start with one FQ-CoDel pipe per direction, each set to 85% of the ISP’s advertised rate. Traffic shaping overview · FQ-CoDel setup
What does OPNsense traffic shaping actually do?
Setting the pipe rates below the bottleneck gives OPNsense a queue it can manage. That helps address bufferbloat, the excess latency caused by a persistent queue. OPNsense FQ-CoDel how-to · RFC 8289
The shaper uses IPFW and dummynet. Shaping rules are handled separately from firewall rules unless a firewall rule assigns a pipe or queue directly. For dummynet, OPNsense recommends a minimum kern.hz of 1000 and places that tunable under System ‣ Settings ‣ Tunables. OPNsense traffic shaping · FreeBSD dummynet manual
How pipes, queues and rules fit together
| Object | What it does | Fields that matter |
|---|---|---|
| Pipe | Sets the bandwidth for matching traffic | Bandwidth, scheduler type, mask, CoDel settings |
| Queue | Associates traffic with a pipe and can give it a weighted share | Pipe, weight (1 to 100, default 100), mask |
| Rule | Sends matching traffic to a pipe or queue | Sequence, interface, interface 2, protocol, source, destination, ports, direction, DSCP, target |
OPNsense traffic shaping · Traffic shaper model
Direction. For WAN shaping, use in for download and out for upload. The default direction, Both, matches incoming and outgoing traffic. FQ-CoDel rule example
Masks. A mask on a pipe creates a dynamic pipe per matching address, each with the configured rate. The per-user example gives each host on 192.168.1.0/24 a 1 Mbit/s cap. A mask on a queue lets hosts share the bandwidth of one pipe. Both examples use a destination mask for download and a source mask for upload. Limit bandwidth per user · Share bandwidth evenly
Sequence. Give a specific rule a lower sequence than any catch-all rule that would match the same traffic. Leave gaps for additional rules. Control plane shaping
Which scheduler should you pick?
Use FlowQueue-CoDel to reduce WAN latency under load. Use Weighted Fair Queueing (WFQ) or QFQ when you need queue weights to determine shares. Traffic shaper model · FQ-CoDel setup · Control plane shaping
| Scheduler | How it fits |
|---|---|
| Weighted Fair Queueing (default scheduler) | Supports weighted shares and control plane classes |
| FlowQueue-CoDel | Manages WAN queue delay and shares capacity across flows |
| FlowQueue-PIE | Uses active queue management. The control plane guide flags its congestion feedback |
| QFQ | Supports weighted shares and control plane classes |
| Deficit Round Robin | The control plane guide flags latency |
| FIFO | Serves packets in arrival order |
How FQ-CoDel reduces bufferbloat
FQ-CoDel hashes flows into queues using the protocol, source and destination IP addresses, and source and destination ports. Deficit round robin shares service among queues, with prompt service for sparse traffic such as DNS. In each queue, CoDel tracks how long packets have waited and signals persistent congestion by dropping packets or marking ECN-capable traffic. RFC 8290 · RFC 8289
| Parameter | OPNsense default | Tuning guidance |
|---|---|---|
| Target | 5 ms | For low bandwidth, try the average round-trip time to the first hop after OPNsense, rounded up |
| Interval | 100 ms | Start with the default |
| Quantum | 1514 bytes | Match the WAN MTU. The guide leaves this at the default for Ethernet |
| Limit | 10240 packets | The tuning guide suggests about 1000 for connections below 10 Gbit/s |
| Flows | 1024 | A change requires a reboot. Setting this too high can hang the device |
| ECN | Off | The setup enables it. The tuning guide advises turning it off on uplinks below 4 Mbit/s |
OPNsense FQ-CoDel parameters and tuning
How to set up FQ-CoDel on OPNsense
On an example 500/40 Mbit/s plan, 85% gives starting rates of 425 Mbit/s down and 34 Mbit/s up. This example uses higher rule sequences to leave room for control plane rules. FQ-CoDel setup · Control plane rule order
-
Before applying the shaper, run several speed tests and record download rate, upload rate and latency. Use the same test for subsequent measurements.
-
Open Firewall ‣ Shaper ‣ Pipes and select advanced mode. Create enabled Download and Upload pipes at 425 and 34 Mbit/s, respectively.
-
On each pipe, select FlowQueue-CoDel and enable (FQ-)CoDel ECN. Leave the mask and Enable CoDel unset, and start with the default limit, flows, target and interval. Use the default quantum for Ethernet.
-
Under Queues, create Download-Queue on Download and Upload-Queue on Upload. Enable both, set weight to 100 and leave the masks and queue CoDel settings empty.
-
Under Rules, create these enabled rules. For both, use interface WAN, protocol
ip, andanyfor addresses and ports.Traffic Sequence Direction Target Download 100 inDownload-Queue Upload 110 outUpload-Queue -
Select Apply. Run the same speed test, then raise the download rate in small steps and retest each time. When latency rises, back off to the last rate that kept it low. Repeat for upload.
Optional target tuning. From the OPNsense shell, identify the first hop after the firewall with traceroute 1.1.1.1. Run ping -s 1472 -c 1000 -D <hop-ip> with that hop’s address, then round the average round-trip time up for the Target setting. Target and interval tuning
When do weighted queues make sense?
Use weighted queues when competing applications need proportional shares of one pipe. The control plane how-to identifies WFQ and QFQ as schedulers that honor queue weights. A lower-weight queue retains its share even while a higher-weight queue stays backlogged. Control plane shaping · Traffic shaping overview
The weighted queues example puts Queue-SMTP (weight 9) and Queue-HTTP (weight 1) on a 10 Mbit/s download pipe. The example’s WAN rules match these source ports. When both queues are backlogged, SMTP gets 9 Mbit/s and HTTP and HTTPS share 1 Mbit/s. Prioritize applications using queues
| Sequence | Source port | Target |
|---|---|---|
| 11 | 25 (SMTP) | Queue-SMTP |
| 21 | 80 (HTTP) | Queue-HTTP |
| 31 | 443 (HTTPS) | Queue-HTTP |
Rules can also match DSCP. For example, send packets marked Expedited Forwarding (EF) to a weighted queue to give them a share under contention. Traffic shaper model · Traffic shaping overview
How do you cap bandwidth for GuestNet?
The standalone GuestNet example caps the entire guest network at 2 Mbit/s down and 1 Mbit/s up on a symmetric 10 Mbit/s connection. It uses two pipes and two WAN rules, with each rule targeting a pipe directly. The caps apply only to GuestNet. OPNsense GuestNet how-to
On Pipes, create the enabled pipes with empty masks. On Rules, create the matching rules in advanced mode. Set Interface to WAN, Interface 2 to GuestNet and protocol to ip on both rules. Leave addresses and ports at any. GuestNet pipe and rule settings
| Traffic | Pipe and rule target | Pipe rate | Rule sequence | Rule direction |
|---|---|---|---|---|
| Download | PipeDown-2Mbps | 2 Mbit/s | 11 | in |
| Upload | PipeUp-1Mbps | 1 Mbit/s | 21 | out |
Select Apply to activate the rules.
Do you need a control plane class for IPv6?
Consider a dedicated class if you run IPv6 or dynamic routing. The OPNsense example matches ipv6-icmp and uses WFQ or QFQ to reserve capacity. The guide flags FQ-CoDel and FQ-PIE for their congestion feedback. FQ-CoDel guidance · Control plane shaping
- Open Firewall ‣ Shaper ‣ Pipes in advanced mode. Create an enabled pipe per direction at 1% of the tuned bandwidth, with a minimum of 1 Mbit/s. Select WFQ or QFQ.
- Under Queues, create one enabled queue per pipe at weight 100. Reserve these pipes and queues for control plane traffic.
- Under Rules, create one enabled rule per direction on WAN. Use protocol
ipv6-icmp, leave addresses and ports atany, and target the corresponding queue. Set download toinand upload toout. - Give both rules lower sequences than the catch-alls. Subtract the reserved bandwidth from the corresponding FQ-CoDel pipes and select Apply.
For the example above, if the tuned rates are 425/34 Mbit/s, round 1% of 425 up to 5 Mbit/s and use the 1 Mbit/s minimum for upload. Put the control plane rules at sequences 10 and 20 and trim the main pipes to 420 and 33 Mbit/s. For additional protocols, add matching rules and queues to the control plane pipes. Control plane example
The guide lists OSPF and BGP as control plane traffic. For tunnel configuration, see OPNsense WireGuard site-to-site.
How to check that shaping works
Open Firewall ‣ Shaper ‣ Status to see traffic passed since the service last restarted. Select Show rules for per-rule data or Show active flows for flow details, then refresh. From the shell, use dnctl pipe show and dnctl queue show to list pipes and queues. OPNsense shaper status · FreeBSD ipfw manual
If latency stays high under load, check the status counters while you retest. Confirm that WAN download uses in, WAN upload uses out, and the intended rule comes before any matching catch-all. Retune one pipe at a time using the same speed test. FQ-CoDel tuning · Control plane rule order
What does shaping cost?
OPNsense describes its shaper as having a low CPU footprint. Its FQ-CoDel guide notes that a smaller quantum can increase CPU work. Traffic shaping overview · FQ-CoDel quantum tuning
For hardware sizing and VPN trade-offs, see OPNsense hardware requirements and WireGuard vs OpenVPN vs IPsec on OPNsense.
Evidence and limits. The configuration is based on OPNsense documentation and the traffic shaper model, with OPNsense CE 26.7 release notes for version context. The steps were checked against the cited documentation and were not run on a firewall.
Related across the network
- pfSense Multi-WAN Setup: Failover vs Load Balancing — pfsenselab.com
- OPNsense Port Forwarding: NAT Rules That Actually Work — opnsenselab.com