Jump to content
Калькуляторы

Подскажите куда рыть шейпер tc неправильно режит скорость... Помогите правильно сделать правила

Шейпер плохо режит трафик, если задано 80mbit, то выдаёт по спидтестетру 30-35mbit, по торрентам 10-15mbit, подскажите пожалуйста куда рыть, не могу найти ответ, тяжело даёться понимание шейпера...

Топология сети eth0 - Интернет, eth1 имеет 10 vlan eth1.2, eth1.4...

Вот мой скрипт из режима отладки:

+ /sbin/tc qdisc add dev eth1 root handle 1: htb default 250
+ /sbin/tc qdisc add dev eth0 root handle 1: htb default 250
+ /sbin/tc class add dev eth1 parent 1: classid 1:1 htb rate 1000000Kbit
+ /sbin/tc class add dev eth0 parent 1: classid 1:1 htb rate 1000000Kbit
+ /sbin/tc class add dev eth1 parent 1:1 classid 1:250 htb rate 25000Kbit ceil 100000Kbit prio 1 quantum 15365
+ /sbin/tc qdisc add dev eth1 parent 1:250 handle 250: sfq perturb 10
+ /sbin/tc class add dev eth0 parent 1:1 classid 1:250 htb rate 25000Kbit ceil 100000Kbit prio 1 quantum 15365
+ /sbin/tc qdisc add dev eth0 parent 1:250 handle 250: sfq perturb 10
+ /bin/cat /home/cli_nets.lst
+ /bin/sed -r 's/192\.168\.([0-9]{1,2}).{1,}/\1/'
+ read seg
+ /sbin/tc filter add dev eth1 parent 1: prio 5 handle 2: protocol ip u32 divisor 256
+ /sbin/tc filter add dev eth1 parent 1: protocol ip u32 ht 800:: match ip dst 192.168.2.0/24 hashkey mask 0x000000ff at 16 link 2:
...
+ read seg
+ /bin/cat /home/unlimit.dat
+ read ip speed
$ECHO ${ip} | $SED -r 's/192\.168\.([0-9]{1,2}).{1,}/\1/'
++ /bin/echo 192.168.2.11
++ /bin/sed -r 's/192\.168\.([0-9]{1,2}).{1,}/\1/'
+ local THREEOC=2
$PRINTF '%x\n' ${THREEOC}
++ /usr/bin/printf '%x\n' 2
+ local THREEOCHEX=2
$ECHO ${ip} | $SED -r 's/192\.168\.[0-9]{1,2}.([0-9]{1,3})/\1/'
++ /bin/echo 192.168.2.11
++ /bin/sed -r 's/192\.168\.[0-9]{1,2}.([0-9]{1,3})/\1/'
+ local FOUROC=11
$PRINTF '%x\n' ${FOUROC}
++ /usr/bin/printf '%x\n' 11
+ local FOUROCHEX=b
$PRINTF '%x\n' ${THREEOC}${FOUROC}
++ /usr/bin/printf '%x\n' 211
+ local ID=d3
+ speedrate=20000
+ /sbin/tc class add dev eth1 parent 1:1 classid 1:d3 htb rate 20000Kbit ceil 80000Kbit prio 5 quantum 15365
+ /sbin/tc qdisc add dev eth1 parent 1:d3 handle d3: sfq perturb 10
+ /sbin/tc filter add dev eth1 protocol ip prio 5 u32 ht 2:b: match ip dst 192.168.2.11/32 flowid 1:d3
+ /sbin/tc class add dev eth0 parent 1:1 classid 1:d3 htb rate 20000Kbit ceil 80000Kbit prio 5 quantum 15365
+ /sbin/tc qdisc add dev eth0 parent 1:d3 handle d3: sfq perturb 10
+ /sbin/tc filter add dev eth0 protocol ip prio 5 u32 ht 2:b: match ip src 192.168.2.11/32 flowid 1:d3
...

Тут статистика tc:

eth1 qdisc htb 1: root refcnt 17 r2q 10 default 250 direct_packets_stat 622 ver 3.17
eth1  Sent 80685651877 bytes 68826839 pkt (dropped 137186, overlimits 63910285 requeues 10) 
eth1  rate 0bit 0pps backlog 0b 125p requeues 10 
eth1 qdisc sfq 250: parent 1:250 limit 127p quantum 1514b flows 127/1024 perturb 10sec 
eth1  Sent 5251229131 bytes 4041930 pkt (dropped 20246, overlimits 0 requeues 0) 
eth1  rate 0bit 0pps backlog 0b 0p requeues 0 
eth1 qdisc sfq 16: parent 1:16 limit 127p quantum 1514b flows 127/1024 perturb 10sec 
eth1  Sent 70197120 bytes 349357 pkt (dropped 0, overlimits 0 requeues 0) 
eth1  rate 0bit 0pps backlog 0b 0p requeues 0 
eth1 qdisc sfq 17: parent 1:17 limit 127p quantum 1514b flows 127/1024 perturb 10sec 
eth1  Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
eth1  rate 0bit 0pps backlog 0b 0p requeues 0 
eth1 qdisc sfq d2: parent 1:d2 limit 127p quantum 1514b flows 127/1024 perturb 10sec 
eth1  Sent 15304197 bytes 12838 pkt (dropped 0, overlimits 0 requeues 0) 
...
eth0 qdisc htb 1: root refcnt 17 r2q 10 default 250 direct_packets_stat 293 ver 3.17
eth0  Sent 16111763985 bytes 51069516 pkt (dropped 931, overlimits 8775819 requeues 6) 
eth0  rate 0bit 0pps backlog 0b 0p requeues 6 
eth0 qdisc sfq 250: parent 1:250 limit 127p quantum 9014b flows 127/1024 perturb 10sec 
eth0  Sent 1331733881 bytes 4629900 pkt (dropped 0, overlimits 0 requeues 0) 
eth0  rate 0bit 0pps backlog 0b 0p requeues 0 
eth0 qdisc sfq 16: parent 1:16 limit 127p quantum 9014b flows 127/1024 perturb 10sec 
eth0  Sent 631460314 bytes 630418 pkt (dropped 0, overlimits 0 requeues 0) 
eth0  rate 0bit 0pps backlog 0b 0p requeues 0 
...
eth0 class htb 1:101 parent 1:1 leaf 101: prio 0 quantum 200000 rate 20000Kbit ceil 80000Kbit burst 1600b/8 mpu 0b overhead 0b cburst 1600b/8 mpu 0b overhead 0b level 0 
eth0  Sent 540 bytes 6 pkt (dropped 0, overlimits 0 requeues 0) 
eth0  rate 8bit 0pps backlog 0b 0p requeues 0 
eth0  lended: 6 borrowed: 0 giants: 0
eth0  tokens: 9407 ctokens: 2360
eth0 
eth0 class htb 1:100 parent 1:1 leaf 100: prio 0 quantum 93750 rate 7500Kbit ceil 30000Kbit burst 1598b/8 mpu 0b overhead 0b cburst 1593b/8 mpu 0b overhead 0b level 0 
eth0  Sent 6381981 bytes 43168 pkt (dropped 0, overlimits 0 requeues 0) 
eth0  rate 3168bit 4pps backlog 0b 0p requeues 0 
eth0  lended: 42754 borrowed: 187 giants: 0
eth0  tokens: 24448 ctokens: 6230
eth0 
eth0 class htb 1:103 parent 1:1 leaf 103: prio 0 quantum 200000 rate 20000Kbit ceil 80000Kbit burst 1600b/8 mpu 0b overhead 0b cburst 1600b/8 mpu 0b overhead 0b level 0 
eth0  Sent 2706213 bytes 42288 pkt (dropped 0, overlimits 0 requeues 0) 
eth0  rate 568bit 1pps backlog 0b 0p requeues 0 
eth0  lended: 42281 borrowed: 7 giants: 0
eth0  tokens: 9610 ctokens: 2407
...
eth0 filter parent 1: protocol ip pref 1 u32 
eth0 filter parent 1: protocol ip pref 1 u32 fh 80a: ht divisor 1 
eth0 filter parent 1: protocol ip pref 5 u32 
eth0 filter parent 1: protocol ip pref 5 u32 fh 16: ht divisor 256 
eth0 filter parent 1: protocol ip pref 5 u32 fh 16:2:800 order 2048 key ht 16 bkt 2 flowid 1:a2  (rule hit 12311 success 12311)
eth0   match c0a81002/ffffffff at 12 (success 12311 ) 
eth0 filter parent 1: protocol ip pref 5 u32 fh 16:a:800 order 2048 key ht 16 bkt a flowid 1:64a  (rule hit 60993 success 60993)
eth0   match c0a8100a/ffffffff at 12 (success 60993 ) 
eth0 filter parent 1: protocol ip pref 5 u32 fh 16:b:800 order 2048 key ht 16 bkt b flowid 1:64b  (rule hit 0 success 0)
eth0   match c0a8100b/ffffffff at 12 (success 0 ) 
eth0 filter parent 1: protocol ip pref 5 u32 fh 16:c:800 order 2048 key ht 16 bkt c flowid 1:64c  (rule hit 33157 success 33157)
eth0   match c0a8100c/ffffffff at 12 (success 33157 ) 
eth0 filter parent 1: protocol ip pref 5 u32 fh 16:d:800 order 2048 key ht 16 bkt d flowid 1:64d  (rule hit 1 success 1)
eth0   match c0a8100d/ffffffff at 12 (success 1 ) 
eth0 filter parent 1: protocol ip pref 5 u32 fh 16:e:800 order 2048 key ht 16 bkt e flowid 1:64e  (rule hit 0 success 0)
eth0   match c0a8100e/ffffffff at 12 (success 0 ) 
eth0 filter parent 1: protocol ip pref 5 u32 fh 16:11:800 order 2048 key ht 16 bkt 11 flowid 1:651  (rule hit 39640 success 39640)
eth0   match c0a81011/ffffffff at 12 (success 39640 ) 

Share this post


Link to post
Share on other sites

Для начала тестить надо не спидтестами и торрентами, а между двумя компами. Еще покажи:

ethtool -i eth0

ethtool -i eth1

ethtool -k eth0

ethtool -k eth1

ethtool -g eth0

ethtool -g eth1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this