blog.world3.net

Traffic shaping with pfSense

A while back I wrote a guide to traffic shaping with pfSense. The pfSense wiki got broken, so I’m re-publishing it here for posterity. There is at least some useful info about calculating required upload bandwidth for a given download speed.

It is recommened that you use the Traffic Shaping Wizard to create a default set of rules from which to start. The rules the wizard creates can sometimes cope well with VOIP traffic, but need tweaking to accomodate other traffic.

As an example, let’s look at shaping P2P traffic. Assuming you used the wizard, there will be qP2Pup and qP2Pdown created already. When you launch a P2P app, you should see traffic in these queues. They are designed to carry the bulk P2P traffic, which normally slows your connection down. Other generic traffic, like web pages (HTTP), email, IM, VOIP etc will go into other queues.

Initially, the wizard sets all queues to 1% bandwidth. This is not enough. In particular, the queue qwanacks certainly needs more bandwidth if you do a lot of downloading. First, a quick note about ACK packets.

When you download, your computer needs to send (upload) ACK packets. These are basically saying “yep, I got that part of the download OK”. If the computer you are downloading from detects that an ACK has not been received, it assumes that the data was not received and sends it again. The rate at which ACKs are sent back is also used to help determine the maximum speed that you can download data at, so it’s important that ACKs get sent as soon as possible and don’t get dropped in order to keep your downloads flowing fast. Also, repeatedly dropped ACKs can result in dropped connections, web page time-outs etc.

When you download, qwanacks is where the ACK packets your computer sends out go. You need to make sure this queue has enough bandwidth to maintain your downloads. To work out how much bandwidth you need, there are two options. You could simply experiment, keeping an eye on the queue while downloading as fast as your connection will allow, or you could try and work it out. As a rough starting point, an NTL 10Mb/512Kb cable connection needs about 260-270Kb/sec of ACK packets to download at full speed.

Taking the above example, we can see that ACKs can consume 60% of the available upload bandwidth. Thus, qwanacks should have at least 60% bandwidth available (I use 65% for the above). If you set qwanacks like this, you should not see any drops in that queue. However, you will see a lot in qP2Pup, but that’s OK. P2P upload packets are just bulk traffic, not really important so it doesn’t matter if they drop a bit. qP2Pup will now be using what is left of the available upload bandwidth, after qwanacks has used up to 65% of it. You will probably want to increase the bandwidth allowance for qwandef as well, since this is where HTTP requests and other general uploads go, which chances are you want to be higher priority than qP2Pup. Bandwidth percentages need not add up to 100%, but unless you have a very slow connection you don’t need too much for qwandef since it is mainly small requests or the odd few kb of email.

This entry was written by mojo, posted on 10/03/2008 at 18:54, filed under networking. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.
« Avira Labs fail to identify malware, even when the analysis is done for them
Phorm: the smoking gun »

4 Comments

  1. Chris Buechler
    Posted 11/03/2008 at 22:44 | Permalink

    The pfSense wiki didn’t get broken, though we did move to a new site a while back because of the amount of spam the old one had become infested with. But we should have moved all the content over, if something was missed please email me. Thanks!

  2. mojo-chan
    Posted 12/03/2008 at 11:08 | Permalink

    I found it was still there, but it seems to be on the developer side now and not linked well. It really needs to be on the user side because after all it’s users who will need to configure traffic shaping.

  3. Arturo
    Posted 08/03/2010 at 19:40 | Permalink

    And this is the main reason I like blog.world3.net. Amazing post.

  4. mojo
    Posted 09/03/2010 at 15:53 | Permalink

    Thanks Arturo!

Post a Comment

Your email is never shared. Required fields are marked *

*
*

たとえ溺れても梦はゆめでしかない
  •  

    March 2008
    M T W T F S S
    « Feb   Apr »
     12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31  
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Categories

    • audio (1)
    • avr (15)
    • electronics (24)
    • genius (4)
    • hardware (21)
    • idiots (33)
    • Internet (13)
    • law (17)
    • microcontrollers (11)
    • networking (17)
    • politics (27)
    • privacy (18)
    • Retro Adapter (4)
    • security (16)
    • software (27)
    • Uncategorized (16)
    • windows (19)
  • Archives

    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • November 2005
  • Links:

    Main site: world3.net

    Electronics: denki.world3.net

WordPress | Sandbox