Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to limit the outgoing traffic to a specific bandwidth.

My Code:

tc qdisc add dev vif1.0 root handle 1: htb default 30
tc class add dev vif1.0 parent 1: classid 1:1 htb rate 1mbit
tc class add dev vif1.0 parent 1: classid 1:2 htb rate 1mbit
tc filter add dev vif1.0 protocol ip parent 1:0 prio 1 u32 match ip dst flowid 1:1
tc filter add dev vif1.0 protocol ip parent 1:0 prio 1 u32 match ip src flowid 1:2

But nothing happens.. I have uploaded a 1GB file and can download it with 4MB/s

vif1.0 is the interface name of my virtual machine

share|improve this question
Unclear on which interface vif1.0 is. Is that on the host machine, or the guest? And is the guest the one sending the file? – derobert Oct 14 '13 at 15:36
@derobert Yes, the interface vif1.0 is on the host machine. i have a webserver on my guest machine. i download the file from it (--> outgoing) or upload a file to the guest machine (--> incoming) – Vince Oct 14 '13 at 20:27
the HTB needs to be on an interface where there is a packet queue. So that'd be the outgoing interface on the guest (assuming you're downloading to the VM host machine). [And assuming it works at all on a virtual interface, not sure.] – derobert Oct 14 '13 at 20:39
@derobert interface eth1 is the whole internet. and all other interfaces (vif1.0 too) goes over eth1 to the internet.. so what is the problem with my configuration? :/ – Vince Oct 15 '13 at 12:16
It sounds like the traffic is coming in to your host machine over vif1.0, but htb works on traffic going out of an interface. – derobert Oct 15 '13 at 13:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.