- #!/bin/bash
- # On 100Mbps network shape all traffic going to 192.168.42.11
- # to 256Kbps
- PATH=/bin:/sbin
- tc qdisc add dev eth1 root handle 1: htb default 1
- tc class add dev eth1 parent 1: classid 1:1 htb rate 102400kbit
- tc class add dev eth1 parent 1:1 classid 1:10 htb rate 256kbit
- tc filter add dev eth1 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.42.11 flowid 1:10
- # To match both IP and port, use:
- # tc filter add dev eth1 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.42.12 match ip dport 22 0xffff flowid 1:10
- # To unshape, run:
- # tc filter del dev eth1 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.42.11 flowid 1:10
Raw Paste