Скрипт:
#!/bin/sh
wan=eth0
lan=br-lan
tc=`which tc`
$tc qdisc del dev $wan root
$tc qdisc del dev $lan root
$tc qdisc del dev ifb0 root
ifconfig ifb0 up
$tc qdisc add dev $lan root handle 1:0 htb default 1
$tc class add dev $lan parent 1:1 classid 1:1 htb rate 1024Mbit
$tc qdisc add dev $lan parent 1:1 sfq
#$tc qdisc add dev $lan parent 1:1 netem delay 100ms
$tc qdisc add dev $wan root handle 1: htb default 1
$tc class add dev $wan parent 1:1 classid 1:1 htb rate 1024Mbit
$tc qdisc add dev $wan parent 1:1 sfq
$tc qdisc del dev $lan ingress
$tc qdisc add dev $lan ingress
$tc filter add dev $lan parent ffff: protocol ip u32 match u32 0 0 action mirred egress redirect dev ifb0
$tc filter add dev $lan parent ffff: protocol ipv6 u32 match u32 0 0 action mirred egress redirect dev ifb0
$tc qdisc add dev ifb0 root handle 1: htb default 1
$tc class add dev ifb0 parent 1:1 classid 1:1 htb rate 1250Mbit
$tc qdisc add dev ifb0 parent 1:1 sfq perturb 10
$tc class add dev ifb0 parent 1:1 classid 1:2 htb rate 2Mbit
$tc class add dev $lan parent 1:1 classid 1:2 htb rate 2Mbit
$tc class add dev $wan parent 1:1 classid 1:2 htb rate 2Mbit
# Rules from clients
tc filter add dev $wan parent 1:1 protocol ip prio 1 u32 match ip dst 10.243.0.253/32 flowid 1:2
tc filter add dev $lan parent 1:1 protocol ip prio 1 u32 match ip dst 10.243.0.253/32 flowid 1:2
tc filter add dev ifb0 parent 1:1 protocol ip prio 1 u32 match ip src 10.243.0.253/32 flowid 1:2