Hi, complete newb and I apologise for it. I have a setup where my linux box has multiple broadband connection where I am routing certain things over certain interfaces, currently 2 links eth2 is a 1500/256 and eth3 is a 512/512, eth0 is the link to the LAN for users. What I am trying to do is traffic shape the information going out eth0 to the local users by the interface the traffic arrived from (eth2 or eth3), but I am not having much luck. If i just do it as a normal interface and do the max bandwidth as 2012 max bandwidth it works but the queues are sort of screwed up since different types of traffic are mostly coming in from 1 interface not another etc etc. Here is what i attempted to do..... Each parent queue i tried to apply to the handle the mark of the interface eth2 is a mark of 0x03 and eth3 is a mark of 0x04 (i use the same marks for routing some port related traffic out different interfaces). I have probably made some basic mistake I should be smacked around the head and shoulders repeatedly with a nerf bat for, but I need to ask what i have missed. Or maybe a better way of designing the traffic shaping rules? James # setup root queue tc qdisc add dev eth0 root handle 1: htb # Setup incoming from eth2 1500k link tc class add dev eth0 parent 1:0 classid 1:2 htb rate 1350kbit quantum 1500 tc filter add dev eth0 parent 1:0 protocol ip prio 1 handle 0x03 fw flowid 1:2 tc class add dev eth0 parent 1:2 classid 1:210 htb rate 168kbit ceil 224kbit prio 1 quantum 1500 tc class add dev eth0 parent 1:2 classid 1:220 htb rate 362kbit ceil 640kbit prio 2 quantum 1500 tc class add dev eth0 parent 1:2 classid 1:230 htb rate 640kbit ceil 960kbit prio 3 quantum 1500 tc class add dev eth0 parent 1:2 classid 1:240 htb rate 180kbit ceil 240kbit prio 4 quantum 1500 tc qdisc add dev eth0 parent 1:210 handle 210: sfq perturb 10 tc qdisc add dev eth0 parent 1:220 handle 220: sfq perturb 10 tc qdisc add dev eth0 parent 1:230 handle 230: sfq perturb 10 tc qdisc add dev eth0 parent 1:240 handle 240: sfq perturb 10 tc filter add dev eth0 parent 1:2 protocol ip prio 10 u32 match ip tos 0x10 0xff flowid 1:210 tc filter add dev eth0 parent 1:2 protocol ip prio 10 u32 match ip protocol 1 0xff flowid 1:210 tc filter add dev eth0 parent 1:2 protocol ip prio 10 u32 match ip protocol 6 0xff match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 2 match u8 0x10 0xff at 33 flowid 1:210 tc filter add dev eth0 parent 1:2 protocol ip prio 10 u32 match ip tos 0x04 0xff flowid 1:220 tc filter add dev eth0 parent 1:2 protocol ip prio 11 u32 match ip tos 0x08 0xff flowid 1:230 tc filter add dev eth0 parent 1:2 protocol ip prio 12 u32 match ip tos 0x02 0xff flowid 1:240 tc filter add dev eth0 parent 1:2 protocol ip prio 12 u32 match ip tos 0x00 0xff flowid 1:240 tc filter add dev eth0 parent 1:2 protocol ip prio 13 handle 0x03 fw flowid 1:220 # Setup incoming from eth3 512k link tc class add dev eth0 parent 1:0 classid 1:1 htb rate 512kbit quantum 1500 tc filter add dev eth0 parent 1:0 protocol ip prio 1 handle 0x04 fw flowid 1:1 tc class add dev eth0 parent 1:1 classid 1:110 htb rate 168kbit ceil 224kbit prio 1 quantum 1500 tc class add dev eth0 parent 1:1 classid 1:120 htb rate 320kbit ceil 448kbit prio 2 quantum 1500 tc class add dev eth0 parent 1:1 classid 1:130 htb rate 16kbit ceil 224kbit prio 3 quantum 1500 tc class add dev eth0 parent 1:1 classid 1:140 htb rate 64kbit ceil 96kbit prio 4 quantum 1500 tc qdisc add dev eth0 parent 1:110 handle 110: sfq perturb 10 tc qdisc add dev eth0 parent 1:120 handle 120: sfq perturb 10 tc qdisc add dev eth0 parent 1:130 handle 130: sfq perturb 10 tc qdisc add dev eth0 parent 1:140 handle 140: sfq perturb 10 tc filter add dev eth0 parent 1:1 protocol ip prio 10 u32 match ip tos 0x10 0xff flowid 1:110 tc filter add dev eth0 parent 1:1 protocol ip prio 10 u32 match ip protocol 1 0xff flowid 1:110 tc filter add dev eth0 parent 1:1 protocol ip prio 10 u32 match ip protocol 6 0xff match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 2 match u8 0x10 0xff at 33 flowid 1:110 tc filter add dev eth0 parent 1:1 protocol ip prio 10 u32 match ip tos 0x04 0xff flowid 1:120 tc filter add dev eth0 parent 1:1 protocol ip prio 11 u32 match ip tos 0x08 0xff flowid 1:130 tc filter add dev eth0 parent 1:1 protocol ip prio 12 u32 match ip tos 0x02 0xff flowid 1:140 tc filter add dev eth0 parent 1:1 protocol ip prio 12 u32 match ip tos 0x00 0xff flowid 1:140 tc filter add dev eth0 parent 1:1 protocol ip prio 13 handle 0x04 fw flowid 1:120 _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
Andy Furniss
2005-Mar-19 11:59 UTC
Re: Traffic Shaping multiple incoming broadband sources?
James Bean wrote:> Hi, complete newb and I apologise for it. > > I have a setup where my linux box has multiple broadband connection where I am routing certain things over certain interfaces, currently 2 links eth2 is a 1500/256 and eth3 is a 512/512, eth0 is the link to the LAN for users. What I am trying to do is traffic shape the information going out eth0 to the local users by the interface the traffic arrived from (eth2 or eth3), but I am not having much luck. > > If i just do it as a normal interface and do the max bandwidth as 2012 max bandwidth it works but the queues are sort of screwed up since different types of traffic are mostly coming in from 1 interface not another etc etc. > > Here is what i attempted to do..... > > Each parent queue i tried to apply to the handle the mark of the interface eth2 is a mark of 0x03 and eth3 is a mark of 0x04 (i use the same marks for routing some port related traffic out different interfaces). > > I have probably made some basic mistake I should be smacked around the head and shoulders repeatedly with a nerf bat for, but I need to ask what i have missed. > > Or maybe a better way of designing the traffic shaping rules?HTB looks OK - you are shaping traffic from the wrong end of the link though, so you need to back off from the link rates to ever build up a queue. Also you can not rely on TOS being set from internet, so you probably need to classify the traffic some other way. Andy.> > James > > # setup root queue > tc qdisc add dev eth0 root handle 1: htb > > # Setup incoming from eth2 1500k link > tc class add dev eth0 parent 1:0 classid 1:2 htb rate 1350kbit quantum 1500 > tc filter add dev eth0 parent 1:0 protocol ip prio 1 handle 0x03 fw flowid 1:2 > tc class add dev eth0 parent 1:2 classid 1:210 htb rate 168kbit ceil 224kbit prio 1 quantum 1500 > tc class add dev eth0 parent 1:2 classid 1:220 htb rate 362kbit ceil 640kbit prio 2 quantum 1500 > tc class add dev eth0 parent 1:2 classid 1:230 htb rate 640kbit ceil 960kbit prio 3 quantum 1500 > tc class add dev eth0 parent 1:2 classid 1:240 htb rate 180kbit ceil 240kbit prio 4 quantum 1500 > tc qdisc add dev eth0 parent 1:210 handle 210: sfq perturb 10 > tc qdisc add dev eth0 parent 1:220 handle 220: sfq perturb 10 > tc qdisc add dev eth0 parent 1:230 handle 230: sfq perturb 10 > tc qdisc add dev eth0 parent 1:240 handle 240: sfq perturb 10 > tc filter add dev eth0 parent 1:2 protocol ip prio 10 u32 match ip tos 0x10 0xff flowid 1:210 > tc filter add dev eth0 parent 1:2 protocol ip prio 10 u32 match ip protocol 1 0xff flowid 1:210 > tc filter add dev eth0 parent 1:2 protocol ip prio 10 u32 match ip protocol 6 0xff match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 2 match u8 0x10 0xff at 33 flowid 1:210 > tc filter add dev eth0 parent 1:2 protocol ip prio 10 u32 match ip tos 0x04 0xff flowid 1:220 > tc filter add dev eth0 parent 1:2 protocol ip prio 11 u32 match ip tos 0x08 0xff flowid 1:230 > tc filter add dev eth0 parent 1:2 protocol ip prio 12 u32 match ip tos 0x02 0xff flowid 1:240 > tc filter add dev eth0 parent 1:2 protocol ip prio 12 u32 match ip tos 0x00 0xff flowid 1:240 > tc filter add dev eth0 parent 1:2 protocol ip prio 13 handle 0x03 fw flowid 1:220 > > # Setup incoming from eth3 512k link > tc class add dev eth0 parent 1:0 classid 1:1 htb rate 512kbit quantum 1500 > tc filter add dev eth0 parent 1:0 protocol ip prio 1 handle 0x04 fw flowid 1:1 > tc class add dev eth0 parent 1:1 classid 1:110 htb rate 168kbit ceil 224kbit prio 1 quantum 1500 > tc class add dev eth0 parent 1:1 classid 1:120 htb rate 320kbit ceil 448kbit prio 2 quantum 1500 > tc class add dev eth0 parent 1:1 classid 1:130 htb rate 16kbit ceil 224kbit prio 3 quantum 1500 > tc class add dev eth0 parent 1:1 classid 1:140 htb rate 64kbit ceil 96kbit prio 4 quantum 1500 > tc qdisc add dev eth0 parent 1:110 handle 110: sfq perturb 10 > tc qdisc add dev eth0 parent 1:120 handle 120: sfq perturb 10 > tc qdisc add dev eth0 parent 1:130 handle 130: sfq perturb 10 > tc qdisc add dev eth0 parent 1:140 handle 140: sfq perturb 10 > tc filter add dev eth0 parent 1:1 protocol ip prio 10 u32 match ip tos 0x10 0xff flowid 1:110 > tc filter add dev eth0 parent 1:1 protocol ip prio 10 u32 match ip protocol 1 0xff flowid 1:110 > tc filter add dev eth0 parent 1:1 protocol ip prio 10 u32 match ip protocol 6 0xff match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 2 match u8 0x10 0xff at 33 flowid 1:110 > tc filter add dev eth0 parent 1:1 protocol ip prio 10 u32 match ip tos 0x04 0xff flowid 1:120 > tc filter add dev eth0 parent 1:1 protocol ip prio 11 u32 match ip tos 0x08 0xff flowid 1:130 > tc filter add dev eth0 parent 1:1 protocol ip prio 12 u32 match ip tos 0x02 0xff flowid 1:140 > tc filter add dev eth0 parent 1:1 protocol ip prio 12 u32 match ip tos 0x00 0xff flowid 1:140 > tc filter add dev eth0 parent 1:1 protocol ip prio 13 handle 0x04 fw flowid 1:120 > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > LARTC mailing list > LARTC@mailman.ds9a.nl > http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc