Example - Script
The ‘tc’ script to do this
- tc qdisc add dev eth0 handle 1:0 root dsmark indices 64
- tc class change dev eth0 classid 1:1 dsmark mask 0x3 value 0xb8
- tc class change dev eth0 classid 1:2 dsmark mask 0x3 value 0x68
- tc class change dev eth0 classid 1:3 dsmark mask 0x3 value 0x48
- tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1: u32 divisor 1
- tc filter add dev eth0 parent 1:0 protocol ip prio 5 handle 2: u32 divisor 1
- tc filter add dev eth0 parent 1:0 prio 4 u32 match ip dst 10.0.0.0/24 police rate 1Mbit burst 2K flowid 1:1
- tc filter add dev eth0 parent 1:0 prio 5 u32 match ip dst 10.0.0.0/24 flowid 1:2
- tc filter add dev eth0 parent 1:0 prio 4 u32 match ip dst 10.1.0.0/16 match ip dst 192.1.0.0/16 match ip protocol 6 0xff match ip dport 0x17 0xffff flowid 1:3