In OpenVZ, both traffic accounting and bandwidth management are based on network classes. The network classes’ definition file (/etc/vz/conf/networks_classes
) describes network classes that OpenVZ recognizes. Currently, there can be up to 15 classes defined.
The lines in this file have the following format:
<class_ID> <IP_address>/<prefix_length>
where <class_ID>
defines the network class identifier, <IP_address>
defines the starting IP address, and <prefix_length>
defines the subnet mask. In pair <IP_address>
and <prefix_length>
define the range of IP addresses for this class. There may be several lines for each class. Classes should be defined after Class 1 and represent exceptions from the "matching-everything" rule of Class 1. Class 0 has a special meaning and defines the IP ranges for which no accounting is done (this server container addresses).
The definition of class 1 is required; any class except class 1 can be omitted. However, it is recommended to define class 0 correctly as it will improve performance. For example:
# HW node VPS's networks 0 10.10.10.0/24 0 10.10.15.0/24 # all IP("local" traffic) 1 0.0.0.0/0 # class 2 - "foreign" traffic #2 10.0.0.0/8 #2 11.0.0.0/8 # inside "foreign" network there # is a hole with "local" traffic #1 10.10.16.0/24