<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-2">
<META content="MSHTML 6.00.2900.2722" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I'm running linux box with Slackware 9.1 and
compiled kernel 2.4.31 with "yes" to VLANs and "yes" to all QoS.</FONT></DIV>
<DIV><FONT face=Arial size=2>On this box i have more ethernet
interfaces:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>eth0</FONT></DIV>
<DIV><FONT face=Arial size=2>eth1</FONT></DIV>
<DIV><FONT face=Arial size=2>eth2</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>and so as more vlan interfaces:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>eth0.100</FONT></DIV>
<DIV><FONT face=Arial size=2>eth1.3</FONT></DIV>
<DIV><FONT face=Arial size=2>eth1.4</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>This is entrace(uplink) router to our whole network
and my goal is to shape users on this machine.</FONT></DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2>This script is olny for testing, if it all works
well, but I caught on some problems.</FONT></DIV>
<DIV><FONT face=Arial size=2>Here is my test script:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#!/bin/bash</FONT></DIV>
<DIV><FONT face=Arial size=2>#<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>/sbin/tc qdisc del dev eth0 root</FONT></DIV>
<DIV><FONT face=Arial size=2>/sbin/tc qdisc add dev eth0 root handle 1: htb r2q
1<BR>/sbin/tc qdisc del dev eth1 root<BR></FONT><FONT face=Arial size=2>/sbin/tc
qdisc add dev eth1 root handle 2: htb r2q 1<BR>/sbin/tc qdisc del dev eth2
root<BR>/sbin/tc qdisc add dev eth2 root handle 3: htb r2q 1<BR>/sbin/tc qdisc
del dev eth0.100 root<BR>/sbin/tc qdisc add dev eth0.100 root handle 100: htb
default 10 r2q 1<BR>/sbin/tc qdisc del dev eth1.3 root<BR>/sbin/tc qdisc add dev
eth1.3 root handle 13: htb r2q 1<BR>/sbin/tc qdisc del dev eth1.4
root<BR>/sbin/tc qdisc add dev eth1.4 root handle 14: htb default 20 r2q
1</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#classes for download<BR>/sbin/tc class add
dev eth0.100 parent 100: classid 100:1 htb rate 4000kbit quantum
6000</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>/sbin/tc class add dev eth0.100 parent 100:1
classid 100:2 htb rate 1000kbit quantum 6000<BR>/sbin/tc qdisc add dev eth0.100
parent 100:2 handle 1002 pfifo limit 10<BR>/sbin/tc class add dev eth0.100
parent 100:1 classid 100:3 htb rate 3000kbit quantum 6000<BR>/sbin/tc qdisc add
dev eth0.100 parent 100:3 handle 1003 pfifo limit 10</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#classes for upload<BR>/sbin/tc class add dev
eth1.4 parent 14: classid 14:4 htb rate 4000kbit quantum 6000</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>/sbin/tc class add dev eth1.4 parent 14:4 classid
14:5 htb rate 1000kbit quantum 6000<BR>/sbin/tc qdisc add dev eth1.4 parent 14:5
handle 145 pfifo limit 10<BR>/sbin/tc class add dev eth1.4 parent 14:4 classid
14:6 htb rate 3000kbit quantum 6000<BR>/sbin/tc qdisc add dev eth1.4 parent 14:6
handle 146 pfifo limit 10</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#my pc testing class</FONT></DIV>
<DIV><FONT face=Arial size=2>#down<BR>/sbin/tc class add dev eth0.100 parent
100:2 classid 100:2828 htb rate 1000kbit quantum 6000<BR>/sbin/tc filter add dev
eth0.100 parent 100: protocol ip prio 1 u32 match ip dst 217.67.28.28 classid
100:2828<BR>/sbin/tc qdisc add dev eth0.100 parent 100:2828 handle 1002828 sfq
perturb 10<BR>#up<BR>/sbin/tc class add dev eth1.4 parent 14:5 classid 14:2828
htb rate 1000kbit quantum 6000<BR>/sbin/tc filter add dev eth1.4 parent 14:
protocol ip prio 1 u32 match ip src 217.67.28.28 classid 14:2828<BR>/sbin/tc
qdisc add dev eth1.4 parent 14:2828 handle 142828 sfq perturb 10</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#default classes</FONT></DIV>
<DIV><FONT face=Arial size=2>#down<BR>/sbin/tc class add dev eth0.100 parent
100:1 classid 100:10 htb rate 3000kbit quantum 6000<BR>/sbin/tc qdisc add dev
eth0.100 parent 100:10 handle 10010 sfq perturb 10<BR>#up<BR>/sbin/tc class add
dev eth1.4 parent 14:4 classid 14:20 htb rate 3000kbit quantum 6000<BR>/sbin/tc
qdisc add dev eth1.4 parent 14:20 handle 1420 sfq perturb 10<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2>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.</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2>Here is dump from
statistics:</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2>### eth0: queueing
disciplines</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2>qdisc htb 1: r2q 1 default 0
direct_packets_stat 9500<BR> Sent 4585808 bytes 9500 pkts (dropped 0,
overlimits 0)</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV><FONT face=Arial><FONT size=2>
<DIV>### eth1: queueing disciplines</DIV>
<DIV> </DIV>
<DIV>qdisc htb 2: r2q 1 default 0 direct_packets_stat 9782<BR> Sent 7806825
bytes 9782 pkts (dropped 0, overlimits 0)<BR> backlog 3p</DIV>
<DIV> </DIV>
<DIV>### eth2: queueing disciplines</DIV>
<DIV> </DIV>
<DIV>qdisc htb 3: r2q 1 default 0 direct_packets_stat 1<BR> Sent 78 bytes 1
pkts (dropped 0, overlimits 0)</DIV>
<DIV> </DIV>
<DIV>### eth0.100: queueing disciplines</DIV>
<DIV> </DIV>
<DIV>qdisc htb 100: r2q 1 default 10 direct_packets_stat 122<BR> Sent
4685336 bytes 9630 pkts (dropped 360, overlimits 9606)<BR> backlog
69p</DIV>
<DIV> </DIV>
<DIV> qdisc pfifo 1003: parent 100:3 limit 10p<BR> Sent 0 bytes 0 pkts
(dropped 0, overlimits 0)</DIV>
<DIV> </DIV>
<DIV> qdisc sfq 2828: parent 100:2828 quantum 1514b perturb
10sec<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)</DIV>
<DIV> </DIV>
<DIV> qdisc sfq 10: parent 100:10 quantum 1514b perturb 10sec<BR> Sent
4631802 bytes 9501 pkts (dropped 360, overlimits 0)<BR> backlog 69p</DIV>
<DIV> </DIV>
<DIV>### eth0.100: traffic classes</DIV>
<DIV> </DIV>
<DIV>class htb 100:2828 parent 100:2 leaf 2828: prio 0 rate 1000Kbit ceil
1000Kbit burst 2879b cburst 2879b<BR> Sent 0 bytes 0 pkts (dropped 0,
overlimits 0)<BR> lended: 0 borrowed: 0 giants: 0<BR> tokens: 18432
ctokens: 18432<BR></DIV>
<DIV>class htb 100:1 root rate 4000Kbit ceil 4000Kbit burst 6719b cburst
6719b<BR> Sent 4570697 bytes 9445 pkts (dropped 0, overlimits
0)<BR> rate 9078bps 22pps<BR> lended: 0 borrowed: 0 giants:
0<BR> tokens: 423 ctokens: 423</DIV>
<DIV> </DIV>
<DIV>class htb 100:10 parent 100:1 leaf 10: prio 0 rate 3000Kbit ceil 3000Kbit
burst 5439b cburst 5439b<BR> Sent 4637832 bytes 9519 pkts (dropped 360,
overlimits 0)<BR> rate 9078bps 22pps backlog 74p<BR> lended: 9445
borrowed: 0 giants: 0<BR> tokens: -11928 ctokens: -11928</DIV>
<DIV> </DIV>
<DIV>class htb 100:2 parent 100:1 rate 1000Kbit ceil 1000Kbit burst 2879b cburst
2879b<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)<BR> lended: 0
borrowed: 0 giants: 0<BR> tokens: 18432 ctokens: 18432</DIV>
<DIV> </DIV>
<DIV>class htb 100:3 parent 100:1 leaf 1003: prio 0 rate 3000Kbit ceil 3000Kbit
burst 5439b cburst 5439b<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits
0)<BR> lended: 0 borrowed: 0 giants: 0<BR> tokens: 11604 ctokens:
11604</DIV>
<DIV> </DIV>
<DIV>### eth0.100: filtering rules</DIV>
<DIV> </DIV>
<DIV>filter parent 100: protocol ip pref 1 u32<BR>filter parent 100: protocol ip
pref 1 u32 fh 800: ht divisor 1<BR>filter parent 100: protocol ip pref 1 u32 fh
800::800 order 2048 key ht 800 bkt 0 flowid 100:2828<BR> match
d9431c1c/ffffffff at 16</DIV>
<DIV> </DIV>
<DIV>### eth1.3: queueing disciplines</DIV>
<DIV> </DIV>
<DIV>qdisc htb 13: r2q 1 default 0 direct_packets_stat 3<BR> Sent 218 bytes
3 pkts (dropped 0, overlimits 0)</DIV>
<DIV> </DIV>
<DIV>### eth1.4: queueing disciplines</DIV>
<DIV> </DIV>
<DIV>qdisc htb 14: r2q 1 default 20 direct_packets_stat 74<BR> Sent 4726451
bytes 5889 pkts (dropped 49, overlimits 6433)<BR> backlog 56p<BR></DIV>
<DIV> qdisc pfifo 146: parent 14:6 limit 10p<BR> Sent 0 bytes 0 pkts
(dropped 0, overlimits 0)</DIV>
<DIV> </DIV>
<DIV> qdisc sfq 2828: parent 14:2828 quantum 1518b perturb
10sec<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)</DIV>
<DIV> </DIV>
<DIV> qdisc sfq 1420: parent 14:20 quantum 1518b perturb
10sec<BR> Sent 4654955 bytes 5813 pkts (dropped 49, overlimits
0)<BR> backlog 56p</DIV>
<DIV> </DIV>
<DIV>### eth1.4: traffic classes</DIV>
<DIV> </DIV>
<DIV>class htb 14:2828 parent 14:5 leaf 2828: prio 0 rate 1000Kbit ceil 1000Kbit
burst 2879b cburst 2879b<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits
0)<BR> lended: 0 borrowed: 0 giants: 0<BR> tokens: 18432 ctokens:
18432</DIV>
<DIV> </DIV>
<DIV>class htb 14:20 parent 14:4 leaf 1420: prio 0 rate 3000Kbit ceil 3000Kbit
burst 5439b cburst 5439b<BR> Sent 4673585 bytes 5836 pkts (dropped 49,
overlimits 0)<BR> rate 22696bps 26pps backlog 67p<BR> lended: 5769
borrowed: 0 giants: 0<BR> tokens: -12404 ctokens: -12404</DIV>
<DIV> </DIV>
<DIV>class htb 14:4 root rate 4000Kbit ceil 4000Kbit burst 6719b cburst
6719b<BR> Sent 4623310 bytes 5769 pkts (dropped 0, overlimits
0)<BR> rate 46832bps 57pps<BR> lended: 0 borrowed: 0 giants:
0<BR> tokens: -928 ctokens: -928</DIV>
<DIV> </DIV>
<DIV>class htb 14:5 parent 14:4 rate 1000Kbit ceil 1000Kbit burst 2879b cburst
2879b<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits 0)<BR> lended: 0
borrowed: 0 giants: 0<BR> tokens: 18432 ctokens: 18432</DIV>
<DIV> </DIV>
<DIV>class htb 14:6 parent 14:4 leaf 146: prio 0 rate 3000Kbit ceil 3000Kbit
burst 5439b cburst 5439b<BR> Sent 0 bytes 0 pkts (dropped 0, overlimits
0)<BR> lended: 0 borrowed: 0 giants: 0<BR> tokens: 11604 ctokens:
11604</DIV>
<DIV> </DIV>
<DIV>### eth1.4: filtering rules<BR></DIV>
<DIV>filter parent 14: protocol ip pref 1 u32<BR>filter parent 14: protocol ip
pref 1 u32 fh 800: ht divisor 1<BR>filter parent 14: protocol ip pref 1 u32 fh
800::800 order 2048 key ht 800 bkt 0 flowid 14:2828<BR> match
d9431c1c/ffffffff at 12</DIV>
<DIV> </DIV>
<DIV>From this statistics you can see, that all traffic is served in default
class, but why?</DIV>
<DIV> </DIV>
<DIV>Anyone can help me or give som answers?</DIV>
<DIV> </DIV>
<DIV>In forward to you, thanks a lot! :)</DIV>
<DIV> </DIV>
<DIV>PS. lsmod:</DIV>
<DIV> </DIV>
<DIV>Module
Size Used by Not
tainted<BR>cls_route
4056 0
(unused)<BR>cls_u32
4668
2<BR>cls_fw
2392 0
(unused)<BR>sch_sfq
3392
4<BR>sch_htb
19648
6<BR>ipt_state
504 1
(autoclean)<BR>ip_conntrack
29960 0 (autoclean)
[ipt_state]<BR>iptable_filter
1644 1
(autoclean)<BR>ip_tables
14688 2 [ipt_state
iptable_filter]<BR>8021q
14056 3
(autoclean)<BR>ide-scsi
9296
0<BR>scsi_mod
73832 1
[ide-scsi]<BR>8139too
13960
2<BR>mii
2304 0
[8139too]<BR>tg3
57992
1<BR>agpgart
37496 0 (unused)<BR></DIV>
<DIV>ip ro sh:</DIV>
<DIV> </DIV>
<DIV>217.67.31.0/30 dev eth1.3 proto kernel scope link src
217.67.31.1<BR>217.67.31.4/30 via 217.67.28.250 dev eth1.4 proto
zebra metric 110 equalize<BR>217.67.16.108/30 dev eth0.100 proto
kernel scope link src 217.67.16.110<BR>217.67.28.252/30 via
217.67.28.58 dev eth1 proto zebra metric 110
equalize<BR>217.67.28.248/30 dev eth1.4 proto kernel scope
link src 217.67.28.249<BR>217.67.28.88/29 via 217.67.28.58 dev eth1
proto zebra metric 20 equalize<BR>217.67.28.80/29 dev eth2 proto
kernel scope link src 217.67.28.81<BR>217.67.28.72/29 via
217.67.28.250 dev eth1.4 proto zebra metric 20
equalize<BR>217.67.28.64/29 via 217.67.28.250 dev eth1.4 proto zebra
metric 20 equalize<BR>217.67.28.112/29 via 217.67.28.250 dev eth1.4 proto
zebra metric 210 equalize<BR>217.67.28.104/29 via 217.67.28.250 dev
eth1.4 proto zebra metric 110 equalize<BR>217.67.28.96/29 via
217.67.28.58 dev eth1 proto zebra metric 20
equalize<BR>217.67.28.24/29 via 217.67.28.250 dev eth1.4 proto zebra
metric 110 equalize<BR>217.67.28.16/29 via 217.67.28.250 dev eth1.4 proto
zebra metric 110 equalize<BR>217.67.28.8/29 via 217.67.28.250 dev
eth1.4 proto zebra metric 200 equalize<BR>217.67.28.0/29 via
217.67.28.58 dev eth1 proto zebra metric 20
equalize<BR>217.67.28.56/29 dev eth1 proto kernel scope link
src 217.67.28.57<BR>217.67.28.48/29 via 217.67.28.58 dev eth1 proto
zebra metric 20 equalize<BR>217.67.28.40/29 via 217.67.28.250 dev
eth1.4 proto zebra metric 210 equalize<BR>217.67.28.32/29 via
217.67.28.250 dev eth1.4 proto zebra metric 120
equalize<BR>10.101.5.0/24 via 217.67.28.58 dev eth1 proto zebra
metric 110 equalize<BR>10.101.4.0/24 via 217.67.28.250 dev eth1.4 proto
zebra metric 120 equalize<BR>10.101.7.0/24 via 217.67.28.250 dev
eth1.4 proto zebra metric 20 equalize<BR>10.101.6.0/24 via
217.67.28.250 dev eth1.4 proto zebra metric 210
equalize<BR>10.101.1.0/24 via 217.67.28.250 dev eth1.4 proto zebra
metric 110 equalize<BR>10.101.0.0/24 via 217.67.28.58 dev eth1 proto
zebra metric 20 equalize<BR>10.255.20.0/24 dev eth1 proto
kernel scope link src 10.255.20.1<BR>10.101.2.0/24 via 217.67.28.250
dev eth1.4 proto zebra metric 110 equalize<BR>10.255.10.0/24 dev
eth0.100 proto kernel scope link src
10.255.10.1<BR>10.101.8.0/24 via 217.67.28.250 dev eth1.4 proto
zebra metric 20 equalize<BR>192.168.172.0/24 dev eth0 proto
kernel scope link src 192.168.172.1<BR>127.0.0.0/8 dev lo
scope link<BR>default via 217.67.16.109 dev eth0.100<BR></DIV>
<DIV>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.</DIV>
<DIV> </DIV>
<DIV>I've also tried to set this flags to VLANs:</DIV>
<DIV> </DIV>
<DIV><!--StartFragment --> vconfig set_flag eth0.100 1 1 </DIV>
<DIV> vconfig set_flag eth1.3 1 1 </DIV>
<DIV> vconfig set_flag eth1.4 1 1 </DIV>
<DIV> </DIV>
<DIV>VLAN Dev name | VLAN ID<BR>Name-Type:
VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD<BR>eth0.100
| 100 | eth0<BR>eth1.3 |
3 | eth1<BR>eth1.4 |
4 | eth1<BR></DIV>
<DIV>eth0.100 VID: 100 REORDER_HDR:
1 dev->priv_flags:
1<BR> total frames
received:
38218094<BR> total bytes
received: 3919770540<BR>
Broadcast/Multicast
Rcvd: 0</DIV>
<DIV> </DIV>
<DIV> total frames
transmitted:
40429222<BR> total bytes
transmitted:
1882231869<BR>
total headroom
inc:
0<BR> total encap on
xmit:
0<BR>Device: eth0<BR>INGRESS priority mappings: 0:0 1:0 2:0
3:0 4:0 5:0 6:0 7:0<BR>EGRESSS priority Mappings:<BR></DIV>
<DIV>eth1.4 VID: 4 REORDER_HDR: 1 dev->priv_flags:
1<BR> total frames
received:
14211699<BR> total bytes
received: 223220948<BR>
Broadcast/Multicast Rcvd:
8471</DIV>
<DIV> </DIV>
<DIV> total frames
transmitted:
13202004<BR> total bytes
transmitted:
4187683963<BR>
total headroom
inc:
0<BR> total encap on
xmit: 13202004<BR>Device: eth1<BR>INGRESS priority
mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0
7:0<BR>EGRESSS priority Mappings:<BR></DIV>
<DIV>eof~</DIV>
<DIV> </DIV></FONT></FONT></BODY></HTML>