5.4.3.2. Configuring Virtual Adapter Parameters

OpenVZ allows you to configure the following parameters of virtual machine adapters:

Configuring MAC Addresses

If you need for some reason to regenerate the current MAC address of a network adapter, you can use the following command:

# prlctl set MyVM --device-set net1 --mac 00:1C:42:2D:74:00
Creating net1 (+) network=Bridged mac=001C422D7400
The VM has been successfully configured.

This command sets the MAC address of 00:1C:42:2D:74:00 for the net1 adapter in the virtual machine MyVM. If do not know what MAC address to assign to your virtual adapter, you can make prlctl set automatically generate a new MAC address. To do this, run the following command:

# prlctl set MyVM --device-set net1 --mac auto
Creating net1 (+) network=Bridged mac=001C42C84F3E
The VM has been successfully configured.

Configuring IP Parameters

As any other standalone server, each virtual machine must have a number of TCP/IP settings configured in the proper way to successfully operate on the network. These settings include:

  • IP address
  • default gateway
  • DNS server

Usually, you define all these settings when you create the virtual machine. However, if you have not yet set any of the settings or want to modify any of them, you can use the prlctl set command. For example, you can execute the following command to assign the IP address of 192.129.129.20 to the net1 adapter in the virtual machine MyVM, set the default gateway to 192.129.129.1 and the DNS server to 192.192.192.10:

# prlctl set MyVM --device-set net1 --ipadd 192.129.129.20 --gw 192.129.129.1 \
--nameserver 192.192.192.10

Along with a static assignment of network parameters to a virtual adapter, you can make the adapter receive its TCP/IP settings automatically using the Dynamic Host Configuration Protocol (DHCP). For example, you can run this command to make the net1 adapter in the virtual machine MyVM get its IP settings through DHCP:

# prlctl set MyVM --device-set net1 --dhcp yes
Creating net1 (+) network=Bridged mac=001C42C84F3E
Enable automatic reconfiguration for this network adapter.
The VM has been successfully configured.

Note

Note: You can configure the network parameters only of those virtual machines that have OpenVZ guest tools installed.