OPNsense Forum

Archive => 16.7 Legacy Series => Topic started by: RickNY on October 05, 2016, 06:30:15 pm

Title: Traffic shaper question
Post by: RickNY on October 05, 2016, 06:30:15 pm
When I used pfSense, I set up a very basic CODELQ traffic shaper to reduce bufferbloat from my 101/35 connection.. I basically set a traffic value equal to my upload speed on the WAN interface, and set a traffic value of 90% of my download speed on the LAN interface.. That limited the total download speed and reduced bufferbloat significantly.

I'd like to do the same on OPNSense, and I set up a pipe according to the guide for "Limit bandwidth per user" -- only I changed it slightly to make the mask "destination".  My download speeds now are about 210Mb/s, and I wanted to limit that to about 200Mb/s, so I entered 200Mb/s in the pipe bandwidth.  I added the rule as described in the guide.  The problem I'm having is that the clients only seem to be able to use 50% of that bandwidth.

I'm probably misunderstanding something, but can someone explain how I can accomplish what I want with OPNSense? 

Thanks,
Rick
Title: Re: Traffic shaper question
Post by: RickNY on October 06, 2016, 05:27:45 pm
It would be really helpful if someone could prepare documentation on setting up a very basic traffic shaping configuration using FQ-CODEL to just minimize bufferbloat on asymmetrical residential broadband connections.
Title: Re: Traffic shaper question
Post by: RickNY on October 07, 2016, 01:54:42 pm

OK... After playing around a bit and reading through the documentation on Dummynet AQM 0.2 available at http://caia.swin.edu.au/reports/160708A/CAIA-TR-160708A.pdf -- I believe I've accomplished what I have wanted to do.  This is how I did it:

This is the only traffic shaping I have enabled, and its only purpose is to deal with bufferbloat.. Testing was with the DSL Reports speed test tool at https://www.dslreports.com/speedtest - prior to these changes, bufferbloat score was consistently an F.  My overprovisioned speed from my provider is 210 Mbps down and 37 Mbps up.  After implementing the rules below, bufferbloat score is an A+ and download speed is reduced to about 198-200Mbps down, and 35 Mbps up (my subscribed speed)

1) Under Firewall, Traffic Shaper, Settings:  I created two pipes as follows (with advanced mode enabled):
First, the upload pipe:
- Bandwidth: 37 Mbps
- Scheduler type: FlowQueue-CoDel
- Enable CoDel: Checked.
- Description: UpPipe
- Everything else at default (blank) values

Then the download pipe:
- Bandwidth: 210 Mbit/s
- Scheduler type: FlowQueue-CoDel
- Enable CoDel: Checked
- Everything else at default (blank) values

Apply..

2) I then created two queues:
- Pipe: UpPipe
- Weight: 100
- Description: UpQueue

-Pipe: DownPipe
- Weight: 100
- Description: DownQueue

3) Finally, I created two rules:
- Interface: WAN
- Proto: ip
- Source: 192.168.1.0/24   (My LAN)
- Src Port: any
- Destination: any
- Dst-port: any
- Direction: any
- Target: UpQueue
- Description: UpRule

- Interface: WAN
- Proto: ip
- Source: any
- Src Port: any
- Destination: 192.168.1.0/24   (My LAN)
- Dst-port: any
- Direction: any
- Target: DownQueue
- Description: DownRule


One thing I was unsure of was whether I should have enabled CoDel on the queues or not.  On the queues, with it enabled or disabled, I did not see any difference in the results.  Also, in my setup, I found that enabling ECN had a negative effect, so I left it off.

(http://www.dslreports.com/speedtest/5240432.png)
Title: Re: Traffic shaper question
Post by: Mohiuddin on October 13, 2016, 01:25:45 pm
Hi, Rick, unfortunately I'm having the same issue. I followed this link "https://docs.opnsense.org/manual/how-tos/shaper.html" and have done exactly the same thing, but my result is same as yours, no change in the overall speed.

Would appreciate if you can point out anything here!

Thanks!
Title: Re: Traffic shaper question
Post by: creator on February 17, 2017, 12:08:16 pm
Great guide... perhaps it should be pulled into the OPNsense documentation.... I also went from a consistent F to an B using this guide.

Because I saw some 'spikiness' on the upload I made a couple of adjustments to put things in better alignment with the Using Dummynet AQM paper and from the SQM bufferbloat recomendations on the LEDE project. Beautifully it bumped me up to an A:

UpPipe
Enable CoDel: Checked
CoDel target: 10
FQ-CoDel quantum: 1514
FQ-CoDel limit: 1024
FQ-CoDel flows: 1024

DownPipe
CoDel target: 10
FQ-CoDel quantum: 1514
FQ-CoDel limit: 1024
FQ-CoDel flows: 1024

Title: Re: Traffic shaper question
Post by: FrenchFries on August 15, 2017, 10:14:59 pm
I am not sure you are really looking for buffer-bloat, which is maximizing downloading/uploading speed and minimize buffer.  Buffer is an issue when traffic is faster than computing speed or your firewall is slow and cannot cope with data and buffers. Reducing cache can improve performance.

The documents you are quoting are about traffic shaping, i.e, "limiting traffic" to gain quality.

Here are some resources (Linux):
https://www.bufferbloat.net/projects/bloat/wiki/Linux_Tips

You can also have a look at LEDE, which implemented a dedicated buffer analysis application and then uses traffic shaping.

With LEDE, I could reach 98% max speed on my fiber line, with OPNSense, only 94%, but it does not matter to me guiven the quality of FreeBSD and OPNsense.