# Enable root tc qdisc add dev eth0 root handle 1: htb default 12 # main limit Root tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps # Define limit per child tc class add dev eth0 parent 1:1 classid 1:10 htb rate 30kbps ceil 100kbps tc class add dev eth0 parent 1:1 classid 1:11 htb rate 10kbps ceil 100kbps tc class add dev eth0 parent 1:1 classid 1:12 htb rate 60kbps ceil 100kbps # if source-port 80 and ip is 1,2,3,4 goto :10 tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip dst 1.2.3.4 match ip sport 80 0xffff flowid 1:10 # Other traffic from 1.2.3.4 goto :11 tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip dst 1.2.3.4 flowid 1:11