Previous page

Next page

Locate page in Contents

Print this page

Creating and Deleting veth Network Adapters

By default, any Container on the host starts functioning in the venet0 mode right after its creation. However, at any time you can create additional virtual adapters for Containers and set them to work in the bridged mode. You can do this using the --netif_add option of the prlctl set command.

Let us assume that you wish to create a new virtual adapter with the name of eth1 in Container 101 and make it function in the bridged mode. To do this, run the following command :

# prlctl set 101 --netif_add eth1

The settings of the newly created virtual adapter are saved as the value of the NETIF parameter in the configuration file of Container 101 (/etc/vz/conf/101.conf). So, you can use the following command to display the parameters assigned to the veth network adapter in Container 101:

# grep NETIF /etc/vz/conf/101.conf

NETIF="ifname=eth1,mac=00:10:41:F0:AA:B6,host_mac=00:18:51:A0:8A:D7"

As you can see, the parameters set for the veth virtual network adapter during its creation are the following:

  • ifname: the name set for the veth Ethernet interface in Container 101. You specified this name when creating the Container virtual network adapter. Usually, names of Ethernet interfaces in Containers are set in the form of ethAd_N where Ad_N denotes the index number of the created adapter (for example, eth0 or eth1). However, you can choose any other name you like and specify it during the virtual adapter creation.
  • mac: the MAC address assigned to the veth Ethernet interface in Container 101.
  • host_mac: the MAC address assigned to the veth Ethernet interface on the host.

ifname is the only mandatory parameter that you need to specify when creating a Container virtual network adapter. All the other parameters are optional and generated by Virtuozzo automatically, if not indicated.

At any time, you can remove the veth virtual network adapter from Container 101 by executing the following command:

# prlctl set 101 --netif_del eth1