How to dynamically balance my connection according to the usage?



  • Hi everyone

    I have just sat up my pfSense machine yesterday in an effort to mainly get rid of bufferbloat and optimize my brother's and I gaming experience and to dynamically allocate bandwidth according to the usage
    My connection is 16 Mbps Down 1 Mbps Up (I am hopefully upgrading soon to 25 or 50 Mbps Down with 2.5 or 5 Mbps Up respectively)
    Total users of my family are 5 (up to 8 ,but with just 3 extra devices if we have my relatives over) with each having a phone and a laptop or PC, pretty standard stuff
    I tried googling the matter but couldn't really understand what to do (This is my first ever project of that kind and just getting the modem to work correctly took me 2 days of reading, trying and troubleshooting)
    a lot of users refer to someone here named foxale08 who looks to have made a guide but it is from 2013 and I don't know if it still applies (I have everything updated to even today's update, 2.4.4v2)

    I am also open to any tips and suggestions of config settings and or useful packages to install
    Thanks in advance



  • Traffic-shaping is probably the hardest part of pfSense to figure out. I would start here:

    Traffic Shaping Basics with PRIQ on pfSense

    How To Solve pfsense Bufferbloat With A CodelQ / FQ_Codel Limiter in 2.4.4



  • I hate to say it, because I really enjoy using pfsense and supporting the project, but... You might be better off using another router product that is specifically suited to traffic shaping and optimizing your available internet connection.

    IQrouter is one, the UniFi Edge Routers are good, and there’s the Turris Omnia box running OpenWRT. I haven’t used any of these myself, just heard about and researched them online. From what I understand, the IQrouter is stupid simple to use.

    Here's some links:

    http://evenroute.com/iqrouter
    https://www.ui.com/products/#edgemax
    https://www.turris.cz/en/turris-omnia/

    Jeff



  • @akuma1x
    I was afraid of that and started finding other people with similar opinions
    The problem is all these routers aren't sold in my region and trying to import them wil make their costs ridiculously high and also I want to use pfSense as well (especially after I spend two days troubleshooting why my WAN wasn't picking up without any guide or clue on what to do or try)
    Thanks for the input nevertheless



  • @Morad__T
    Give a try to fq_codel - instructions from second link mentioned by @KOM. I can't guarantee that will work for you, but after configuring it, it should just work. Unfortunately it is set for whole network (there is no easy way to set it for specific users/IP), but by design it should get rid of bufferbloat and improve "the feel" of your network. At least that is the way it works for me. It got so much better that I don't need to fine tune it more for specific users.

    But having only 1Mbps up you have to remember about taget parameter mentioned in configuration instructions. It is set to 5ms by default, but for you it should be 15ms as mentioned in documentation

    The default target value is 5 ms, but this value should be tuned to be at least the transmission time of a single MTU-sized packet at the prevalent egress link speed (which for e.g. 1Mbps and MTU 1500 is ~15ms), to prevent CoDel from being too aggressive at low bandwidths. It should otherwise be set to on the order of 5-10% of the configured interval.



  • @tomashk Thank you very much
    i have been using it already for about 2 days now and yes definitely feels better, though i don't understand how it works exactly
    I thought it was what I needed but after initiating two steam downloads simultaneously almost all the bandwidth was allocated towards my PC every time, which is not what I want
    I will tweak it out as you mentioned
    And can you link me these documents/instructions please?



  • @Morad__T said in How to dynamically balance my connection according to the usage?:

    I will tweak it out as you mentioned
    And can you link me these documents/instructions please?

    Instruction about target can be found in FQ-CoDel RFC - RFC 8290



  • A couple other options for you to consider which may achieve your objectives:

    1. Setup (bandwidth) limiters and make sure they are applied by IP (e.g. each IP addresses would be limited to x Mbit and no more than that). Please check out this link to the documentation and make sure you read past Creating Limiters where it talks about masks: https://docs.netgate.com/pfsense/en/latest/book/trafficshaper/limiters.html

    2. Another option would be to setup limiters and then weighted queues underneath them with Codel as your AQM algorithm. For the scheduler I would recommend starting with QFQ (Quick Fair Queuing). When your connection is fully loaded down (utilized) the queues will be limited by their respective weights. For instance, if you had 10Mbit connection with a 10Mbit Limiter and 2 queues each with weight 50, each queue would be limited to 50% of the total 10Mbit bandwidth if the full 10Mbit is being asked for. However, if there is only traffic in one queue and no traffic in the other, that queue will have access to the full 10Mbit. As such, you can think of the weights as essentially the guaranteed bandwidth per queue.

    A couple more resources:
    Great YouTube video on traffic shaping: https://www.youtube.com/watch?v=rF46PNid1Mo
    Documentation on FQ_Codel implementation on FreeBSD: http://caia.swin.edu.au/freebsd/aqm/downloads.html

    I would also recommend doing a Google search on dummynet to become more familiar with the terms and how it works.
    Hope this helps.



  • @tman222 Thank you so much for the tremendous help
    I will definitely read through these links and give it a try
    Really appreciate it



  • The thread you're looking for is this one:

    https://forum.netgate.com/topic/57476/per-ip-traffic-shaping-share-bandwith-evenly-between-ip-addresses

    That's where foxale08 "shared the magic".



  • @fsr
    Thanks a lot
    Really appreciate your help and replying to my thread even a month later
    Also thanks to whatever algorithm that got you to me


Log in to reply