2.2.3. Configuring Network Settings

To make virtual machines and containers accessible from the network, you need to assign valid IP addresses to them and configure DNS servers. The session below illustrates setting these parameters for the virtual machine MyVM and the container MyCT:

  • Assigning IPv4 and IPv6 addresses:

    # 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 MyCT --ipadd 10.0.186.101/24
    # prlctl set MyCT --ipadd fe80::20c:29ff:fe01:fb08

    net0 in the commands above denotes the network card in the 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.

  • Setting DNS server addresses:

    # prlctl set MyVM --nameserver 192.168.1.165
    # prlctl set MyCT --nameserver 192.168.1.165

    Note

    Notes:

    1. You can configure the network settings only for virtual machines that have OpenVZ guest tools installed.
    2. To assign network masks to containers operating in the venet0 network mode, you must set the USE_VENET_MASK parameter in the /etc/vz/vz.conf configuration file to yes.