Samuel Koscelansky / \"SUBNET\"
2005-Oct-06 17:57 UTC
HTB problem running on VLAN, not working
Hello. I''m running linux box with Slackware 9.1 and compiled kernel 2.4.31 with "yes" to VLANs and "yes" to all QoS. On this box i have more ethernet interfaces: eth0 eth1 eth2 and so as more vlan interfaces: eth0.100 eth1.3 eth1.4 This is entrace(uplink) router to our whole network and my goal is to shape users on this machine. I want for this purpose use HTB so I write little test script, which is shaping all users as default traffic and my computer as unique class. This script is olny for testing, if it all works well, but I caught on some problems. Here is my test script: #!/bin/bash # /sbin/tc qdisc del dev eth0 root /sbin/tc qdisc add dev eth0 root handle 1: htb r2q 1 /sbin/tc qdisc del dev eth1 root /sbin/tc qdisc add dev eth1 root handle 2: htb r2q 1 /sbin/tc qdisc del dev eth2 root /sbin/tc qdisc add dev eth2 root handle 3: htb r2q 1 /sbin/tc qdisc del dev eth0.100 root /sbin/tc qdisc add dev eth0.100 root handle 100: htb default 10 r2q 1 /sbin/tc qdisc del dev eth1.3 root /sbin/tc qdisc add dev eth1.3 root handle 13: htb r2q 1 /sbin/tc qdisc del dev eth1.4 root /sbin/tc qdisc add dev eth1.4 root handle 14: htb default 20 r2q 1 #classes for download /sbin/tc class add dev eth0.100 parent 100: classid 100:1 htb rate 4000kbit quantum 6000 /sbin/tc class add dev eth0.100 parent 100:1 classid 100:2 htb rate 1000kbit quantum 6000 /sbin/tc qdisc add dev eth0.100 parent 100:2 handle 1002 pfifo limit 10 /sbin/tc class add dev eth0.100 parent 100:1 classid 100:3 htb rate 3000kbit quantum 6000 /sbin/tc qdisc add dev eth0.100 parent 100:3 handle 1003 pfifo limit 10 #classes for upload /sbin/tc class add dev eth1.4 parent 14: classid 14:4 htb rate 4000kbit quantum 6000 /sbin/tc class add dev eth1.4 parent 14:4 classid 14:5 htb rate 1000kbit quantum 6000 /sbin/tc qdisc add dev eth1.4 parent 14:5 handle 145 pfifo limit 10 /sbin/tc class add dev eth1.4 parent 14:4 classid 14:6 htb rate 3000kbit quantum 6000 /sbin/tc qdisc add dev eth1.4 parent 14:6 handle 146 pfifo limit 10 #my pc testing class #down /sbin/tc class add dev eth0.100 parent 100:2 classid 100:2828 htb rate 1000kbit quantum 6000 /sbin/tc filter add dev eth0.100 parent 100: protocol ip prio 1 u32 match ip dst 217.67.28.28 classid 100:2828 /sbin/tc qdisc add dev eth0.100 parent 100:2828 handle 1002828 sfq perturb 10 #up /sbin/tc class add dev eth1.4 parent 14:5 classid 14:2828 htb rate 1000kbit quantum 6000 /sbin/tc filter add dev eth1.4 parent 14: protocol ip prio 1 u32 match ip src 217.67.28.28 classid 14:2828 /sbin/tc qdisc add dev eth1.4 parent 14:2828 handle 142828 sfq perturb 10 #default classes #down /sbin/tc class add dev eth0.100 parent 100:1 classid 100:10 htb rate 3000kbit quantum 6000 /sbin/tc qdisc add dev eth0.100 parent 100:10 handle 10010 sfq perturb 10 #up /sbin/tc class add dev eth1.4 parent 14:4 classid 14:20 htb rate 3000kbit quantum 6000 /sbin/tc qdisc add dev eth1.4 parent 14:20 handle 1420 sfq perturb 10 As you can see traffic goes throught eth0.100 (this is uplink interface to our ISP) and throught eth1.4 which belogns to interface to one part of our network and where my testing PC is situated. Other interfaces in this script are not used for now, this is due to simplify testing purposes. When I run this script I get no errors and everything seems to be fine, but is not. My PC is served as default traffic and not as uniqe class. When I''d removed default from root classes then all traffic, including my PC was served as root class traffic. Here is dump from statistics: ### eth0: queueing disciplines qdisc htb 1: r2q 1 default 0 direct_packets_stat 9500 Sent 4585808 bytes 9500 pkts (dropped 0, overlimits 0) ### eth1: queueing disciplines qdisc htb 2: r2q 1 default 0 direct_packets_stat 9782 Sent 7806825 bytes 9782 pkts (dropped 0, overlimits 0) backlog 3p ### eth2: queueing disciplines qdisc htb 3: r2q 1 default 0 direct_packets_stat 1 Sent 78 bytes 1 pkts (dropped 0, overlimits 0) ### eth0.100: queueing disciplines qdisc htb 100: r2q 1 default 10 direct_packets_stat 122 Sent 4685336 bytes 9630 pkts (dropped 360, overlimits 9606) backlog 69p qdisc pfifo 1003: parent 100:3 limit 10p Sent 0 bytes 0 pkts (dropped 0, overlimits 0) qdisc sfq 2828: parent 100:2828 quantum 1514b perturb 10sec Sent 0 bytes 0 pkts (dropped 0, overlimits 0) qdisc sfq 10: parent 100:10 quantum 1514b perturb 10sec Sent 4631802 bytes 9501 pkts (dropped 360, overlimits 0) backlog 69p ### eth0.100: traffic classes class htb 100:2828 parent 100:2 leaf 2828: prio 0 rate 1000Kbit ceil 1000Kbit burst 2879b cburst 2879b Sent 0 bytes 0 pkts (dropped 0, overlimits 0) lended: 0 borrowed: 0 giants: 0 tokens: 18432 ctokens: 18432 class htb 100:1 root rate 4000Kbit ceil 4000Kbit burst 6719b cburst 6719b Sent 4570697 bytes 9445 pkts (dropped 0, overlimits 0) rate 9078bps 22pps lended: 0 borrowed: 0 giants: 0 tokens: 423 ctokens: 423 class htb 100:10 parent 100:1 leaf 10: prio 0 rate 3000Kbit ceil 3000Kbit burst 5439b cburst 5439b Sent 4637832 bytes 9519 pkts (dropped 360, overlimits 0) rate 9078bps 22pps backlog 74p lended: 9445 borrowed: 0 giants: 0 tokens: -11928 ctokens: -11928 class htb 100:2 parent 100:1 rate 1000Kbit ceil 1000Kbit burst 2879b cburst 2879b Sent 0 bytes 0 pkts (dropped 0, overlimits 0) lended: 0 borrowed: 0 giants: 0 tokens: 18432 ctokens: 18432 class htb 100:3 parent 100:1 leaf 1003: prio 0 rate 3000Kbit ceil 3000Kbit burst 5439b cburst 5439b Sent 0 bytes 0 pkts (dropped 0, overlimits 0) lended: 0 borrowed: 0 giants: 0 tokens: 11604 ctokens: 11604 ### eth0.100: filtering rules filter parent 100: protocol ip pref 1 u32 filter parent 100: protocol ip pref 1 u32 fh 800: ht divisor 1 filter parent 100: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 100:2828 match d9431c1c/ffffffff at 16 ### eth1.3: queueing disciplines qdisc htb 13: r2q 1 default 0 direct_packets_stat 3 Sent 218 bytes 3 pkts (dropped 0, overlimits 0) ### eth1.4: queueing disciplines qdisc htb 14: r2q 1 default 20 direct_packets_stat 74 Sent 4726451 bytes 5889 pkts (dropped 49, overlimits 6433) backlog 56p qdisc pfifo 146: parent 14:6 limit 10p Sent 0 bytes 0 pkts (dropped 0, overlimits 0) qdisc sfq 2828: parent 14:2828 quantum 1518b perturb 10sec Sent 0 bytes 0 pkts (dropped 0, overlimits 0) qdisc sfq 1420: parent 14:20 quantum 1518b perturb 10sec Sent 4654955 bytes 5813 pkts (dropped 49, overlimits 0) backlog 56p ### eth1.4: traffic classes class htb 14:2828 parent 14:5 leaf 2828: prio 0 rate 1000Kbit ceil 1000Kbit burst 2879b cburst 2879b Sent 0 bytes 0 pkts (dropped 0, overlimits 0) lended: 0 borrowed: 0 giants: 0 tokens: 18432 ctokens: 18432 class htb 14:20 parent 14:4 leaf 1420: prio 0 rate 3000Kbit ceil 3000Kbit burst 5439b cburst 5439b Sent 4673585 bytes 5836 pkts (dropped 49, overlimits 0) rate 22696bps 26pps backlog 67p lended: 5769 borrowed: 0 giants: 0 tokens: -12404 ctokens: -12404 class htb 14:4 root rate 4000Kbit ceil 4000Kbit burst 6719b cburst 6719b Sent 4623310 bytes 5769 pkts (dropped 0, overlimits 0) rate 46832bps 57pps lended: 0 borrowed: 0 giants: 0 tokens: -928 ctokens: -928 class htb 14:5 parent 14:4 rate 1000Kbit ceil 1000Kbit burst 2879b cburst 2879b Sent 0 bytes 0 pkts (dropped 0, overlimits 0) lended: 0 borrowed: 0 giants: 0 tokens: 18432 ctokens: 18432 class htb 14:6 parent 14:4 leaf 146: prio 0 rate 3000Kbit ceil 3000Kbit burst 5439b cburst 5439b Sent 0 bytes 0 pkts (dropped 0, overlimits 0) lended: 0 borrowed: 0 giants: 0 tokens: 11604 ctokens: 11604 ### eth1.4: filtering rules filter parent 14: protocol ip pref 1 u32 filter parent 14: protocol ip pref 1 u32 fh 800: ht divisor 1 filter parent 14: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 14:2828 match d9431c1c/ffffffff at 12>From this statistics you can see, that all traffic is served in default class, but why?Anyone can help me or give som answers? In forward to you, thanks a lot! :) PS. lsmod: Module Size Used by Not tainted cls_route 4056 0 (unused) cls_u32 4668 2 cls_fw 2392 0 (unused) sch_sfq 3392 4 sch_htb 19648 6 ipt_state 504 1 (autoclean) ip_conntrack 29960 0 (autoclean) [ipt_state] iptable_filter 1644 1 (autoclean) ip_tables 14688 2 [ipt_state iptable_filter] 8021q 14056 3 (autoclean) ide-scsi 9296 0 scsi_mod 73832 1 [ide-scsi] 8139too 13960 2 mii 2304 0 [8139too] tg3 57992 1 agpgart 37496 0 (unused) ip ro sh: 217.67.31.0/30 dev eth1.3 proto kernel scope link src 217.67.31.1 217.67.31.4/30 via 217.67.28.250 dev eth1.4 proto zebra metric 110 equalize 217.67.16.108/30 dev eth0.100 proto kernel scope link src 217.67.16.110 217.67.28.252/30 via 217.67.28.58 dev eth1 proto zebra metric 110 equalize 217.67.28.248/30 dev eth1.4 proto kernel scope link src 217.67.28.249 217.67.28.88/29 via 217.67.28.58 dev eth1 proto zebra metric 20 equalize 217.67.28.80/29 dev eth2 proto kernel scope link src 217.67.28.81 217.67.28.72/29 via 217.67.28.250 dev eth1.4 proto zebra metric 20 equalize 217.67.28.64/29 via 217.67.28.250 dev eth1.4 proto zebra metric 20 equalize 217.67.28.112/29 via 217.67.28.250 dev eth1.4 proto zebra metric 210 equalize 217.67.28.104/29 via 217.67.28.250 dev eth1.4 proto zebra metric 110 equalize 217.67.28.96/29 via 217.67.28.58 dev eth1 proto zebra metric 20 equalize 217.67.28.24/29 via 217.67.28.250 dev eth1.4 proto zebra metric 110 equalize 217.67.28.16/29 via 217.67.28.250 dev eth1.4 proto zebra metric 110 equalize 217.67.28.8/29 via 217.67.28.250 dev eth1.4 proto zebra metric 200 equalize 217.67.28.0/29 via 217.67.28.58 dev eth1 proto zebra metric 20 equalize 217.67.28.56/29 dev eth1 proto kernel scope link src 217.67.28.57 217.67.28.48/29 via 217.67.28.58 dev eth1 proto zebra metric 20 equalize 217.67.28.40/29 via 217.67.28.250 dev eth1.4 proto zebra metric 210 equalize 217.67.28.32/29 via 217.67.28.250 dev eth1.4 proto zebra metric 120 equalize 10.101.5.0/24 via 217.67.28.58 dev eth1 proto zebra metric 110 equalize 10.101.4.0/24 via 217.67.28.250 dev eth1.4 proto zebra metric 120 equalize 10.101.7.0/24 via 217.67.28.250 dev eth1.4 proto zebra metric 20 equalize 10.101.6.0/24 via 217.67.28.250 dev eth1.4 proto zebra metric 210 equalize 10.101.1.0/24 via 217.67.28.250 dev eth1.4 proto zebra metric 110 equalize 10.101.0.0/24 via 217.67.28.58 dev eth1 proto zebra metric 20 equalize 10.255.20.0/24 dev eth1 proto kernel scope link src 10.255.20.1 10.101.2.0/24 via 217.67.28.250 dev eth1.4 proto zebra metric 110 equalize 10.255.10.0/24 dev eth0.100 proto kernel scope link src 10.255.10.1 10.101.8.0/24 via 217.67.28.250 dev eth1.4 proto zebra metric 20 equalize 192.168.172.0/24 dev eth0 proto kernel scope link src 192.168.172.1 127.0.0.0/8 dev lo scope link default via 217.67.16.109 dev eth0.100 Network segment 217.67.28.24/29 where is also situated my test PC is not directly attached to this router and im using ospf as routing protocol. I''ve also tried to set this flags to VLANs: vconfig set_flag eth0.100 1 1 vconfig set_flag eth1.3 1 1 vconfig set_flag eth1.4 1 1 VLAN Dev name | VLAN ID Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD eth0.100 | 100 | eth0 eth1.3 | 3 | eth1 eth1.4 | 4 | eth1 eth0.100 VID: 100 REORDER_HDR: 1 dev->priv_flags: 1 total frames received: 38218094 total bytes received: 3919770540 Broadcast/Multicast Rcvd: 0 total frames transmitted: 40429222 total bytes transmitted: 1882231869 total headroom inc: 0 total encap on xmit: 0 Device: eth0 INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESSS priority Mappings: eth1.4 VID: 4 REORDER_HDR: 1 dev->priv_flags: 1 total frames received: 14211699 total bytes received: 223220948 Broadcast/Multicast Rcvd: 8471 total frames transmitted: 13202004 total bytes transmitted: 4187683963 total headroom inc: 0 total encap on xmit: 13202004 Device: eth1 INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESSS priority Mappings: eof~ _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
Samuel Koscelansky / "SUBNET" wrote: I tested shaping on vlan and it seems OK for me (even though my switch doesn''t do vlan it doesn''t seem to block oversize frames). I noticed a few things with your setup -> #classes for download > /sbin/tc class add dev eth0.100 parent 100: classid 100:1 htb rate 4000kbit quantum 6000 > > /sbin/tc class add dev eth0.100 parent 100:1 classid 100:2 htb rate 1000kbit quantum 6000 > /sbin/tc qdisc add dev eth0.100 parent 100:2 handle 1002 pfifo limit 10You attach pfifo as if 100:2 is a leaf class here> > #my pc testing class > #down > /sbin/tc class add dev eth0.100 parent 100:2 classid 100:2828 htb rate 1000kbit quantum 6000 > /sbin/tc filter add dev eth0.100 parent 100: protocol ip prio 1 u32 match ip dst 217.67.28.28 classid 100:2828 > /sbin/tc qdisc add dev eth0.100 parent 100:2828 handle 1002828 sfq perturb 10But have it as a parent here, also I think the handle on sfq is too big and if eth0.100 is to your ISP then dst should be changed src in the match. Andy.