Turning On and Off Network Bandwidth Management
Traffic shaping also known as network bandwidth management allows you to control what network bandwidth a Container receives for outgoing traffic. Traffic shaping is off by default in Parallels Server Bare Metal and is controlled by the
TRAFFIC_SHAPING
variable in the
/etc/vz/vz.conf
global configuration file.
Note:
Container incoming traffic cannot be controlled 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:102400
, which corresponds to a 100Mb/s Fast Ethernet card. If your server has more network adapters installed, you need to update this variable to list all the adapters participating in shaping. For example, in case of two Fast Ethernet cards this variable shall be set to
eth0:102400 eth1:102400
.
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 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 Containers can consume; the next section explains it in more detail. 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 shall be separated by spaces. The default value for
TOTALRATE
is
eth0:1:4096
, 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 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 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 Container (unless the
RATEBOUND
parameter is set to
yes
in the Container configuration file) the Container is able to take the needed bandwidth from the
TOTALRATE
bandwidth pool if it is not used by other Containers.
After setting up the above variables, 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.
|