Skip to contentSkip to conversation

Shaping with htb and VLAN

LARTC [email protected] 2 participants 2 messages Nov 25, 2004 – Nov 29, 2004

lore
Share & tools
lore
#0 lore raw

Hello

At first I must tell you that I´m a real newbie with Linux (and english as well...)
I´m using 2 vlans and shaping works quite well without vlan
Now I want to do load balancing at these vlans.
Any vlan should get the same minimum/maximum bandwidth of download and use the bandwidth that isn´t used by the other one at the moment. But with vlan the shaping doesn´t work.
Can you please tell me the mistakes in my script you can see below?

#!/bin/sh

#mark
/sbin/iptables -t mangle -A PREROUTING -i ppp0 -j MARK --set-mark 9

#delete old qdisc
/sbin/tc qdisc del dev ppp0 root 2> /dev/null >/dev/null
/sbin/tc qdisc del dev ppp0 ingress 2> /dev/null >/dev/null
/sbin/tc qdisc del dev eth0 root 2> /dev/null >/dev/null
/sbin/tc qdisc del dev lo root 2> /dev/null >/dev/null

#create qdisc
/sbin/tc qdisc add dev eth0 root handle 1: htb default 0

#all pakets get here
/sbin/tc class add dev eth0 parent 1: classid 1:1 htb rate 200kbit burst 10kbit

#class for the clients
/sbin/tc class add dev eth0 parent 1:1 classid 1:10 htb rate 100kbit burst 10kbit ceil 100kbit prio 10 /sbin/tc class add dev eth0 parent 1:1 classid 1:20 htb rate 100kbit burst 10kbit ceil 100kbit prio 10

#balacing
/sbin/tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10 /sbin/tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 10

#filter
/sbin/tc filter add dev eth0 protocol 802.1q parent 1: prio 1 handle 9 fw flowid 1:1

/sbin/tc filter add dev eth0 protocol 802.1q parent 1:1 prio 1 u32 match ip dst 192.168.12.4 flowid 1:10 /sbin/tc filter add dev eth0 protocol 802.1q parent 1:1 prio 1 u32 match ip dst 192.168.13.4 flowid 1:10

echo "shaping on"

best regards

Wolfgang Schmid // Münster (Germany)

#1 lore raw
Quoted 15 lines · On Friday 26 November 2004 00:59, [email protected] wrote:

Hello

At first I must tell you that I´m a real newbie with Linux (and english as well...) I´m using 2 vlans and shaping works quite well without vlan Now I want to do load balancing at these vlans.
Any vlan should get the same minimum/maximum bandwidth of download and use the bandwidth that isn´t used by the other one at the moment. But with vlan the shaping doesn´t work.
Can you please tell me the mistakes in my script you can see below?

#!/bin/sh

#mark
/sbin/iptables -t mangle -A PREROUTING -i ppp0 -j MARK --set-mark 9

Quoted 8 lines

#delete old qdisc
/sbin/tc qdisc del dev ppp0 root 2> /dev/null >/dev/null
/sbin/tc qdisc del dev ppp0 ingress 2> /dev/null >/dev/null
/sbin/tc qdisc del dev eth0 root 2> /dev/null >/dev/null
/sbin/tc qdisc del dev lo root 2> /dev/null >/dev/null

#create qdisc
/sbin/tc qdisc add dev eth0 root handle 1: htb default 0

The 0 class is a special one, it will send all packets as fats as possible. I don't think you want this as the default class.

Quoted 9 lines

#all pakets get here
/sbin/tc class add dev eth0 parent 1: classid 1:1 htb rate 200kbit burst 10kbit

#class for the clients
/sbin/tc class add dev eth0 parent 1:1 classid 1:10 htb rate 100kbit burst 10kbit ceil 100kbit prio 10
/sbin/tc class add dev eth0 parent 1:1 classid 1:20 htb rate 100kbit burst 10kbit ceil 100kbit prio 10

If you want these classes to share bandwidth, you have to give them ceil 200kbit.

Quoted 4 lines

#balacing
/sbin/tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10 /sbin/tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 10

Quoted 8 lines

#filter
/sbin/tc filter add dev eth0 protocol 802.1q parent 1: prio 1 handle 9 fw flowid 1:1

/sbin/tc filter add dev eth0 protocol 802.1q parent 1:1 prio 1 u32 match ip dst 192.168.12.4 flowid 1:10
/sbin/tc filter add dev eth0 protocol 802.1q parent 1:1 prio 1 u32 match ip dst 192.168.13.4 flowid 1:10

Are you sure you want direct the 2 filters to the same class ?

Stef

Signature · 6 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/