Написал скрипт для шейпинга трафика для одной машины в локальной сети, eth0-смотрит в локалку, eth1-в сторону провайдера. Подскажите почему не работает шейпер?
Код скрипта
shaper.sh:
# show<br/>
if [ "$1" = "show" ]; then<br/>
/sbin/tc -s qdisc show dev eth0<br/>
/sbin/tc -s class show dev eth0<br/>
/sbin/tc -s filter show dev eth0<br/>
/sbin/tc -s filter show dev eth0 parent 12:<br/>
exit;<br/>
fi<br/>
<br/>
if [ "$1" = "stop" ]; then<br/>
echo "Stopped."<br/>
# clean<br/>
/sbin/tc qdisc del dev eth0 root 2>/dev/null<br/>
/sbin/tc qdisc del dev eth1 root 2>/dev/null<br/>
/sbin/tc qdisc del dev eth0 ingress 2> /dev/null<br/>
<br/>
exit<br/>
fi<br/>
<br/>
if [ "$1" = "start" ]; then<br/>
<br/>
echo "Started."<br/>
<br/>
/sbin/tc qdisc add dev eth0 root handle 1: prio bands 3<br/>
/sbin/tc qdisc add dev eth0 parent 1:1 handle 10: pfifo<br/>
/sbin/tc qdisc add dev eth0 parent 1:2 handle 11: pfifo<br/>
/sbin/tc qdisc add dev eth0 parent 1:3 handle 12: htb default 0<br/>
<br/>
/sbin/tc filter add dev eth0 parent 12: prio 3 handle 1: protocol ip u32 divisor 256<br/>
/sbin/tc filter add dev eth0 protocol ip parent 12: prio 3 u32 match ip dst 172.16.0.0/24 hashkey mask 0x000000ff at 16 link 1:<br/>
<br/>
/sbin/tc class add dev eth0 parent 12: classid 12:101 htb rate 1024Kbit ceil 1024Kbit quantum 1514 mtu 16500<br/>
/sbin/tc qdisc add dev eth0 parent 12:101 handle 101: sfq perturb 5<br/>
/sbin/tc filter add dev eth0 protocol ip parent 12: prio 7 u32 ht 1:65: match ip dst 172.16.0.2 flowid 12:101<br/>
/sbin/tc filter add dev eth0 parent 1:0 protocol ip prio 4 u32 match ip dst 172.16.0.0/24 flowid 1:3<br/>
<br/>
exit<br/>
fi<br/>
<br/>
case "$1" in<br/>
start)<br/>
start<br/>
;;<br/>
stop)<br/>
stop<br/>
;;<br/>
restart)<br/>
stop<br/>
start<br/>
;;<br/>
list)<br/>
list<br/>
;;<br/>
stats)<br/>
list -s<br/>
;;<br/>
*)<br/>
echo "Usage: $0 {start|stop|restart|list|stats}"<br/>
exit 1<br/>
esac
Вывод
tc -s class show dev eth0:
root@promeline://# tc -s class show dev eth0<br/>
class prio 1:1 parent 1: leaf 10:<br/>
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)<br/>
backlog 0b 0p requeues 0<br/>
class prio 1:2 parent 1: leaf 11:<br/>
Sent 84 bytes 2 pkt (dropped 0, overlimits 0 requeues 0)<br/>
backlog 0b 0p requeues 0<br/>
class prio 1:3 parent 1: leaf 12:<br/>
Sent 1287381 bytes 1545 pkt (dropped 0, overlimits 0 requeues 0)<br/>
backlog 0b 0p requeues 0<br/>
class htb 12:101 root leaf 101: prio 0 rate 1024Kbit ceil 1024Kbit burst 16499b cburst 16499b<br/>
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)<br/>
rate 0bit 0pps backlog 0b 0p requeues 0<br/>
lended: 0 borrowed: 0 giants: 0<br/>
tokens: 2014156 ctokens: 2014156<br/>
<br/>
class htb 12:102 root leaf 102: prio 0 rate 1024Kbit ceil 1024Kbit burst 16499b cburst 16499b<br/>
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)<br/>
rate 0bit 0pps backlog 0b 0p requeues 0<br/>
lended: 0 borrowed: 0 giants: 0<br/>
tokens: 2014156 ctokens: 2014156