Turning On and Off Network Bandwidth Management
Traffic shaping (also known as network bandwidth management) allows you to control what network bandwidth a virtual machine or Container receives for outgoing traffic. Traffic shaping is off by default in Parallels Server Bare Metal and is controlled by the
TRAFFIC_SHAPING
parameter in the
/etc/vz/vz.conf
global configuration file.
Note:
Incoming traffic cannot be controlled for virtual machines and Containers in Parallels Server Bare Metal.
To turn traffic shaping on, you need to complete the following steps:
-
Set the value of
TRAFFIC_SHAPING
to
yes
in the global configuration file.
-
Correctly set up the
BANDWIDTH
and
TOTALRATE
parameters values.
-
Start traffic shaping with the
/etc/init.d/vz shaperon
command.
The
BANDWIDTH
variable is used for specifying the network rate, in kilobits per second, of available network adapters. By default, it is set to
eth0:100000
, which corresponds to a 100Mb/s Fast Ethernet card. If your server has more network adapters installed, update this parameter by listing all the adapters participating in shaping. For example, if you have two Fast Ethernet cards, set the parameter to
eth0:100000 eth1:100000
.
The
TOTALRATE
variable specifies the size of the so-called bandwidth pool for each network class being shaped. The bandwidth from the pool can be borrowed by virtual machines and Containers when they need more bandwidth for communicating with hosts from the corresponding network class. It is used to limit the total available outgoing traffic virtual machines and Containers can consume. The format of this variable is
<
NIC
>:<
network_class
>:<
bandwidth_in_Kbits_per_second
>
and defines the pool size per network class for a given network adapter. Multiple entries for different network classes and adapters can be separated by spaces. The default value for
TOTALRATE
is
eth0:1:4000
, which corresponds to the pool size of 4Mb/s for Network Class 1 on the first Ethernet adapter.
In the
/etc/vz/vz.conf
configuration file, you can also define the
RATE
variable whose value amounts to the number of kilobits per second any virtual machine and Container is guaranteed to receive for outgoing traffic with a network class on an Ethernet device. The default value of this parameter is
eth0:1:8
, which means that any virtual machine and Container is guaranteed to receive the bandwidth of at least 8 Kb/s for sending data to Class 1 hosts on the first Ethernet device. This bandwidth is not the limit for a virtual machine and Container (unless the
RATEBOUND
parameter is enabled for the virtual machine or Container); the virtual machine or Container can take the needed bandwidth from the
TOTALRATE
bandwidth pool if it is not used by other virtual machines and Containers.
After setting up the above parameters, start bandwidth management as follows:
# /etc/init.d/vz shaperon
Starting shaping: Ok
Set shaping on running Container :
vz WARNING: Can't get tc class for Container(101).
vz WARNING: Can't access file /var/run/vz_tc_classes. \
Creating new one.
vz WARNING: Can't get tc class for Container(1).
Now you have activated the network bandwidth limits. To turn traffic shaping off temporarily, use the
/etc/init.d/vz shaperoff
command. If you want to disable bandwidth management permanently, set the
TRAFFIC_SHAPING
variable to
no
in the
/etc/vz/vz.conf
configuration file.
|