1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

vlan rate limiting

Discussion in 'Tomato Firmware' started by onehomelist, Aug 27, 2010.

  1. onehomelist

    onehomelist Addicted to LI Member

    I want to do rate limiting on a vlan. I have created 2 vlans for 2 different physical Ethernet ports. I want to limit vlan4 to 2Mbps up/down. Are there scripts available to achieve this? Any help is very much appreciated.
     
  2. onehomelist

    onehomelist Addicted to LI Member

    I found a solution.

    First a vlan should be created. Lets assume that it is vlan4, and we need 2 Mbits up/down rate and the cieling (hard limit) is 2.4 Mbits. The following line of code should be put at wan up script.

    Code:
    tc qdisc add dev vlan4 root tbf rate 2mbit burst 10kb latency 70ms peakrate 2.4mbit minburst 1540
    Thats it, it'll do the magic.

    You can also login via the shell, and give the above command at the shell prompt.

    If you want to see if the rules are applied, you can enter the following code at the shell prompt.

    Code:
    tc -s qdisc ls dev vlan4
    If you're trying it on defualt tomato interfaces (vlan2, br0 etc.), the chances are that they already have some tc rules. In such cases the existing rules need to be deleted. This line can be used to delete the rules.

    Code:
    tc qdisc del dev vlan4 root
    Once you apply a tc qdisc rule on vlan4, if you want try alternative tc configurations, you must delete the existing rules. If not deleted you will get an error.
     
  3. onehomelist

    onehomelist Addicted to LI Member

    Here is log of tc rate limiting

    Code:
    qdisc tbf 8001: root rate 2000Kbit burst 10Kb peakrate 2400Kbit minburst 1539b lat 71.7ms 
     Sent 1385599478 bytes 1056488 pkt (dropped 63439, overlimits 1592144 requeues 0) 
     rate 0bit 0pps backlog 0b 13p requeues 0 
    
    Is there anyway to avoid packets getting droped?
     

Share This Page