Skip to contentSkip to conversation

priorizing vlans in a bridge

LARTC [email protected] 4 participants 6 messages Feb 10, 2005 – Feb 14, 2005

lore
Share & tools
lore
#0 lore raw

Hi, this is my Linux Box

              ----------------------------
   LAN 1 -----|--eth1 <---br1--->eth0.1  |
              |                     \    |
              |                    eth0--|----- 802.1q tagged 1 Mbps link
              |                     /    |
   LAN 2 -----|--eth2 <---br2--->eth0.2  |
              ----------------------------

I have to bridge the 2 lans in the left side of the diagram with my linux box running as a bridge. I have to tag the traffic of each lan so I created the 2 vlans interfaces on eth0 (tag 1 and tag 2).
All works fine. But now I have to priorize LAN1 traffic so it leaves the bridge before LAN2. Also I need to shape the traffic to the 1 Mbps link.

I read about the "prio" qdisc but it honours the TOS field of the IP packets, and I don't want to unless it was really necessary.
I read about the "prio" option of the htb qdisc and made some scripts, but they don't work as I expected.

HTB script:

tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 1000kbit

tc class add dev eth0 parent 1:1 classid 1:11 htb rate 500kbit ceil 1000kbit prio 1 tc filter add dev eth0 parent 1: prio 1 protocol ip handle 1 fw classid 1:11 iptables -t mangle -A PREROUTING -i eth1 -j MARK --set-mark 1

tc class add dev eth0 parent 1:1 classid 1:12 htb rate 500kbit ceil 800kbit prio 2 tc filter add dev eth0 parent 1: prio 1 protocol ip handle 2 fw classid 1:12 iptables -t mangle -A PREROUTING -i eth2 -j MARK --set-mark 2

What do you suggest me?
Thanks in advance.
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 30 lines · Le jeudi 10 février 2005 à 19:05 -0300, [email protected] a écrit :

Hi, this is my Linux Box

              ----------------------------
   LAN 1 -----|--eth1 <---br1--->eth0.1  |
              |                     \    |
              |                    eth0--|----- 802.1q tagged 1 Mbps link
              |                     /    |
   LAN 2 -----|--eth2 <---br2--->eth0.2  |
              ----------------------------

I have to bridge the 2 lans in the left side of the diagram with my linux box running as a bridge. I have to tag the traffic of each lan so I created the 2 vlans interfaces on eth0 (tag 1 and tag 2).
All works fine. But now I have to priorize LAN1 traffic so it leaves the bridge before LAN2. Also I need to shape the traffic to the 1 Mbps link.

I read about the "prio" qdisc but it honours the TOS field of the IP packets, and I don't want to unless it was really necessary.
I read about the "prio" option of the htb qdisc and made some scripts, but they don't work as I expected.

HTB script:

tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 1000kbit

tc class add dev eth0 parent 1:1 classid 1:11 htb rate 500kbit ceil 1000kbit prio 1 tc filter add dev eth0 parent 1: prio 1 protocol ip handle 1 fw classid 1:11 iptables -t mangle -A PREROUTING -i eth1 -j MARK --set-mark 1

Quoted 5 lines

tc class add dev eth0 parent 1:1 classid 1:12 htb rate 500kbit ceil 800kbit prio 2 tc filter add dev eth0 parent 1: prio 1 protocol ip handle 2 fw classid 1:12 iptables -t mangle -A PREROUTING -i eth2 -j MARK --set-mark 2

What do you suggest me?

May be you could try to add :
tc filter add dev eth0 parent 1:0 protocol all u32 match u32 0 0 at 0 flowid 1:1 or some similar filter to get the whole flow from 1:0 to 1:1

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

#2 lore raw
In reply to [email protected]

Hi,

You should use eth0.1 and eth0.2 in your tc statements ...

ciao

charles

Quoted 34 lines · On Thu, 2005-02-10 at 23:05, [email protected] wrote:

Hi, this is my Linux Box

              ----------------------------
   LAN 1 -----|--eth1 <---br1--->eth0.1  |
              |                     \    |
              |                    eth0--|----- 802.1q tagged 1 Mbps link
              |                     /    |
   LAN 2 -----|--eth2 <---br2--->eth0.2  |
              ----------------------------

I have to bridge the 2 lans in the left side of the diagram with my linux box running as a bridge. I have to tag the traffic of each lan so I created the 2 vlans interfaces on eth0 (tag 1 and tag 2).
All works fine. But now I have to priorize LAN1 traffic so it leaves the bridge before LAN2. Also I need to shape the traffic to the 1 Mbps link.

I read about the "prio" qdisc but it honours the TOS field of the IP packets, and I don't want to unless it was really necessary.
I read about the "prio" option of the htb qdisc and made some scripts, but they don't work as I expected.

HTB script:

tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 1000kbit

tc class add dev eth0 parent 1:1 classid 1:11 htb rate 500kbit ceil 1000kbit prio 1 tc filter add dev eth0 parent 1: prio 1 protocol ip handle 1 fw classid 1:11 iptables -t mangle -A PREROUTING -i eth1 -j MARK --set-mark 1

tc class add dev eth0 parent 1:1 classid 1:12 htb rate 500kbit ceil 800kbit prio 2 tc filter add dev eth0 parent 1: prio 1 protocol ip handle 2 fw classid 1:12 iptables -t mangle -A PREROUTING -i eth2 -j MARK --set-mark 2

Quoted 5 lines

What do you suggest me?
Thanks in advance.
_______________________________________________
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/

#3 lore raw
In reply to [email protected]

If I use the vlans interfaces eth0.1 and eth0.2 in the tc statements, I would have two independent root qdiscs on each interface, and this won´t let me prioritize LAN1 over LAN2. That's why I set this up all on eth0, which is the interface that sees all the entire traffic.
Any other idea?
Thanks for your answers

Mensaje citado por "[email protected]" <[email protected]>:

Quoted 60 lines

Hi,

You should use eth0.1 and eth0.2 in your tc statements ...

ciao

charles

Quoted 11 lines · On Thu, 2005-02-10 at 23:05, [email protected] wrote:

Hi, this is my Linux Box

              ----------------------------
   LAN 1 -----|--eth1 <---br1--->eth0.1  |
              |                     \    |
              |                    eth0--|----- 802.1q tagged 1 Mbps link
              |                     /    |
   LAN 2 -----|--eth2 <---br2--->eth0.2  |
              ----------------------------

I have to bridge the 2 lans in the left side of the diagram with my linux

box

Quoted 1 line

running as a bridge. I have to tag the traffic of each lan so I created the

2

Quoted 2 lines

vlans interfaces on eth0 (tag 1 and tag 2).
All works fine. But now I have to priorize LAN1 traffic so it leaves the

bridge

Quoted 3 lines

before LAN2. Also I need to shape the traffic to the 1 Mbps link.

I read about the "prio" qdisc but it honours the TOS field of the IP

packets,

Quoted 2 lines

and I don't want to unless it was really necessary.
I read about the "prio" option of the htb qdisc and made some scripts, but

they

Quoted 8 lines

don't work as I expected.

HTB script:

tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 1000kbit

tc class add dev eth0 parent 1:1 classid 1:11 htb rate 500kbit ceil

1000kbit prio 1

Quoted 1 line

tc filter add dev eth0 parent 1: prio 1 protocol ip handle 1 fw classid

1:11

Quoted 3 lines

iptables -t mangle -A PREROUTING -i eth1 -j MARK --set-mark 1

tc class add dev eth0 parent 1:1 classid 1:12 htb rate 500kbit ceil 800kbit

prio 2

Quoted 1 line

tc filter add dev eth0 parent 1: prio 1 protocol ip handle 2 fw classid

1:12

Quoted 7 lines

iptables -t mangle -A PREROUTING -i eth2 -j MARK --set-mark 2

What do you suggest me?
Thanks in advance.
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

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/

#4 lore raw
In reply to [email protected]
Quoted 16 lines · [email protected] wrote:

Hi, this is my Linux Box

              ----------------------------
   LAN 1 -----|--eth1 <---br1--->eth0.1  |
              |                     \    |
              |                    eth0--|----- 802.1q tagged 1 Mbps link
              |                     /    |
   LAN 2 -----|--eth2 <---br2--->eth0.2  |
              ----------------------------

I have to bridge the 2 lans in the left side of the diagram with my linux box running as a bridge. I have to tag the traffic of each lan so I created the 2 vlans interfaces on eth0 (tag 1 and tag 2).
All works fine. But now I have to priorize LAN1 traffic so it leaves the bridge before LAN2. Also I need to shape the traffic to the 1 Mbps link.

Quoted 4 lines

I read about the "prio" qdisc but it honours the TOS field of the IP packets, and I don't want to unless it was really necessary.
I read about the "prio" option of the htb qdisc and made some scripts, but they don't work as I expected.

Prio in htb setup like this only really affects the borrowing of excess
- rate is guaranteed. Also you need to back off a bit from your link speed to allow for overheads.

Quoted 7 lines

HTB script:

tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 1000kbit

tc class add dev eth0 parent 1:1 classid 1:11 htb rate 500kbit ceil 1000kbit prio 1

I would use something like rate 850kbit ceil 900kbit here

Quoted 4 lines

tc filter add dev eth0 parent 1: prio 1 protocol ip handle 1 fw classid 1:11 iptables -t mangle -A PREROUTING -i eth1 -j MARK --set-mark 1

tc class add dev eth0 parent 1:1 classid 1:12 htb rate 500kbit ceil 800kbit prio 2

and rate 50kbit ceil 900kbit here.

Andy.

Quoted 9 lines

tc filter add dev eth0 parent 1: prio 1 protocol ip handle 2 fw classid 1:12 iptables -t mangle -A PREROUTING -i eth2 -j MARK --set-mark 2

What do you suggest me?
Thanks in advance.
_______________________________________________
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/

#5 lore raw
In reply to [email protected]

Mensaje citado por Andy Furniss <[email protected]>:

Quoted 22 lines
Quoted 11 lines · [email protected] wrote:

Hi, this is my Linux Box

              ----------------------------
   LAN 1 -----|--eth1 <---br1--->eth0.1  |
              |                     \    |
              |                    eth0--|----- 802.1q tagged 1 Mbps link
              |                     /    |
   LAN 2 -----|--eth2 <---br2--->eth0.2  |
              ----------------------------

I have to bridge the 2 lans in the left side of the diagram with my linux

box

Quoted 1 line

running as a bridge. I have to tag the traffic of each lan so I created the

2

Quoted 2 lines

vlans interfaces on eth0 (tag 1 and tag 2).
All works fine. But now I have to priorize LAN1 traffic so it leaves the

bridge

Quoted 3 lines

before LAN2. Also I need to shape the traffic to the 1 Mbps link.

I read about the "prio" qdisc but it honours the TOS field of the IP

packets,

Quoted 9 lines
Quoted 2 lines

and I don't want to unless it was really necessary.
I read about the "prio" option of the htb qdisc and made some scripts, but

they

Quoted 1 line

don't work as I expected.

Prio in htb setup like this only really affects the borrowing of excess
- rate is guaranteed. Also you need to back off a bit from your link speed to allow for overheads.

Ok, with htb the priority is for borrowing of the free bandwidth. So what Qdisc could help me to make a customized priority qdisc ?, so I could define for example 4 or 8 bands not based on the TOS field like the prio qdisc. Thanks for your answers

Quoted 34 lines
Quoted 7 lines

HTB script:

tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 1000kbit

tc class add dev eth0 parent 1:1 classid 1:11 htb rate 500kbit ceil

1000kbit prio 1

I would use something like rate 850kbit ceil 900kbit here

Quoted 1 line

tc filter add dev eth0 parent 1: prio 1 protocol ip handle 1 fw classid

1:11

Quoted 3 lines

iptables -t mangle -A PREROUTING -i eth1 -j MARK --set-mark 1

tc class add dev eth0 parent 1:1 classid 1:12 htb rate 500kbit ceil 800kbit

prio 2

and rate 50kbit ceil 900kbit here.

Andy.

Quoted 1 line

tc filter add dev eth0 parent 1: prio 1 protocol ip handle 2 fw classid

1:12

Quoted 8 lines

iptables -t mangle -A PREROUTING -i eth2 -j MARK --set-mark 2

What do you suggest me?
Thanks in advance.
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

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/