I've tried using 'rate' to limit the traffic speed of a VM inside the config file but that only limits the incoming traffic speed of traffic to the VM. I want to limit the speed traffic can flow both ways.
I use XEN 4.2.2 at the time of this reply.
If you get no errors, you're ready to modify /etc/xen/scripts/vif-bridge
Find this word 'online)'
Just add before
So the modified version of vif-bridge should look like this:
Find this word 'offline)'
Append to first line: do_without_error tc qdisc del dev "$dev" root
Using the above TBF rule your guest should have roughly 12.5MB/s upload and 14.0M/s download speed; a bit over 120Mbps
If you upload/download same time, both upload and download speed should be about 7.5MB/s ~ 150Mbps total bandwidth
This is what I got after an hour tweaking. If you find better values; please let us know
While I'm not sure of a way to limit the inbound traffic to a Xen DomU (which is actually what you claim to have already done), I have limited outbound traffic in the past by making a very simple change to the vif definition in my DomU's config file. For example, for one guest, I am using:
Like I said, though, this will only limit the rate of outbound traffic.
I've also read (but haven't tried) that you have the option of specifying a time window to tweak the latency/throughput, as well, with a syntax like the following: