Доброго времени суток!
Неполучается зашейпить исходящий из LAN трафик. Входящий шейпится в штатном режиме.
На ppp0 работает SNAT
Имеется рутер CentOS5.4
eth0 (ppp0) - WAN
eth1 - LAN (192.168.2.0/24)
Правила шейпера:
DEV=«eth1»
RATE=«4500»
tc qdisc del dev $DEV root 2> /dev/null > /dev/null
tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
#Add root discipline to device eth1 -----------------------------------------------------------
tc qdisc add dev $DEV root handle 1:0 htb default 200
#Add root classes to root discipline ----------------------------------------------------------
#Add root class for workstations packets flow
tc class add dev $DEV parent 1:0 classid 1:1 htb rate ${RATE}kbit
#Add branch classes to root classes -----------------------------------------------------------
#Add leaf classes to 1:1 root class
tc class add dev $DEV parent 1:1 classid 1:10 htb rate 512kbit ceil 512kbit
tc class add dev $DEV parent 1:1 classid 1:11 htb rate 512kbit ceil 512kbit
#Add filter for ingress packets flow from workstations
tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.2.245 flowid 1:10
tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src 192.168.2.245 flowid 1:11
Вот что показывает tc
[root@hydra shaper]# tc -s filter show dev eth1
filter parent 1: protocol ip pref 1 u32
filter parent 1: protocol ip pref 1 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:10 (rule hit 37870 success 1270)
match c0a802f5/ffffffff at 16 (success 1270 )
filter parent 1: protocol ip pref 1 u32 fh 800::801 order 2049 key ht 800 bkt 0 flowid 1:11 (rule hit 36600 success 0)
match c0a802f5/ffffffff at 12 (success 0 )
[root@hydra shaper]# tc -s qdisc show dev eth1
qdisc htb 1: r2q 10 default 200 direct_packets_stat 106744
Sent 121612780 bytes 108109 pkt (dropped 0, overlimits 5832 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
[root@hydra shaper]# tc -s class show dev eth1
class htb 1:11 parent 1:1 prio 0 rate 512000bit ceil 512000bit burst 1664b cburst 1664b
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
lended: 0 borrowed: 0 giants: 0
tokens: 26000 ctokens: 26000
class htb 1:1 root rate 4500Kbit ceil 4500Kbit burst 2161b cburst 2161b
Sent 1129251 bytes 1411 pkt (dropped 0, overlimits 0 requeues 0)
rate 11848bit 3pps backlog 0b 0p requeues 0
lended: 0 borrowed: 0 giants: 0
tokens: 3659 ctokens: 3659
class htb 1:10 parent 1:1 prio 0 rate 512000bit ceil 512000bit burst 1664b cburst 1664b
Sent 1129251 bytes 1411 pkt (dropped 0, overlimits 0 requeues 0)
rate 11848bit 3pps backlog 0b 0p requeues 0
lended: 1411 borrowed: 0 giants: 0
tokens: 24375 ctokens: 24375
Тестирую через speedtest.net Результат теста:
Download Speed: 50KBps (как и указано в правилах)
Upload Spped: 1.7Mbps (не как у казано в правилах :) )