Skip to contentSkip to conversation

Newb question: tc shedulers on 2 interfaces

LARTC Patrich Björklund 2 participants 2 messages Dec 28, 2004

lore
Share & tools
lore
#0 lore raw

Hi all! I'm new to this list, and hope for some clarity in this matter:

I have a home-gateway with linux-2.6.9 and iproute2 (ver:2.6.9). My following tc syntaxes.

# eth0 internet scheduleing are:

tc qdisc add dev eth0 root handle 1: htb default 20

tc class add dev eth0 parent 1: classid 1:1 htb rate 512kbit burst 6k tc class add dev eth0 parent 1:1 classid 1:10 htb rate 512kbit burst 6k prio 1
tc class add dev eth0 parent 1:1 classid 1:20 htb reate 9*512/10kbit burst 6k prio 2

tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10 tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 10

tc filter add dev eth0 parent 1:0 protocol ip prio 10 u32 match ip tos 0x10 0xff flowid 1:10
tc filter add dev eth0 parent 1: protocol ip prio 10 u32 \
match ip protocol 6 0xff \
match u8 0x50 0x0f at 0 \
match u16 0x0000 0xffc0 at 2 \
match u8 0x10 0xff at 33 \
flowid 1:10

tc qdisc add dev dev eth0 handle ffff: ingress

tc filter add dev eth0 parent ffff: protocol ip prio 50 u32 \
match ip src 0.0.0.0/0 police rate 2200kbit burst 10k drop flowid :1

# My eth1 schedule:
tc qdisc add dev eth1 root tbf rate 512kbit latency 50ms burst 10000

The long eth0 tc-script is fetched externally as you may see...but:

This have worked well for me (no, really) but...since I am a newbee, I have read the lartc doc, and understood some but very much was really hard to get...especially the class and filter stuff. Lets say it's not a 'for dummies' book :) No complainig. My Q are, is there a chance I will get packet losses or other messes to gateway(eth1/eth0) if I have no rule set for my LAN-PC:s? Or the above scripts for that matter...Should I have a 'eth1 tc-command here?' Or any advice or comment would be greatly appreciated.

/Patrich

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

#1 lore raw
Quoted 37 lines · Patrich Björklund

Hi all! I'm new to this list, and hope for some clarity in this matter:

I have a home-gateway with linux-2.6.9 and iproute2 (ver:2.6.9). My following tc syntaxes.

# eth0 internet scheduleing are:

tc qdisc add dev eth0 root handle 1: htb default 20

tc class add dev eth0 parent 1: classid 1:1 htb rate 512kbit burst 6k tc class add dev eth0 parent 1:1 classid 1:10 htb rate 512kbit burst 6k prio 1
tc class add dev eth0 parent 1:1 classid 1:20 htb reate 9*512/10kbit burst 6k prio 2

tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10 tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 10

tc filter add dev eth0 parent 1:0 protocol ip prio 10 u32 match ip tos 0x10 0xff flowid 1:10
tc filter add dev eth0 parent 1: protocol ip prio 10 u32 \
match ip protocol 6 0xff \
match u8 0x50 0x0f at 0 \
match u16 0x0000 0xffc0 at 2 \
match u8 0x10 0xff at 33 \
flowid 1:10

tc qdisc add dev dev eth0 handle ffff: ingress

tc filter add dev eth0 parent ffff: protocol ip prio 50 u32 \
match ip src 0.0.0.0/0 police rate 2200kbit burst 10k drop flowid :1

# My eth1 schedule:
tc qdisc add dev eth1 root tbf rate 512kbit latency 50ms burst 10000

The long eth0 tc-script is fetched externally as you may see...but:

Quoted 8 lines

This have worked well for me (no, really) but...since I am a newbee, I have read the lartc doc, and understood some but very much was really hard to get...especially the class and filter stuff. Lets say it's not a 'for dummies' book :) No complainig. My Q are, is there a chance I will get packet losses or other messes to gateway(eth1/eth0) if I have no rule set for my LAN-PC:s? Or the above scripts for that matter...Should I have a 'eth1 tc-command here?' Or any advice or comment would be greatly appreciated.

There are no real errors in your script. Of course, each script can be tuned. Some remarks:
- you are only shaping traffic leaving eth0, if you add class/filters to eth1, you can also shaping traffic leaving eth1
- you are shaping traffic leaving eth1 because you are shaping traffic entering eth0 with the ingress qdisc. but using htb/cbq for shaping gives you much more control.
- try http://docum.org/ for other/more information.

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