Skip to contentSkip to conversation

HTB in a bridge+trunk

LARTC kristiadi himawan 3 participants 4 messages Sep 22, 2003 – Sep 24, 2003

lore
Share & tools
lore
#0 lore raw

Dear All,

Sorry if my question here ever asked before by someone else. I have configuration like this :

                     |---------trunking------|
                    V  eth0         eth1  V
         router<--->bridge with htb<--->switch

202.xx.xx.227

#!/bin/bash
tc qdisc del dev eth0 root handle 1:
tc qdisc add dev eth0 root handle 1: htb default 10
tc class add dev eth0 parent 1: classid 1:1 htb rate 32kbit ceil 32kbit
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 24kbit ceil 24kbit
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 8kbit ceil 8kbit
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip dst 202.xx.xx.227 flowid 1:20

I already patch kernel and tc with htb3.6-020525.tgz from htb website.

Here is the result when there's traffic to 202.xx.xx.227, it should go to 1:20, but fill class 1:10 (red sign).

### eth0: queueing disciplines
qdisc htb 1: r2q 10 default 10 direct_packets_stat 0
Sent 584256 bytes 881 pkts (dropped 0, overlimits 1113) backlog 35p

### eth0: traffic classes
class htb 1:1 root rate 32Kbit ceil 32Kbit burst 1639b cburst 14704b
Sent 554186 bytes 846 pkts (dropped 0, overlimits 0)
rate 3040bps 3pps
lended: 0 borrowed: 0 giants: 0
tokens: -7997 ctokens: 8145
class htb 1:10 parent 1:1 prio 0 rate 24Kbit ceil 24Kbit burst 1629b cburst 1629b
Sent 584256 bytes 881 pkts (dropped 0, overlimits 0)
rate 3040bps 3pps backlog 35p
lended: 846 borrowed: 0 giants: 0
tokens: -447876 ctokens: -447876
class htb 1:20 parent 1:1 prio 0 rate 8Kbit ceil 8Kbit burst 1609b cburst 1609b
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
lended: 0 borrowed: 0 giants: 0
tokens: 1287999 ctokens: 1287999

### eth0: filtering rules
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:20
match ca2ba0e3/ffffffff at 16

Why when i put htb on eth0 to filter class 1:20 the shaping always goes to default class 1:10 not 1:20 class, the same problem occur when i put htb on eth1? I already patch the kernel with 3c95x vlan patch too.
Any idea why the filter not working properly or i need another patch to get u32 working in bridging+trunking or i must replace u32 filter with fwmark from ebtables?

Thnx.

#1 lore raw
Quoted 53 lines · kristiadi himawan

Dear All,

Sorry if my question here ever asked before by someone else.

I have configuration like this :

                     |---------trunking------|

                    V  eth0         eth1  V
         router<--->bridge with htb<--->switch

202.xx.xx.227

#!/bin/bash
tc qdisc del dev eth0 root handle 1:
tc qdisc add dev eth0 root handle 1: htb default 10
tc class add dev eth0 parent 1: classid 1:1 htb rate 32kbit ceil 32kbit tc class add dev eth0 parent 1:1 classid 1:10 htb rate 24kbit ceil 24kbit tc class add dev eth0 parent 1:1 classid 1:20 htb rate 8kbit ceil 8kbit tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip dst 202.xx.xx.227 flowid 1:20

I already patch kernel and tc with htb3.6-020525.tgz from htb website.

Here is the result when there's traffic to 202.xx.xx.227, it should go to 1:20, but fill class 1:10 (red sign).

### eth0: queueing disciplines
qdisc htb 1: r2q 10 default 10 direct_packets_stat 0
Sent 584256 bytes 881 pkts (dropped 0, overlimits 1113) backlog 35p

### eth0: traffic classes
class htb 1:1 root rate 32Kbit ceil 32Kbit burst 1639b cburst 14704b
Sent 554186 bytes 846 pkts (dropped 0, overlimits 0)
rate 3040bps 3pps
lended: 0 borrowed: 0 giants: 0
tokens: -7997 ctokens: 8145
class htb 1:10 parent 1:1 prio 0 rate 24Kbit ceil 24Kbit burst 1629b cburst 1629b Sent 584256 bytes 881 pkts (dropped 0, overlimits 0)
rate 3040bps 3pps backlog 35p
lended: 846 borrowed: 0 giants: 0
tokens: -447876 ctokens: -447876
class htb 1:20 parent 1:1 prio 0 rate 8Kbit ceil 8Kbit burst 1609b cburst 1609b Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
lended: 0 borrowed: 0 giants: 0
tokens: 1287999 ctokens: 1287999

### eth0: filtering rules
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:20 match ca2ba0e3/ffffffff at 16

Quoted 6 lines

Why when i put htb on eth0 to filter class 1:20 the shaping always goes to default class 1:10 not 1:20 class, the same problem occur when i put htb on eth1? I already patch the kernel with 3c95x vlan patch too.
Any idea why the filter not working properly or i need another patch to get u32 working in bridging+trunking or i must replace u32 filter with fwmark from ebtables?

See this faq entry (last line), maybe that's the solution :
http://www.docum.org/stef.coene/qos/faq/cache/41.html

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.openprojects.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#2 lore raw
In reply to kristiadi himawan
Quoted 6 lines · kristiadi himawan

Dear All,
Sorry if my question here ever asked before by someone else. I have configuration like this :

                     |---------trunking------|
                    V  eth0         eth1  V
         router<--->bridge with htb<--->switch
Quoted 6 lines

202.xx.xx.227
#!/bin/bash
tc qdisc del dev eth0 root handle 1:
tc qdisc add dev eth0 root handle 1: htb default 10
tc class add dev eth0 parent 1: classid 1:1 htb rate 32kbit ceil 32kbit tc class add dev eth0 parent 1:1 classid 1:10 htb rate 24kbit ceil 24kbit

Watch out the default parameter, from your script it goes to classid 1:10 My suggestion, perhaps this is not right according to masters in this list (:
set the default to 0 (zero) until all settings correct and your bandwidth manager operates successfully then define the default to class you have set for unclassified traffic.
CMIW

Salam dari Bandung,
Rio Martin.
--
NOC Itenas-net.

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#3 lore raw
In reply to kristiadi himawan

Hi Steff,

This is my new configuration + frame diverter patch&utils :

divert on eth0 enable ip add
tc qdisc add dev eth0 root handle 1: htb default 10
tc class add dev eth0 parent 1: classid 1:1 htb rate 32kbit ceil 32kbit tc class add dev eth0 parent 1:1 classid 1:10 htb rate 24kbit ceil 24kbit tc class add dev eth0 parent 1:1 classid 1:20 htb rate 8kbit ceil 8kbit iptables -A OUTPUT -o eth0 -d 202.43.160.227 -t mangle -j MARK --set-mark 1 tc filter add dev eth0 parent 1: protocol ip prio 1 handle 1 fw classid 1:20

And this is the stats of the htb :

### eth0: queueing disciplines

qdisc htb 1: r2q 10 default 10 direct_packets_stat 0
Sent 171787 bytes 162 pkts (dropped 0, overlimits 285) backlog 34p

### eth0: traffic classes

class htb 1:1 root rate 32Kbit ceil 32Kbit burst 1639b cburst 1639b
Sent 135949 bytes 128 pkts (dropped 0, overlimits 0) rate 2092bps 1pps
lended: 0 borrowed: 0 giants: 0
tokens: -276799 ctokens: -276799

class htb 1:10 parent 1:1 prio 0 rate 24Kbit ceil 24Kbit burst 1629b cburst 1629b
Sent 171787 bytes 162 pkts (dropped 0, overlimits 0)
rate 2092bps 1pps backlog 34p
lended: 128 borrowed: 0 giants: 0
tokens: -798987 ctokens: -798987

class htb 1:20 parent 1:1 prio 0 rate 8Kbit ceil 8Kbit burst 1609b cburst 1609b
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
lended: 0 borrowed: 0 giants: 0
tokens: 1287999 ctokens: 1287999

### eth0: filtering rules

filter parent 1: protocol ip pref 1 fw
filter parent 1: protocol ip pref 1 fw handle 0x1 classid 1:20

Iptables list :
Chain PREROUTING (policy ACCEPT 6908076 packets, 10181380173 bytes)
pkts bytes target prot opt in out source
destination

Chain INPUT (policy ACCEPT 6907998 packets, 10181371532 bytes)
pkts bytes target prot opt in out source
destination

Chain FORWARD (policy ACCEPT 32 packets, 2959 bytes)
pkts bytes target prot opt in out source
destination

Chain OUTPUT (policy ACCEPT 93395 packets, 17383989 bytes)
pkts bytes target prot opt in out source
destination

       0        0 MARK       all  --  *      eth0    0.0.0.0/0

202.43.160.227 MARK set 0x1

Chain POSTROUTING (policy ACCEPT 93427 packets, 17386948 bytes)
pkts bytes target prot opt in out source
destination

Frame diverter status :

version: 0.46
status:  active
ip:      yes
icmp:    no
tcp:     no
udp:     no

It's still go to default class 1:10.
And here's tcpdump result on bridge :
15:24:14.243196 0:4:79:66:3e:6b 0:6:2a:74:3c:8 8100 70: 802.1Q vlan#106 P0 202.43.160.227.39500 > 202.43.160.6.33556: . ack 5793 win 63712 <nop,nop,timestamp 68757962 9371439> (DF)
15:24:14.243239 0:4:79:66:3e:6b 0:6:2a:74:3c:8 8100 102: 802.1Q vlan#106 P0 202.43.160.227 > 202.43.160.6: icmp: echo reply

I think because the link at the bridge was trunked so the traffic encapsulated with .1Q vlan format, and if i use iptraf to see the traffic, it will classify as non-ip and there's no ip addresses shown at iptraf although there's ftp traffic.
And here's normal traffic without trunked line:

16:01:20.082961 0:a:e6:f7:68:5f 0:1:3:de:8:16 ip 60: 202.43.160.4.1168 > 202.43.160.2.ssh: . ack 65168 win 63688 (DF)
16:01:20.083008 0:1:3:de:8:16 0:a:e6:f7:68:5f ip 338: 202.43.160.2.ssh > 202.43.160.4.1168: P 65168:65452(284) ack 1 win 7504 (DF) [tos 0x10]

So i think traffic in the bridge should treat like in the switch, decapsulated first from .1Q and then processed at htb after that encapsulated again with .1Q vlan format.

Any idea how to make this in linux? or there's any suggestion with this condition?
----- Original Message -----
From: "Stef Coene" <[email protected]>
To: "kristiadi himawan" <[email protected]>; "lartc" <[email protected]>
Sent: Tuesday, September 23, 2003 1:10 AM
Subject: Re: [LARTC] HTB in a bridge+trunk

Quoted 12 lines · kristiadi himawan
Quoted 11 lines

Dear All,

Sorry if my question here ever asked before by someone else.

I have configuration like this :

                     |---------trunking------|

                    V  eth0         eth1  V
         router<--->bridge with htb<--->switch

202.xx.xx.227

Quoted 5 lines
Quoted 5 lines

#!/bin/bash
tc qdisc del dev eth0 root handle 1:
tc qdisc add dev eth0 root handle 1: htb default 10
tc class add dev eth0 parent 1: classid 1:1 htb rate 32kbit ceil 32kbit tc class add dev eth0 parent 1:1 classid 1:10 htb rate 24kbit ceil

24kbit

Quoted 7 lines
Quoted 7 lines

tc class add dev eth0 parent 1:1 classid 1:20 htb rate 8kbit ceil 8kbit tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip dst 202.xx.xx.227 flowid 1:20

I already patch kernel and tc with htb3.6-020525.tgz from htb website.

Here is the result when there's traffic to 202.xx.xx.227, it should go

to

Quoted 7 lines
Quoted 7 lines

1:20, but fill class 1:10 (red sign).

### eth0: queueing disciplines
qdisc htb 1: r2q 10 default 10 direct_packets_stat 0
Sent 584256 bytes 881 pkts (dropped 0, overlimits 1113) backlog 35p

Quoted 7 lines
Quoted 7 lines

### eth0: traffic classes
class htb 1:1 root rate 32Kbit ceil 32Kbit burst 1639b cburst 14704b
Sent 554186 bytes 846 pkts (dropped 0, overlimits 0) rate 3040bps 3pps
lended: 0 borrowed: 0 giants: 0
tokens: -7997 ctokens: 8145
class htb 1:10 parent 1:1 prio 0 rate 24Kbit ceil 24Kbit burst 1629b

cburst

Quoted 5 lines
Quoted 5 lines

1629b Sent 584256 bytes 881 pkts (dropped 0, overlimits 0)
rate 3040bps 3pps backlog 35p
lended: 846 borrowed: 0 giants: 0
tokens: -447876 ctokens: -447876
class htb 1:20 parent 1:1 prio 0 rate 8Kbit ceil 8Kbit burst 1609b

cburst

Quoted 8 lines
Quoted 8 lines

1609b Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
lended: 0 borrowed: 0 giants: 0
tokens: 1287999 ctokens: 1287999

### eth0: filtering rules
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

Quoted 4 lines
Quoted 4 lines

bkt 0 flowid 1:20 match ca2ba0e3/ffffffff at 16

Why when i put htb on eth0 to filter class 1:20 the shaping always goes

to

Quoted 1 line
Quoted 1 line

default class 1:10 not 1:20 class, the same problem occur when i put htb

on

Quoted 2 lines
Quoted 2 lines

eth1? I already patch the kernel with 3c95x vlan patch too. Any idea why the filter not working properly or i need another patch to

get

Quoted 1 line
Quoted 1 line

u32 working in bridging+trunking or i must replace u32 filter with

fwmark

Quoted 12 lines
Quoted 1 line

from ebtables?

See this faq entry (last line), maybe that's the solution :
http://www.docum.org/stef.coene/qos/faq/cache/41.html

Stef

--
[email protected]
"Using Linux as bandwidth manager"
http://www.docum.org/
#lartc @ irc.openprojects.net

Quoted 4 lines

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/