[@ryu]12:53PM ~ > cat ~/bin/choke #!/bin/bash # change these values to suit your needs ETHERNET_DEVICE="eth1" LINK_SPEED="102400Kbit" UPLOAD_SPEED="500Kbit" PORT="80" echo -n "Limiting poor bastards on port $PORT to $UPLOAD_SPEED..." # delete previous root node tc qdisc del dev $ETHERNET_DEVICE root # create root node tc qdisc add dev $ETHERNET_DEVICE root handle 1: htb default 11 # create LINK class tc class add dev $ETHERNET_DEVICE parent 1: classid 1:1 htb rate $LINK_SPEED # create our HTTP shaping class tc class add dev $ETHERNET_DEVICE parent 1:1 classid 1:10 htb rate $UPLOAD_SPEED # create our REST class for unutilized bandwidth tc class add dev $ETHERNET_DEVICE parent 1:1 classid 1:11 htb rate $LINK_SPEED # create the filter for the HTTP class, we filter on source port 80 (http) tc filter add dev $ETHERNET_DEVICE protocol ip parent 1:0 prio 1 u32 match ip sport $PORT 0xffff flowid 1:10 echo " [DONE]";