Limitation bandwitch

kis2a

New Member
Mar 8, 2011
16
0
1
hello , i not a tutorial for limit bandwitch for VM ?

upload 100mbits
Download 100mbits

Very thanks
 
hello

I created this scrypt " bandwidth.sh "


Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides:          bandwitch
# Short-Description: limitation bande passante
# Description:       limitation bande passante
### END INIT INFO



####################
#     IP VM        #
####################
ipvm1=11.11.11.11
ipvm2=22.22.22.22
ipvm3=33.33.33.33
ipvm4=44.44.44.44
ipvm5=55.55.55.55
ipvm6=66.66.66.66
ipvm7=77.77.77.77



###################
#Limitation VM 101#
###################
DEV=veth101.0
#up#
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 150mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip src $ipvm1 flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 150mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip dst $ipvm1 flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10

###################
#Limitation VM 102#
###################
DEV2=veth102.0
#up#
tc qdisc del dev $DEV2 root
tc qdisc add dev $DEV2 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV2 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV2 parent 1: protocol ip prio 16 u32 match ip src $ipvm2 flowid 1:1
tc qdisc add dev $DEV2 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV2 root
tc qdisc add dev $DEV2 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV2 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV2 parent 1: protocol ip prio 16 u32 match ip dst $ipvm2 flowid 1:1
tc qdisc add dev $DEV2 parent 1:1 sfq perturb 10

###################
#Limitation VM 103#
###################
DEV3=veth103.0
#up#
tc qdisc del dev $DEV3 root
tc qdisc add dev $DEV3 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV3 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV3 parent 1: protocol ip prio 16 u32 match ip src $ipvm3 flowid 1:1
tc qdisc add dev $DEV3 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV3 root
tc qdisc add dev $DEV3 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV3 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV3 parent 1: protocol ip prio 16 u32 match ip dst $ipvm3 flowid 1:1
tc qdisc add dev $DEV3 parent 1:1 sfq perturb 10


###################
#Limitation VM 104#
###################
DEV4=veth104.0
#up#
tc qdisc del dev $DEV4 root
tc qdisc add dev $DEV4 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV4 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV4 parent 1: protocol ip prio 16 u32 match ip src $ipvm4 flowid 1:1
tc qdisc add dev $DEV4 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV4 root
tc qdisc add dev $DEV4 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV4 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV4 parent 1: protocol ip prio 16 u32 match ip dst $ipvm4 flowid 1:1
tc qdisc add dev $DEV4 parent 1:1 sfq perturb 10


###################
#Limitation VM 105#
###################
DEV5=veth105.0
#up#
tc qdisc del dev $DEV5 root
tc qdisc add dev $DEV5 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV5 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV5 parent 1: protocol ip prio 16 u32 match ip src $ipvm5 flowid 1:1
tc qdisc add dev $DEV5 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV5 root
tc qdisc add dev $DEV5 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV5 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV5 parent 1: protocol ip prio 16 u32 match ip dst $ipvm5 flowid 1:1
tc qdisc add dev $DEV5 parent 1:1 sfq perturb 10


###################
#Limitation VM 106#
###################
DEV6=veth106.0
#up#
tc qdisc del dev $DEV6 root
tc qdisc add dev $DEV6 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV6 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV6 parent 1: protocol ip prio 16 u32 match ip src $ipvm6 flowid 1:1
tc qdisc add dev $DEV6 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV6 root
tc qdisc add dev $DEV6 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV6 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV6 parent 1: protocol ip prio 16 u32 match ip dst $ipvm6 flowid 1:1
tc qdisc add dev $DEV6 parent 1:1 sfq perturb 10



###################
#Limitation VM 107#
###################
DEV7=veth107.0
#up#
tc qdisc del dev $DEV7 root
tc qdisc add dev $DEV7 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV7 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV7 parent 1: protocol ip prio 16 u32 match ip src $ipvm7 flowid 1:1
tc qdisc add dev $DEV7 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV7 root
tc qdisc add dev $DEV7 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV7 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV7 parent 1: protocol ip prio 16 u32 match ip dst $ipvm7 flowid 1:1
tc qdisc add dev $DEV7 parent 1:1 sfq perturb 10
i added this in /etc/init.d

i started this -> cd /etc/init.d/ -> ./bandwidth.sh
i added this in start --> update-rc.d bandwidth.sh defaults

The limitation bandwitch work not good because

I reboot my vm108 , after restart this is unlimited bandwitch , why ?

how to make work limitation after reboot VM?
 
...
The limitation bandwitch work not good because

I reboot my vm108 , after restart this is unlimited bandwitch , why ?

how to make work limitation after reboot VM?
Hi,
i guess it's doesn't work after restart, because the device will be deleted.
Sorry can't gives more hints because i use mostly kvm-only.

Udo
 
Hi,

How to use for KVM machines?
Hi,
i guess that tc will also work quite well (why not, is the job of tc) - only the names of the devices are different. And you need a script, which is executed after the vm starts and stops... in the future you should be able to do that with cgroups (afaik support of network-resources in cgroups is in the 2.6.38 kernel) - i hope that the pve-kernel supports such fine things with cgroups.

Udo
 
hello

I created this scrypt " bandwidth.sh "


Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides:          bandwitch
# Short-Description: limitation bande passante
# Description:       limitation bande passante
### END INIT INFO



####################
#     IP VM        #
####################
ipvm1=11.11.11.11
ipvm2=22.22.22.22
ipvm3=33.33.33.33
ipvm4=44.44.44.44
ipvm5=55.55.55.55
ipvm6=66.66.66.66
ipvm7=77.77.77.77



###################
#Limitation VM 101#
###################
DEV=veth101.0
#up#
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 150mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip src $ipvm1 flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 150mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip dst $ipvm1 flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10

###################
#Limitation VM 102#
###################
DEV2=veth102.0
#up#
tc qdisc del dev $DEV2 root
tc qdisc add dev $DEV2 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV2 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV2 parent 1: protocol ip prio 16 u32 match ip src $ipvm2 flowid 1:1
tc qdisc add dev $DEV2 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV2 root
tc qdisc add dev $DEV2 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV2 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV2 parent 1: protocol ip prio 16 u32 match ip dst $ipvm2 flowid 1:1
tc qdisc add dev $DEV2 parent 1:1 sfq perturb 10

###################
#Limitation VM 103#
###################
DEV3=veth103.0
#up#
tc qdisc del dev $DEV3 root
tc qdisc add dev $DEV3 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV3 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV3 parent 1: protocol ip prio 16 u32 match ip src $ipvm3 flowid 1:1
tc qdisc add dev $DEV3 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV3 root
tc qdisc add dev $DEV3 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV3 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV3 parent 1: protocol ip prio 16 u32 match ip dst $ipvm3 flowid 1:1
tc qdisc add dev $DEV3 parent 1:1 sfq perturb 10


###################
#Limitation VM 104#
###################
DEV4=veth104.0
#up#
tc qdisc del dev $DEV4 root
tc qdisc add dev $DEV4 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV4 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV4 parent 1: protocol ip prio 16 u32 match ip src $ipvm4 flowid 1:1
tc qdisc add dev $DEV4 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV4 root
tc qdisc add dev $DEV4 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV4 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV4 parent 1: protocol ip prio 16 u32 match ip dst $ipvm4 flowid 1:1
tc qdisc add dev $DEV4 parent 1:1 sfq perturb 10


###################
#Limitation VM 105#
###################
DEV5=veth105.0
#up#
tc qdisc del dev $DEV5 root
tc qdisc add dev $DEV5 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV5 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV5 parent 1: protocol ip prio 16 u32 match ip src $ipvm5 flowid 1:1
tc qdisc add dev $DEV5 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV5 root
tc qdisc add dev $DEV5 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV5 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV5 parent 1: protocol ip prio 16 u32 match ip dst $ipvm5 flowid 1:1
tc qdisc add dev $DEV5 parent 1:1 sfq perturb 10


###################
#Limitation VM 106#
###################
DEV6=veth106.0
#up#
tc qdisc del dev $DEV6 root
tc qdisc add dev $DEV6 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV6 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV6 parent 1: protocol ip prio 16 u32 match ip src $ipvm6 flowid 1:1
tc qdisc add dev $DEV6 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV6 root
tc qdisc add dev $DEV6 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV6 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV6 parent 1: protocol ip prio 16 u32 match ip dst $ipvm6 flowid 1:1
tc qdisc add dev $DEV6 parent 1:1 sfq perturb 10



###################
#Limitation VM 107#
###################
DEV7=veth107.0
#up#
tc qdisc del dev $DEV7 root
tc qdisc add dev $DEV7 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV7 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV7 parent 1: protocol ip prio 16 u32 match ip src $ipvm7 flowid 1:1
tc qdisc add dev $DEV7 parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV7 root
tc qdisc add dev $DEV7 root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV7 parent 1: classid 1:1 cbq rate 100mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV7 parent 1: protocol ip prio 16 u32 match ip dst $ipvm7 flowid 1:1
tc qdisc add dev $DEV7 parent 1:1 sfq perturb 10
i added this in /etc/init.d

i started this -> cd /etc/init.d/ -> ./bandwidth.sh
i added this in start --> update-rc.d bandwidth.sh defaults

The limitation bandwitch work not good because

I reboot my vm108 , after restart this is unlimited bandwitch , why ?

how to make work limitation after reboot VM?


one solution please ?
 
hello TC not work actually , i reinstalled my dedicated network

my configue

pve-manager: 1.7-11 (pve-manager/1.7/5470)
running kernel: 2.6.32-4-pve
proxmox-ve-2.6.32: 1.7-30
pve-kernel-2.6.32-4-pve: 2.6.32-30
qemu-server: 1.1-28
pve-firmware: 1.0-10
libpve-storage-perl: 1.0-16
vncterm: 0.9-2
vzctl: 3.0.24-1pve4
vzdump: 1.2-10
vzprocps: 2.0.11-1dso2
vzquota: 3.0.11-1
pve-qemu-kvm: 0.13.0-3
ksm-control-daemon: 1.0-4
i this script

#!/bin/sh
### BEGIN INIT INFO
# Provides: bandwitch
# Short-Description: limitation bande passante
# Description: limitation bande passante
### END INIT INFO



####################
# IP VM #
####################
ipvm1=11.11.11.11




###################
#Limitation VM 101#
###################
DEV=veth101.0
#up#
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 150mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip src $ipvm1 flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10
#Down#
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 1000mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 150mbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip dst $ipvm1 flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10
This not work i this error

sh bandwidth.sh
: command not found7:
: command not found8:
: command not found9:
: command not found14:
: command not found15:
: command not found16:
: command not found17:
"annot find device "veth101.0
Illegal "bandwidth"
"?at is "isolated
Usage: ... cbq bandwidth BPS rate BPS maxburst PKTS [ avpkt BYTES ]
[ minburst PKTS ] [ bounded ] [ isolated ]
[ allot BYTES ] [ mpu BYTES ] [ weight RATE ]
[ prio NUMBER ] [ cell BYTES ] [ ewma LOG ]
[ estimator INTERVAL TIME_CONSTANT ]
[ split CLASSID ] [ defmap MASK/CHANGE ]
[ overhead BYTES ] [ linklayer TYPE ]
Illegal "match"
Illegal "perturb"
"annot find device "veth101.0
Illegal "bandwidth"
"?at is "isolated
Usage: ... cbq bandwidth BPS rate BPS maxburst PKTS [ avpkt BYTES ]
[ minburst PKTS ] [ bounded ] [ isolated ]
[ allot BYTES ] [ mpu BYTES ] [ weight RATE ]
[ prio NUMBER ] [ cell BYTES ] [ ewma LOG ]
[ estimator INTERVAL TIME_CONSTANT ]
[ split CLASSID ] [ defmap MASK/CHANGE ]
[ overhead BYTES ] [ linklayer TYPE ]
Illegal "match"
Illegal "perturb"
Why this error
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!