# http://www.linuxforum.com/linux-advanced-routing/lartc.ratelimit.single.html # Commands to add rate limiting for TCP in Linux # These commands must be run as root # # eth0 = firewall's external network card (attached to internet) # 10mbit = speed of external network card # 300kbit = max TCP upload speed # Create a Class based queue # Set normal interface speed (10Mb) for use in calculations tc qdisc add dev eth0 root handle 1: cbq avpkt 1000 bandwidth 10mbit # Create a 300Kb class tc class add dev eth0 parent 1: classid 1:1 cbq rate 300kbit allot 1500 prio 5 bounded isolated # Tell which traffic should use the shaped class # Protocol 6 = TCP tc filter add dev eth0 parent 1: protocol ip prio 16 u32 match ip protocol 6 0xff flowid 1:1 # ... to match a single ip address # ... match ip dst 195.96.96.97 flowid 1:1 # # Note: FeatureTel Soho customers need to rate-limit all traffic except # voice traffic. All their Voice traffic goes to our Voice Proxy # Firewall at 216.134.205.166. So they would use: # ... match ip dst ! 216.134.205.166 flowid 1:1 # If it breaks everything, back out by using: # tc qdisc del dev eth0 root