All virtual machines connected to networks of the host-only type receive their IP addresses from the DHCP server. This DHCP server is set up during the OpenVZ installation and includes by default IP addresses from 10.37.130.1 to 10.37.130.254. You can redefine the default IP address range for host-only networks and make virtual machines get their IP addresses from different IP address ranges. For example, you can run the following command to set the start and end IP addresses for the Host-Only
network (this network is automatically created during the OpenVZ installation) to 10.10.11.1 and 10.10.11.254, respectively:
# prlsrvctl net set Host-Only --ip-scope-start 10.10.11.1 --ip-scope-end 10.10.11.254
You can also specify a custom IP address range directly when creating a new network of the host-only type. Assuming that you want to create a network with the Host-Only2
name and define for this network the IP addresses range from 10.10.10.1 to 10.10.10.254, you can execute the following command:
# prlsrvctl net add Host-Only2 -t host-only --ip-scope-start 10.10.10.1 --ip-scope-\
end 10.10.10.254
When working with IP address ranges, pay attention to the following:
- The start and end IP addresses of an IP address range must belong to the same subnetwork.
-
IP address ranges can be defined for each network of the host-only type separately. For example, you can set the IP address range from 10.10.11.1 to 10.10.11.254 for the
Host-Only
network and from 10.10.10.1 to 10.10.10.254 for theHost-Only2
network.