Re: HTB in a bridge+trunk

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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" <stef.coene@xxxxxxxxx>
To: "kristiadi himawan" <kristiadi_himawan@xxxxxxxxxx>; "lartc"
<lartc@xxxxxxxxxxxxxxx>
Sent: Tuesday, September 23, 2003 1:10 AM
Subject: Re:  HTB in a bridge+trunk


> On Monday 22 September 2003 13:37, kristiadi himawan wrote:
> > 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?
> See this faq entry (last line), maybe that's the solution :
> http://www.docum.org/stef.coene/qos/faq/cache/41.html
>
> Stef
>
> --
> stef.coene@xxxxxxxxx
>  "Using Linux as bandwidth manager"
>      http://www.docum.org/
>      #lartc @ irc.openprojects.net
>
> _______________________________________________
> LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
>

_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux