How to configure a network in data-centers with point-to-point routing

From ISPWiki
Jump to: navigation, search
Hierarchy: VMmanager KVM -> Networks
VMmanager Cloud -> Networks

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 to save 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 machines is assigned an IP address and downloads the installation packages from the Internet. By default, you should use 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.

Adding address for installing 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 <your type>

example

TempIpType temp

You need to add the same 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

2. Find the id o the last record:

select max(id) from ranges;

3. Add you 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');

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.

The easiest way is to assign the gateway IP to the vmbr0 interface and setup address translation.
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"
Note: change # into the next numerical order of IPv4 address (IPADDR -> IPADDR1 -> IPADDR2 -> ...)
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 -o vmbr0 -j MASQUERADE
Restart iptables:
systemctl iptables restart
In some occasions you need to allow forwrd on this interface (in the*filter chain):
-A FORWARD -i vmbr0 -o vmbr0 -j ACCEPT

Adding the PtP routing IP address

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

NextHopIPv4 <gateway IP address>

Restart the panel:

/usr/local/mgr5/sbin/core -m vmmgr exit

The above settings will help to install a virtual machine successfully and get correct network settings.