Setting Up Private NetworksBefore you start setting up a private network, you need to decide on the following:
Let us assume that you want to create two private networks with the following parameters:
To create these two networks, you can run the following commands on the physical server: # prlsrvctl privnet add privnet1 --ipadd 10.10.0.0/16 # prlsrvctl privnet add privnet2 --ipadd 10.11.0.0/16 Now if you assign to one virtual machine or Container an IP address from the range 10.10.0.0 through 10.10.255.255 and to another virtual machine or Container from the range 10.11.0.0 through 10.11.255.255, they will not be able to access each other because they will belong to different private networks. If you want to create a private network for several virtual machines and Containers only, you can omit the network mask and specify only the required IP addresses: # prlsrvctl privnet add privnet3 --ipadd 10.12.0.101 # prlsrvctl privnet add privnet3 --ipadd 10.12.0.102
The commands above create the private network
Enabling Private Networks for virtual machines and Containers Operating in Virtual Network Mode
By default, you can include in private networks only virtual machines and Containers operating in the host-routed mode. If you want to connect to a private network some of virtual machines and Containers operating in the virtual network mode, you need first to enable the private network support on the physical server. To do this, change the value in the
# echo 1 > /proc/sys/net/vzpriv_handle_bridge Note: Enabling the support for private networks may affect the network performance of virtual machines and Containers that operate in the virtual network mode and are assigned IPv4 addresses. Creating Weak Private Networks In a weak private network, any virtual machine or Container on the network can communicate with the other virtual machines and Containers in the same subnet, virtual machines and Containers outside the private network, and computers on external networks. To create a weak private network, you can run the following command:
# prlsrvctl privnet set
where
# prlsrvctl privnet set privnet1 --ipadd '*'
To make sure that
# cat /proc/vz/privnet/sparse 1: * 10.10.0.0/16 2: 10.11.0.0/16
The asterisk before
# prlsrvctl privnet set privnet1 --ipdel '*' Connecting virtual machines and Containers to Private Subnets
Once you set up a private network, you can connect Containers to different subnets within this network. Assuming that you followed the instructions above, you now have two private networks. The
Now Container 101 and the
Removing Private Networks
At any time, you can remove
# prlsrvctl privnet del privnet1 # prlsrvctl privnet del privnet2
Once you execute these commands, all virtual machines and Containers that were included in the
|
||||
|