Configuring Virtual Machines and Containers in Host-Routed Mode
You can configure the following parameters of network adapters that operate in the host-routed mode:
- IP addresses and network masks
- DNS servers
- DNS search domains
Setting IP addresses
The session below shows how to set IP addresses for the MyVM virtual machine and Container 101
# prlctl set MyVM --device-set net0 --ipadd 10.0.186.100/24
# prlctl set MyVM --device-set net0 --ipadd 1fe80::20c:29ff:fe01:fb07
# prlctl set 101 --ipadd 10.0.186.101/24
# prlctl set 101 --ipadd fe80::20c:29ff:fe01:fb08
net0 in the commands above denotes the network card in the VM virtual machine to assign the IP address to. You can view all network cards of a virtual machine using the prlctl list VM_name -i command. For Container 101, you do not need to specify the network card name; prlctl set automatically performs the operation on the default adapter that always operates in the host-routed mode.
Setting DNS server addresses
To set a DNS server for the MyVM virtual machine and Container 101, you can use the following commands.
# prlctl set MyVM --device-set net0 --nameserver 192.168.1.165
# prlctl set 101 --nameserver 192.168.1.165
Setting DNS search domains
To set a DNS search domain for the MyVM virtual machine and Container 101, run these commands:
# prlctl set MyVM --device-set net0 --searchdomain 192.168.10.10
# prlctl set 101 --searchdomain 192.168.10.10
Notes:
1. You can configure the network settings only of virtual machines that have guest tools installed.
2. Network adapters operating in the routed mode must have at least one static IP address assigned.
3. To assign network masks to Containers operating in the venet0 networking mode, you must set the USE_VENET_MASK parameter in the /etc/vz/vz.conf configuration file to yes .
4. Containers can have only one network adapter operating in the host-routed mode. This adapter is automatically created when you create a virtual machine.
Switching virtual machine adapters to host-routed mode
By default, a virtual adapter in any newly created virtual machine starts operating in connected to the bridged mode (see the Connecting Virtual Machines to Virtual Networks for details). To change the current network mode to host-routed, you can run the following command:
# prlctl set VM_Name --device-set Net_ID --type routed
For example, to set the net0 adapter in the MyVM virtual machine to operate in the host-routed mode, use this command:
# prlctl set MyVM --device-set net0 --type routed
|