I've tried using 'rate' to limit the traffic speed of a VM inside the config file but that only limits the outgoing traffic speed of traffic from the VM. I want to limit the speed traffic can flow both ways.
Thanks
I've tried using 'rate' to limit the traffic speed of a VM inside the config file but that only limits the outgoing traffic speed of traffic from the VM. I want to limit the speed traffic can flow both ways.
Thanks
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:
vif = [ 'rate=5Mb/s , bridge=xenbr0' ]
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:
vif = [ 'rate=5Mb/s@25ms , bridge=xenbr0' ]
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 ;;
tc qdisc add dev "$dev" root tbf rate 120mbit burst 20mbit latency 5ms peakrate 125mbit minburst 20mbit mpu 64
So the modified version of vif-bridge should look like this:
online)
setup_virtual_bridge_port "$dev"
mtu="`ip link show $bridge | awk '/mtu/ { print $5 }'`"
if [ -n "$mtu" ] && [ "$mtu" -gt 0 ]
then
ip link set $dev mtu $mtu || :
fi
add_to_bridge "$bridge" "$dev"
tc qdisc add dev "$dev" root tbf rate 120mbit burst 20mbit latency 5ms peakrate 125mbit minburst 20mbit mpu 64
;;
Find this word 'offline)'
Append to first line: do_without_error tc qdisc del dev "$dev" root
offline)
do_without_error tc qdisc del dev "$dev" root
do_without_error brctl delif "$bridge" "$dev"
do_without_error ifconfig "$dev" down
;;
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