Hi, I use HTB to shape incoming traffic from internet to my internal network. I want to split traffic into 2 flows: to my box (behind the linux box) and to all other users. The Linux box comes with kernel 2.4.18 and HTB v. 2. My setup looks like this: tc qdisc del dev eth0 root tc qdisc add dev eth0 root handle 1: htb default 10 # Local traffic tc class add dev eth0 parent 1: classid 1:3 htb rate 30mbit ceil 60mbit burst 1000k # Internet (whole) tc class add dev eth0 parent 1: classid 1:2 htb rate 2000kbit ceil 2000kbit burst 15k # Internet (everyone except my IP) tc class add dev eth0 parent 1:2 classid 1:10 htb rate 300kbit ceil 1500kbit burst 5k tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10 quantum 1500 # Internet (my IP) tc class add dev eth0 parent 1:2 classid 1:11 htb rate 400kbit ceil 1500kbit burst 5k tc qdisc add dev eth0 parent 1:11 handle 20: sfq perturb 10 quantum 1500 So it should be sthg like this: 1: | | | | | | 1:2 1:3 | | | | | | 1:10 1:11 I omitted the filters because they work just fine, directing traffic to appropriate classes. The trouble is that the traffic distribution is strange: the rate and ceil parameters don''t behave the way I think they should. The throughput of class 1:11 is smaller than the rate parameter, it only works when I decrease ceil parameter of class 1:10 to something like 300kbit - then class 1:11 get its rate or more. Plus, the ceil parameter in class 1:2 doesn''t seen to work - when I set rate to 800kbit it can''t go any faster, just as if rate was the limit This is my tc -s class show dev eth0 output: class htb 1:11 parent 1:2 leaf 20: prio 0 rate 400Kbit ceil 1500Kbit burst 5Kb cburst 3519b Sent 6723692 bytes 4557 pkts (dropped 0, overlimits 53) rate 30219bps 20pps lended: 4364 borrowed: 193 giants: 0 injects: 0 tokens: 3080 ctokens: 8568 class htb 1:10 parent 1:2 leaf 10: prio 0 rate 300Kbit ceil 1500Kbit burst 5Kb cburst 3519b Sent 20456108 bytes 17579 pkts (dropped 0, overlimits 4496) rate 82087bps 74pps lended: 7502 borrowed: 10077 giants: 0 injects: 0 tokens: 97280 ctokens: 12630 class htb 1:2 root prio 0 rate 2000Kbit ceil 2000Kbit burst 15Kb cburst 4159b Sent 27376137 bytes 22934 pkts (dropped 0, overlimits 0) rate 112478bps 97pps lended: 10466 borrowed: 0 giants: 0 injects: 0 tokens: 44314 ctokens: 8473 But when I set ceil of class 1:10 to 300kbit, it looks totally different - class 1:11 gets it fair share or even more: class htb 1:11 parent 1:2 leaf 20: prio 0 rate 400Kbit ceil 1500Kbit burst 5Kb cburst 3519b Sent 5324008 bytes 3604 pkts (dropped 0, overlimits 0) rate 68027bps 46pps lended: 2444 borrowed: 1160 giants: 0 injects: 0 tokens: -3042 ctokens: 8568 class htb 1:10 parent 1:2 leaf 10: prio 0 rate 300Kbit ceil 300Kbit burst 5Kb cburst 1983b Sent 3227721 bytes 3850 pkts (dropped 0, overlimits 8700) rate 37434bps 44pps backlog 53p lended: 3797 borrowed: 0 giants: 0 injects: 0 tokens: 35336 ctokens: -31566 class htb 1:2 root prio 0 rate 2000Kbit ceil 2000Kbit burst 15Kb cburst 4159b Sent 8525779 bytes 7593 pkts (dropped 0, overlimits 0) rate 104106bps 91pps lended: 1160 borrowed: 0 giants: 0 injects: 0 tokens: 42830 ctokens: 6989 What''s is the problem? Have I overlooked something? Thanks in advance -- greetz Radek Majkut rahdeck@interia.pl ---------------------------------------------------------------------- INTERIA.PL: Portal pelen informacji >>> http://link.interia.pl/f15b7
I didn''t read carefuly but it seems as most common problem - you have to shape to smaller (by say 5%) rate than your ISP link is. devik On Tue, 21 May 2002, Radosław Majkut wrote:> Hi, > I use HTB to shape incoming traffic from internet to my internal > network. I want to split traffic into 2 flows: to my box (behind the linux box) and > to all other users. The Linux box comes with kernel 2.4.18 and HTB v. 2. My setup looks like > this: > > > tc qdisc del dev eth0 root > tc qdisc add dev eth0 root handle 1: htb default 10 > > > # Local traffic > > tc class add dev eth0 parent 1: classid 1:3 htb rate 30mbit ceil 60mbit burst 1000k > > > # Internet (whole) > > tc class add dev eth0 parent 1: classid 1:2 htb rate 2000kbit ceil 2000kbit burst 15k > > # Internet (everyone except my IP) > > tc class add dev eth0 parent 1:2 classid 1:10 htb rate 300kbit ceil 1500kbit burst 5k > tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10 quantum 1500 > > # Internet (my IP) > > tc class add dev eth0 parent 1:2 classid 1:11 htb rate 400kbit ceil 1500kbit burst 5k > tc qdisc add dev eth0 parent 1:11 handle 20: sfq perturb 10 quantum 1500 > > > > So it should be sthg like this: > > 1: > | | > | | > | | > 1:2 1:3 > | | > | | > | | > 1:10 1:11 > > > I omitted the filters because they work just fine, directing traffic > to appropriate classes. The trouble is that the traffic distribution > is strange: the rate and ceil parameters don''t behave the way I think > they should. The throughput of class 1:11 is smaller than the rate > parameter, it only works when I decrease ceil parameter of class 1:10 > to something like 300kbit - then class 1:11 get its rate or more. > Plus, the ceil parameter in class 1:2 doesn''t seen to work - when I > set rate to 800kbit it can''t go any faster, just as if rate was the > limit > > This is my tc -s class show dev eth0 output: > > class htb 1:11 parent 1:2 leaf 20: prio 0 rate 400Kbit ceil 1500Kbit burst 5Kb cburst 3519b > Sent 6723692 bytes 4557 pkts (dropped 0, overlimits 53) > rate 30219bps 20pps > lended: 4364 borrowed: 193 giants: 0 injects: 0 > tokens: 3080 ctokens: 8568 > > class htb 1:10 parent 1:2 leaf 10: prio 0 rate 300Kbit ceil 1500Kbit burst 5Kb cburst 3519b > Sent 20456108 bytes 17579 pkts (dropped 0, overlimits 4496) > rate 82087bps 74pps > lended: 7502 borrowed: 10077 giants: 0 injects: 0 > tokens: 97280 ctokens: 12630 > > class htb 1:2 root prio 0 rate 2000Kbit ceil 2000Kbit burst 15Kb cburst 4159b > Sent 27376137 bytes 22934 pkts (dropped 0, overlimits 0) > rate 112478bps 97pps > lended: 10466 borrowed: 0 giants: 0 injects: 0 > tokens: 44314 ctokens: 8473 > > But when I set ceil of class 1:10 to 300kbit, it looks totally > different - class 1:11 gets it fair share or even more: > > class htb 1:11 parent 1:2 leaf 20: prio 0 rate 400Kbit ceil 1500Kbit burst 5Kb cburst 3519b > Sent 5324008 bytes 3604 pkts (dropped 0, overlimits 0) > rate 68027bps 46pps > lended: 2444 borrowed: 1160 giants: 0 injects: 0 > tokens: -3042 ctokens: 8568 > > class htb 1:10 parent 1:2 leaf 10: prio 0 rate 300Kbit ceil 300Kbit burst 5Kb cburst 1983b > Sent 3227721 bytes 3850 pkts (dropped 0, overlimits 8700) > rate 37434bps 44pps backlog 53p > lended: 3797 borrowed: 0 giants: 0 injects: 0 > tokens: 35336 ctokens: -31566 > > class htb 1:2 root prio 0 rate 2000Kbit ceil 2000Kbit burst 15Kb cburst 4159b > Sent 8525779 bytes 7593 pkts (dropped 0, overlimits 0) > rate 104106bps 91pps > lended: 1160 borrowed: 0 giants: 0 injects: 0 > tokens: 42830 ctokens: 6989 > > What''s is the problem? Have I overlooked something? > Thanks in advance > > -- > greetz > Radek Majkut > rahdeck@interia.pl > > > > ---------------------------------------------------------------------- > INTERIA.PL: Portal pelen informacji >>> http://link.interia.pl/f15b7 > > > _______________________________________________ > LARTC mailing list / LARTC@mailman.ds9a.nl > http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/ > >
Hi, I use two interfaces (eth0 and eth1) in my gateway and using HTB to shape traffic from my internal network (eth0), so HTB using root dev eth0 to shape the traffic. if I want to change root dev with eth1 (external), what''s the differences with the previous setting ... which ones is better ? Best regards,>--<Kristiadi Himawan>--<
Kristiadi Himawan wrote:> Hi, > I use two interfaces (eth0 and eth1) in my gateway and using HTB to > shape traffic from my internal network (eth0), > so HTB using root dev eth0 to shape the traffic. > if I want to change root dev with eth1 (external), > what''s the differences with the previous setting ... > which ones is better ? >Its not a question of better or worse, you don''t shape traffic coming from somewhere but traffic going out an interface, so assuming eth1 is your connection to the internet and you want to shape traffic going to the internet you have to shape on eth1. If you want to shape traffic going to your internal network (probably coming from the internet) then you would shape on eth0. Patrick