#!/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
Hi,...
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,Hi,
How to use for KVM machines?
hello
I created this scrypt " bandwidth.sh "
i added this in /etc/init.dCode:#!/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 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?
i this scriptpve-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
This not work i this error#!/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
Why this errorsh 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"