Re: HTB on loopback gives a bit rate multiplied by 8

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kiruthika Selvamani wrote:
Hi,

I am trying to use htb to limit bandwidth on loopback for traffic
through particular port.

Here is the script I am using.

tc qdisc add dev lo root handle 1: htb
tc class add dev lo parent 1: classid 1:1 htb rate 100kbit ceil 100kbit
tc class add dev lo parent 1:1 classid 1:10 htb rate 50kbit ceil 50kbit
tc class add dev lo parent 1:1 classid 1:11 htb rate 50kbit ceil 50kbit
tc filter add dev lo protocol ip parent 1:0 prio 0 u32 match ip sport
22 0xffff flowid 1:10
tc filter add dev lo protocol ip parent 1:0 prio 0 u32 match ip dport
22 0xffff flowid 1:11

When this script is applied across eth0 (when I do a sftp to another
machine) the bandwidth limitation is applied correctly. However if I
use this in loopback (sftp to another directory in the same machine)
then I get bit rate approx 400kbit - i.e. usually it roughly
multiplies the bit rate by 8. Why does this happen? Does HTB work
differently in loopback? Any clue regarding this would be mostl
helpful.

It's because the MTU on lo is big and htb uses a small one when it asks tc to make it's rate lookup tables.

if you do a tc -s class ls dev lo you will see there is a giants counter , giant packets are only limited as if they are the size of the biggest slot in the lookup table.

To fix specify the mtu of lo on the htb classes or set the mtu on lo to 1500.

Andy.
_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux