Traffic shaping for multiple VMs

cpastream

New Member
Nov 5, 2011
10
0
1
Hi
I have a traffic shaping issue. I have a 50 Mbps connection and I am trying to shape traffic for my VMs. I found this url http://wiki.openvz.org/Traffic_shaping_with_tc and it has helped me shape the traffic for one VM but I don't know how to shape traffic for multiple VMs.

I have the following code:

Code:
DEV=eth0
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 100mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 4096kbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip dst 192.168.100.1 flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10

How do I adapt the above

to limit traffic for 192.168.100.1 with 4096 kbits
to limit traffic for 192.168.100.2 with 1024 kbits
to limit traffic for 192.168.100.3 with 2048 kbits

and more ip and speed pairs?
 
Hi
I have a traffic shaping issue. I have a 50 Mbps connection and I am trying to shape traffic for my VMs. I found this url http://wiki.openvz.org/Traffic_shaping_with_tc and it has helped me shape the traffic for one VM but I don't know how to shape traffic for multiple VMs.

I have the following code:

Code:
DEV=eth0
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 100mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 4096kbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip dst 192.168.100.1 flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10

How do I adapt the above

to limit traffic for 192.168.100.1 with 4096 kbits
to limit traffic for 192.168.100.2 with 1024 kbits
to limit traffic for 192.168.100.3 with 2048 kbits

and more ip and speed pairs?

Why don't you do this on the router? This is a far better place for shaping traffic?

Rob


Sent from my iPhone using Tapatalk
 
What about installing a PFSense KVM machine and routing your traffic through that, although it is a firewall distro it will do what you need. Another option would be to use Vyatta, but I can't recommend that from personal experience.
 
What about installing a PFSense KVM machine and routing your traffic through that, although it is a firewall distro it will do what you need. Another option would be to use Vyatta, but I can't recommend that from personal experience.

I would second the pfsense suggestion. It comes with an incredible amount of options one of them is traffic shaping.

pfsense.JPG
 
When I try the "tc" commands, I get the following errors:

Code:
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: Invalid argument
We have an error talking to the kernel
RTNETLINK answers: No such file or directory

How do I solve this? I get the same error messages with "wondershaper".


Last entries of dmesg:

Code:
sch_htb: disagrees about version of symbol module_layout
sch_cbq: disagrees about version of symbol module_layout
sch_ingress: disagrees about version of symbol module_layout
sch_cbq: disagrees about version of symbol module_layout

Code:
###:~# insmod sch_htb
insmod: can't read 'sch_htb': No such file or directory
###:~# modprobe sch_htb
FATAL: Error inserting sch_htb (/lib/modules/2.6.32-6-pve/kernel/net/sched/sch_htb.ko): Invalid module format
###:~# insmod /lib/modules/2.6.32-6-pve/kernel/net/sched/sch_htb.ko
insmod: error inserting '/lib/modules/2.6.32-6-pve/kernel/net/sched/sch_htb.ko': -1 Invalid module format

Code:
pve-manager: 1.9-26 (pve-manager/1.9/6567)
running kernel: 2.6.32-6-pve
proxmox-ve-2.6.32: 1.9-50
pve-kernel-2.6.32-6-pve: 2.6.32-50
qemu-server: 1.1-32
pve-firmware: 1.0-14
libpve-storage-perl: 1.0-19
vncterm: 0.9-2
vzctl: 3.0.29-3pve1
vzdump: 1.2-16
vzprocps: 2.0.11-2
vzquota: 3.0.11-1
pve-qemu-kvm: 0.15.0-1
ksm-control-daemon: 1.0-6
 
Last edited:
I think I fixed the issue by installing the latest kernel from Fri Nov 4 06:54:05