$100 - Load balance by WAN capacity

  • I have two internet WANs:

    • 30 mbits/s cable, capped to 250 kbits/s when 100 gBytes is exceeded
    • uncapped ADSL2 that varies from 4 to 14 mbits/s

    I could set round robin load balance with weight of 3:1, but this won't work well if the cable service gets capped or the ADSL2 runs slow.

    The development I would like is "WAN link weightings auto adjusted periodically based on WAN data transfer capabilities"

    To enable the calculation, for each WAN we would need to capture a set of link capability facts:

    • nominal capacity ( example 30mb/s )
    • uncapped allocation ( example: 100 gbytes or unlimited )
    • reserve for other link fail ( example: none or 20 Gbytes )
    • use reserve if only link up ( example: y/n )
    • cap reset date ( example: day-of month or end-of-month or none)
    • take offline at cap limit ( example: y/n )
    • online/offline ping test period ( example: 60 seconds ) minimum 10 seconds
    • Initial load weighting ( example: 1 )
    • throughput floor for suspend of weighting calc ( example: 10kbits/sec )

    There are some global settings required to support the calculation:

    • rolling link speed sample period ( example 1800 seconds ) minimum 60 seconds,
    • peak speed sample period ( example 10 seconds ) minimum 5 seconds, max rolling link speed period / 4
    • weighting recalculation period ( example 600 seconds ) minimum 30 seconds, maximum is rolling link speed period

    Current link transfer capability would be defined as:
    "max peak speed reached over the rolling link speed sample period minutes, minus the average link speed over the sample period."

    • the weight range should be limited to 1 - 100
    • if the link ave is less than the throughput floor don't update the weighting values
    • if a link is down ( via ping test ) and comes back up, reset weights to nominal link capacity
    • reset to initial weightings if any wan reaches its cap reset date


    normal use
        WAN1 peak of 25mbits/sec, average of 5 mbits/sec = 20m
        WAN2 peak of 7mbits/sec, average of 4.5 mbits/sec = 2.5m
        therefore set the weight to 8:1 favouring WAN1

    cap on WAN1
        WAN1 peak of 250kbits/sec average of 240kbits/sec = 10k
        WAN2 peak of 7mbits/sec, average of 4.5 mbits/sec = 2.5m
        the ratio is 1:250, therefore set the weight to 1:100

    It would be good if I can also bring a third WAN service into the mix, I have a 3G USB modem that has a 1 gByte cap and has a high cost per mbyte if data is used above the cap. On this link we would want to reserve some bandwidth in case we lost both wans

    Would also like to track/chart the weighing values, peak speed and ave speed over time

    Maybe need to have separate weight calculation for upload and download?

    I am happy to start with a bounty of $100 but would really like to refine these specs further with others. Any one else interested?

  • This is not so easy to define and implement.
    You would at least need some kind of accounting service and statistic colletion.

    A way to define a policy based on accounting.

    Another way to apply the policy when it is reached.

    If you have better budget probably worth going through portal.pfsense.com since the implications in the pfSense are a bit drastic in terms of changes.

Log in to reply