>> O'k. I have Debian stable Linux router to Internet. > > > kernel version?
2.4.21
>
>
>> I want manage Internet traffic on it:
>> Increase priority and speed of some protocols and decrease for others.
>> I know that I can change this only for outgoing packets.
>> First question:
>> If I decrease priority and speed for local network interface
>> does this mean that priority and speed for Internet interface
>> for the same protocol also decreases?
>> For example:
>> eth0 local network
>> eth1 Internet
>>
>> tc qdisc del dev eth0 root
>> tc qdisc add dev eth0 root handle 1 htb default 99
>
>
> You don't have a 1:99 class. It's best if you have a 1:99 class so all packets not matched by any filters are placed in a class.
Yes. I have 1:99 class. I didn't write all script.
>
>
>> tc class add dev eth0 parent 1: classid 1:2 htb rate 256Mbit burst 15k
>
>
> Do you have a 256Mbit link? And 15k is way too low. Remove all burst parameters so htb can calculate the minimum burst for you.
It's mistake. Should be 256Kbit
> > >> tc class add dev eth0 parent 1:2 classid 1:10 htb rate 64Kbit ceil >> 128Kbit burst 15k prio 4 >> tc qdisc add dev eth0 parent 1:10 handle 10 sfq perturb 10 >> tc filter add dev eth0 parent 1:0 protocol ip prio 100 u32 match ip >> sport 80 0xffff match ip dst 192.168.1.0/24 classid 1:10 >> >> Does this means that incoming traffic on eth1 to port 80 will be in >> 64Kbit-128Kbit with prio 4? > > > Yes.
Thanks. Second question. I play with htb.init-v0.8.4 from sf.net and QOS configurator from docum.org. I attached my htb script. Then I get statistics: # tc -s -d qdisc show dev eth0 qdisc sfq 80cf: limit 128p quantum 1514b flows 128/1024 Sent 1880603 bytes 3102 pkts (dropped 0, overlimits 0) qdisc sfq 80ce: limit 128p quantum 1514b flows 128/1024 Sent 2184 bytes 30 pkts (dropped 0, overlimits 0) qdisc sfq 80cd: limit 128p quantum 1514b flows 128/1024 Sent 16322 bytes 87 pkts (dropped 0, overlimits 0) qdisc sfq 80cc: limit 128p quantum 1514b flows 128/1024 Sent 0 bytes 0 pkts (dropped 0, overlimits 0) qdisc sfq 80cb: limit 128p quantum 1514b flows 128/1024 Sent 10208 bytes 175 pkts (dropped 0, overlimits 0) qdisc sfq 80ca: limit 128p quantum 1514b flows 128/1024 Sent 361 bytes 5 pkts (dropped 0, overlimits 0) qdisc sfq 80c9: limit 128p quantum 1514b flows 128/1024 Sent 1257 bytes 18 pkts (dropped 0, overlimits 0) qdisc sfq 80c8: limit 128p quantum 1514b flows 128/1024 Sent 0 bytes 0 pkts (dropped 0, overlimits 0) qdisc sfq 80c7: limit 128p quantum 1514b flows 128/1024 Sent 33893 bytes 94 pkts (dropped 0, overlimits 0) qdisc sfq 80c6: limit 128p quantum 1514b flows 128/1024 Sent 588 bytes 7 pkts (dropped 0, overlimits 0) qdisc htb 1: r2q 10 default 99 direct_packets_stat 0 ver 3.10 Sent 1945416 bytes 3518 pkts (dropped 0, overlimits 1291)
htb qdisc 1: has overlimits. Ok. I want to know which class has overlimits
# tc -s -d class show dev eth0
class htb 1:99 parent 1:2 leaf 80cf: prio 6 quantum 1638 rate 128Kbit ceil 256Kbit burst 1762b/8 mpu 0b cburst 1926b/8 mpu 0b level 0
Sent 1890707 bytes 3161 pkts (dropped 0, overlimits 0)
rate 193bps 1pps
lended: 2215 borrowed: 946 giants: 0
tokens: 82550 ctokens: 45375
class htb 1:10 parent 1:2 leaf 80c6: prio 3 quantum 3276 rate 256Kbit ceil 10Mbit burst 1926b/8 mpu 0b cburst 14704b/8 mpu 0b level 0
Sent 588 bytes 7 pkts (dropped 0, overlimits 0)
lended: 7 borrowed: 0 giants: 0
tokens: 46575 ctokens: 9152
class htb 1:2 root rate 10Mbit ceil 10Mbit burst 14704b/8 mpu 0b cburst 14704b/8 mpu 0b level 7
Sent 1995212 bytes 3654 pkts (dropped 0, overlimits 0)
rate 232bps 1pps
lended: 970 borrowed: 0 giants: 0
tokens: 9122 ctokens: 9122
class htb 1:20 parent 1:2 leaf 80c7: prio 7 quantum 1000 rate 64Kbit ceil 128Kbit burst 1680b/8 mpu 0b cburst 1762b/8 mpu 0b level 0
Sent 71129 bytes 126 pkts (dropped 0, overlimits 0)
rate 5bps
lended: 102 borrowed: 24 giants: 0
tokens: -88558 ctokens: -61071
class htb 1:30 parent 1:2 leaf 80c8: prio 4 quantum 1638 rate 128Kbit ceil 256Kbit burst 1762b/8 mpu 0b cburst 1926b/8 mpu 0b level 0
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
lended: 0 borrowed: 0 giants: 0
tokens: 88149 ctokens: 48174
class htb 1:40 parent 1:2 leaf 80c9: prio 5 quantum 1000 rate 64Kbit ceil 128Kbit burst 1680b/8 mpu 0b cburst 1762b/8 mpu 0b level 0
Sent 1257 bytes 18 pkts (dropped 0, overlimits 0)
lended: 18 borrowed: 0 giants: 0
tokens: 135497 ctokens: 75947
class htb 1:51 parent 1:2 leaf 80cd: prio 2 quantum 1000 rate 64Kbit ceil 128Kbit burst 1680b/8 mpu 0b cburst 1762b/8 mpu 0b level 0
Sent 16396 bytes 88 pkts (dropped 0, overlimits 0)
rate 3bps
lended: 88 borrowed: 0 giants: 0
tokens: 160900 ctokens: 84550
class htb 1:41 parent 1:2 leaf 80ca: prio 5 quantum 1000 rate 64Kbit ceil 128Kbit burst 1680b/8 mpu 0b cburst 1762b/8 mpu 0b level 0
Sent 361 bytes 5 pkts (dropped 0, overlimits 0)
lended: 5 borrowed: 0 giants: 0
tokens: 163300 ctokens: 85750
class htb 1:50 parent 1:2 leaf 80cc: prio 1 quantum 1638 rate 128Kbit ceil 256Kbit burst 1762b/8 mpu 0b cburst 1926b/8 mpu 0b level 0
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
lended: 0 borrowed: 0 giants: 0
tokens: 88149 ctokens: 48174
class htb 1:42 parent 1:2 leaf 80cb: prio 5 quantum 1000 rate 64Kbit ceil 128Kbit burst 1680b/8 mpu 0b cburst 1762b/8 mpu 0b level 0
Sent 12590 bytes 219 pkts (dropped 0, overlimits 0)
rate 32bps
lended: 219 borrowed: 0 giants: 0
tokens: 163300 ctokens: 85750
class htb 1:60 parent 1:2 leaf 80ce: prio 1 quantum 3276 rate 256Kbit ceil 10Mbit burst 1926b/8 mpu 0b cburst 14704b/8 mpu 0b level 0
Sent 2184 bytes 30 pkts (dropped 0, overlimits 0)
rate 1bps
lended: 30 borrowed: 0 giants: 0
tokens: 41178 ctokens: 9020
Opps. All overlimits in classes is zero! That I wrote in my first message. It's strange for me. I want to know what protocol had overlimit.
# tc -V tc utility, iproute2-ss020116
> > Stef > -- Sergey Smirnov
/qos/bin/tc qdisc del dev eth0 root /qos/bin/tc qdisc add dev eth0 root handle 1: htb default 99 /qos/bin/tc class add dev eth0 parent 1: classid 1:2 htb rate 1280kbps ceil 1280kbps # http /qos/bin/tc class add dev eth0 parent 1:2 classid 1:10 htb rate 32kbps ceil 1280kbps prio 3 /qos/bin/tc qdisc add dev eth0 parent 1:10 sfq # smtp /qos/bin/tc class add dev eth0 parent 1:2 classid 1:20 htb rate 8kbps ceil 16kbps prio 7 /qos/bin/tc qdisc add dev eth0 parent 1:20 sfq # ftp /qos/bin/tc class add dev eth0 parent 1:2 classid 1:30 htb rate 16kbps ceil 32kbps prio 4 /qos/bin/tc qdisc add dev eth0 parent 1:30 sfq # imap /qos/bin/tc class add dev eth0 parent 1:2 classid 1:40 htb rate 8kbps ceil 16kbps prio 5 /qos/bin/tc qdisc add dev eth0 parent 1:40 sfq # imaps /qos/bin/tc class add dev eth0 parent 1:2 classid 1:41 htb rate 8kbps ceil 16kbps prio 5 /qos/bin/tc qdisc add dev eth0 parent 1:41 sfq # pop3 /qos/bin/tc class add dev eth0 parent 1:2 classid 1:42 htb rate 8kbps ceil 16kbps prio 5 /qos/bin/tc qdisc add dev eth0 parent 1:42 sfq # cherep /qos/bin/tc class add dev eth0 parent 1:2 classid 1:50 htb rate 16kbps ceil 32kbps prio 1 /qos/bin/tc qdisc add dev eth0 parent 1:50 sfq # gre /qos/bin/tc class add dev eth0 parent 1:2 classid 1:51 htb rate 8kbps ceil 16kbps prio 2 /qos/bin/tc qdisc add dev eth0 parent 1:51 sfq # ssh /qos/bin/tc class add dev eth0 parent 1:2 classid 1:60 htb rate 32kbps ceil 1280kbps prio 1 /qos/bin/tc qdisc add dev eth0 parent 1:60 sfq # default /qos/bin/tc class add dev eth0 parent 1:2 classid 1:99 htb rate 16kbps ceil 32kbps prio 6 /qos/bin/tc qdisc add dev eth0 parent 1:99 sfq # Filter name : smtp /qos/bin/tc filter add dev eth0 parent 1: protocol ip u32 match ip dport 25 0xffff classid 1:20 # Filter name : ssh /qos/bin/tc filter add dev eth0 parent 1: protocol ip u32 match ip dport 22 0xffff classid 1:60 # Filter name : cherep /qos/bin/tc filter add dev eth0 parent 1: protocol ip u32 match ip src 195.161.152.82 classid 1:50 # Filter name : imap /qos/bin/tc filter add dev eth0 parent 1: protocol ip u32 match ip dport 143 0xffff classid 1:40 # Filter name : http /qos/bin/tc filter add dev eth0 parent 1: protocol ip u32 match ip dport 80 0xffff classid 1:10 # Filter name : pop3 /qos/bin/tc filter add dev eth0 parent 1: protocol ip u32 match ip dport 110 0xffff classid 1:42 # Filter name : ftp /qos/bin/tc filter add dev eth0 parent 1: protocol ip u32 match ip dport 20 0xffff classid 1:30 # Filter name : imaps /qos/bin/tc filter add dev eth0 parent 1: protocol ip u32 match ip dport 993 0xffff classid 1:41 # Filter name : gre # type : fw /qos/bin/tc filter add dev eth0 parent 1: protocol ip handle 6 fw classid 1:51 /qos/bin/tc qdisc del dev eth1 root /qos/bin/tc qdisc add dev eth1 root handle 1: htb default 99 /qos/bin/tc class add dev eth1 parent 1: classid 1:2 htb rate 1280kbps ceil 1280kbps # http /qos/bin/tc class add dev eth1 parent 1:2 classid 1:10 htb rate 32kbps ceil 1280kbps prio 3 /qos/bin/tc qdisc add dev eth1 parent 1:10 sfq # smtp /qos/bin/tc class add dev eth1 parent 1:2 classid 1:20 htb rate 8kbps ceil 16kbps prio 7 /qos/bin/tc qdisc add dev eth1 parent 1:20 sfq # ftp /qos/bin/tc class add dev eth1 parent 1:2 classid 1:30 htb rate 16kbps ceil 32kbps prio 4 /qos/bin/tc qdisc add dev eth1 parent 1:30 sfq # imap /qos/bin/tc class add dev eth1 parent 1:2 classid 1:40 htb rate 8kbps ceil 16kbps prio 5 /qos/bin/tc qdisc add dev eth1 parent 1:40 sfq # imaps /qos/bin/tc class add dev eth1 parent 1:2 classid 1:41 htb rate 8kbps ceil 16kbps prio 5 /qos/bin/tc qdisc add dev eth1 parent 1:41 sfq # pop3 /qos/bin/tc class add dev eth1 parent 1:2 classid 1:42 htb rate 8kbps ceil 16kbps prio 5 /qos/bin/tc qdisc add dev eth1 parent 1:42 sfq # cherep /qos/bin/tc class add dev eth1 parent 1:2 classid 1:50 htb rate 16kbps ceil 32kbps prio 1 /qos/bin/tc qdisc add dev eth1 parent 1:50 sfq # ssh /qos/bin/tc class add dev eth1 parent 1:2 classid 1:60 htb rate 32kbps ceil 32kbps prio 1 /qos/bin/tc qdisc add dev eth1 parent 1:60 sfq # default /qos/bin/tc class add dev eth1 parent 1:2 classid 1:99 htb rate 8kbps ceil 32kbps prio 6 /qos/bin/tc qdisc add dev eth1 parent 1:99 sfq # gre /qos/bin/tc class add dev eth1 parent 1:2 classid 1:51 htb rate 8kbps ceil 16kbps prio 2 /qos/bin/tc qdisc add dev eth1 parent 1:51 sfq # Filter name : smtp /qos/bin/tc filter add dev eth1 parent 1: protocol ip u32 match ip dport 25 0xffff classid 1:20 # Filter name : ssh /qos/bin/tc filter add dev eth1 parent 1: protocol ip u32 match ip dport 22 0xffff classid 1:60 # Filter name : cherep /qos/bin/tc filter add dev eth1 parent 1: protocol ip u32 match ip dst 195.161.152.82 classid 1:50 # Filter name : imap /qos/bin/tc filter add dev eth1 parent 1: protocol ip u32 match ip dport 143 0xffff classid 1:40 # Filter name : http /qos/bin/tc filter add dev eth1 parent 1: protocol ip u32 match ip dport 80 0xffff classid 1:10 # Filter name : pop3 /qos/bin/tc filter add dev eth1 parent 1: protocol ip u32 match ip dport 110 0xffff classid 1:42 # Filter name : ftp /qos/bin/tc filter add dev eth1 parent 1: protocol ip u32 match ip dport 20 0xffff classid 1:30 # Filter name : gre # type : fw /qos/bin/tc filter add dev eth1 parent 1: protocol ip handle 6 fw classid 1:51 # Filter name : imaps /qos/bin/tc filter add dev eth1 parent 1: protocol ip u32 match ip dport 993 0xffff classid 1:41