Many large data-centers use PtP routing or next-hop. A virtual machine is assigned only one IP address by mask 255.255.255.255 (or /32). This allows saving IPv4 addresses, as common routing requires at least 4 IPv4 addresses: a network address, gateway address, host address, and broadcasting address.

During the installation process, a virtual machine is assigned an IP address and downloads the installation packages from the Internet. By default, you should use the default gateway which lays in the same broadcast domain. This article describes what parameters you need to add into the VMmanager configuration file to configure the network in a data-center with point-to-point routing.

Note.

Before you start, you need to disable NetworkManager:

service NetworkManager stop
service NetworkManager disable 
CODE

Adding an IP address to install a virtual machine


Specify the type of temporary IP addresses so that a virtual machine is assigned a specific address during setup. To specify the type, add the following parameter into the VMmanager configuration file: /usr/local/mgr5/etc/vmmgr.conf:

TempIpType <IP type>
BASH

Example:

TempIpType temp
BASH

Add this type of temporary IP addresses into the IP pool either in IPmanager or into the local pool of IP addresses.

You can add a new type of IP address directly in IPmanager.

Complete the following steps to add IP types into the local pool:

  1. Connect to the local pool of IP address:

    sqlite3 /usr/local/mgr5/etc/vmmgr_ipdb.db
    BASH
  2. Find the id o the last record:

    select max(id) from ranges;
    BASH
  3. Add your range with the next ID. Eg., for the range 10.38.200.2-10.38.200.254 with the mask 255.255.255.0, gateway 10.38.200.1, ID 22 and type temp:

    insert into ranges (id, name, gateway, netmask, family, type) values ('22', '10.38.200.2-10.38.200.254', '10.38.200.1', '255.255.255.0', '2', 'temp');
    BASH
  4. For correct operation make sure the gateway is accessible for the virtual machine being installed. Also, check that you can access the Internet from this IP.:
    1. To add the IP to the interface, edit the file /etc/sysconfig/network-scripts/ifcfg-vmbr0. In the general case for this example we need to add::

      IPADDR#="10.38.200.1"
      NETMASK#="255.255.255.0"
      BASH

      # — the next counting order of IPv4-address (IPADDR -> IPADDR1 -> IPADDR2 -> ...).

    2. To set up address translation, edit the /etc/sysconfig/iptables file and add the following record into the *nat chain:

      -A POSTROUTING -s 10.38.200.0/24 ! -d 10.38.200.1/32 -o vmbr0 -j MASQUERADE
      BASH
    3. Allow forward on the interface:

      sudo echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
      sysctl -p
      BASH
    4. Restart iptables:

      service iptables restart
      BASH

Adding PtP routing IP address


Add following parameter of the configuration file  /usr/local/mgr5/etc/vmmgr.conf to assign a virtual machine the IP address with the mask 255.255.255.255 (/32) and routers through a specific remote IP:

NextHopIPv4 <Gateway IP address>
BASH

Restart the panel:

/usr/local/mgr5/sbin/mgrctl -m vmmgr exit
BASH

These settings are enough for the successfull setup of the virtual machine and network configuration.

Completing the configuration process


Restart the service network to apply the new settings: 

service network restart
CODE