tc, VLAN, ebtables issue
Hi all,
I am testing one QOS system, I want to control bandwidth by VLAN id. Here is my test network:
Internet Gateway
|
|
QOS control box ( Bridge box, Redhat 9, 2.4.28 kernel with
ebtables-brnf-8_vs_2.4.28 patch)
|
|
VLAN Switch
|
|
PC PCIn my QOS control box, it is a bridge box, I used Redhat 9, 2.4.28 kernel with ebtables-brnf-8_vs_2.4.28 patch, and used HTB to control BW. Both sides NICs of the QOS box are e1000 , and in normal state, not VLAN tagged.
I created a tagged VLAN for our PCs under the VLAN switch, our PCs can go through the QOS box and Gateway to reach Internet.
On the QOS box, I setup the following rules:
# create class ( use HTB class)
/usr/sbin/tc qdisc del dev eth0 root 2> /dev/null > /dev/null /usr/sbin/tc qdisc del dev eth1 root 2> /dev/null > /dev/null /usr/sbin/tc qdisc add dev eth0 root handle 1: htb default 9 /usr/sbin/tc class add dev eth0 parent 1: classid 1:1 htb rate 256kbps ceil 256kbps
/usr/sbin/tc class add dev eth0 parent 1:1 classid 1:9 htb rate 1kbps ceil 256kbps prio 7
## eth0 port class/usr/sbin/tc class add dev eth0 parent 1:1 classid 1:10 htb rate 1kbps ceil 256kbps prio 0/usr/sbin/tc qdisc add dev eth0 parent 1:10 handle 10: sfq /usr/sbin/tc class add dev eth0 parent 1:1 classid 1:11 htb rate 1kbps ceil 3kbps prio 2/usr/sbin/tc qdisc add dev eth0 parent 1:11 handle 11: sfq
/usr/sbin/tc qdisc add dev eth1 root handle 1: htb default 9 /usr/sbin/tc class add dev eth1 parent 1: classid 1:1 htb rate 256kbps ceil 256kbps
/usr/sbin/tc class add dev eth1 parent 1:1 classid 1:9 htb rate 1kbps ceil 256kbps prio 7
## eth1 port class/usr/sbin/tc class add dev eth1 parent 1:1 classid 1:10 htb rate 1kbps ceil 256kbps prio 0/usr/sbin/tc qdisc add dev eth1 parent 1:10 handle 10: sfq /usr/sbin/tc class add dev eth1 parent 1:1 classid 1:11 htb rate 1kbps ceil 2kbps prio 2/usr/sbin/tc qdisc add dev eth1 parent 1:11 handle 11: sfq
Then mark VLAN traffic:
ebtables -A FORWARD -p 802_1Q --vlan-id 103 -j mark --set-mark 2 --mark-target CONTINUE
Then classify VLAN traffic to the specify class /usr/sbin/tc filter add dev eth0 parent 1: protocol ip prio 2 handle 2 fw classid 1:11
But the result is: the VLAN id 103 traffic go to the default class 1:9, not go to the class 1:11 as we expected.
From the stat of ebtables, I can see there are bytes count in the VLAN id 103 mark chain, ebtables marked the VLAN id 103 traffic; but from the stat of class, I can see that no traffic go to the class 1:11 we expect. It as if Tc can not classify these marked tfaffic.
My idea is that controlling by VLAN id.
Any good idea, comments on my issue? Are my above rules right?
Thank in advance!
BR
Kingz
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 3 lines · kingz
Hi all,
I am testing one QOS system, I want to control bandwidth by VLAN id.
To filter a vlan and put the flow in a class, I use the following code in a C program:
...tc filter add dev %s parent %d:%d prio %d protocol all u32" \
" match u32 0x00008100 0x0000ffff at -8" \
" match u32 0x0%03x0000 0x0fff0000 at -4" \
" flowid %d:%d\n"...The u32 filter can have negative position indication, here at position -4 there is the vlan number, and at -8 there is the 0X8100 identifying the tag, (the zero position being the start of the ip frame).
This works only if you don't have the very modern ethernet cards that handle the tagged frames at their level.
If you have such a card, then you never see the tagged frame, only normal ip frames coming from the "virtual" vlan ethernet devices.
I don't think this is much help but good luck with your problem.
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/