0

I am using these commands to set up bandwidth throttling:

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1: cbq avpkt 1000 bandwidth 100Mbit
tc class add dev eth1 parent 1: classid 1:1 cbq rate 1Mbit allot 1500 prio 3 bounded isolated
tc filter add dev eth1 parent 1: protocol ip u32 match ip protocol 6 0xff flowid 1:1

it

My understanding is that these commands should limit my network traffic to 1 MBit / 125 KByte per second but they don't.

The actual data transfer rate is roughly 5 MByte per second. I measured that by transferring a large file over NFS. If I modify the "rate 1Mbit" parameter to "rate 512 Kbit" the transfer rate is only 2.5 MByte per second, so the tc command does in fact throttle the traffic but not to what the parameter say.

This server is running Debian Linux 6.0.7 as a Citrix XenServer VM.

What are I am doing wrong? Please advise.

nn4l
  • 1,336
  • 5
  • 23
  • 40

1 Answers1

2

Your tc rules only applies to outgoing traffic.

Check this page:

Now bear in mind that we will generally only shape outgoing traffic, because thats what we have control over, unlike traffic coming in.

If you route two interfaces you can put similar rules on each device and route/bridge between. That way what is passed to the incoming chain of one device passes to the outgoing of the other, effectively limiting bandwith in both directions

another alternative is using the IFB pseudo-device which

allows attaching queuing discplines to incoming packets.

Petter H
  • 3,443
  • 1
  • 16
  • 19