KVM, LXC, OpenVZ 7 and XEN
Login to command line console as root and follow below steps on host where you want internal network with working Internet access:
Create internal network (eg network and bridge name: HAProxy) on the host
Navigate to /etc/libvirt/qemu/networks
Create a new xml file with network_name (eg HAProxy) as filename and with following content:
<network>
<name>HAProxy</name>
<forward mode='nat'/>
<bridge name='HAProxy' stp='on' delay='0' />
<ip address='10.0.0.1' netmask='255.0.0.0'>
</ip>
</network>
Define this network by running following command:
virsh net-define /etc/libvirt/qemu/networks/HAProxy.xml
Set to auto start this network by running following command (replace network name HAProxy with the one you created in below command):
virsh net-autostart HAProxy
Start this network by running following command (replace network name HAProxy with the one you created in below command):
virsh net-start HAProxy
Now create an IP Pool with internal network details through Virtualizor Admin Panel:
Navigate to Admin Panel > IP Pool > Create IP Pool
Select the server where you have setup the internal network
Provide a meaningful name for this pool
Set according to our example network:
Gateway to: 10.0.0.1
Netmask to: 255.0.0.0
Nameserver 1: 8.8.8.8
Nameserver 2: 8.8.4.4
First IP: 10.0.0.2
Last IP: 10.0.0.50
Enable VLAN: checked
VLAN Bridge: BRIDGE_NAME you set when creating it (HAProxy)
Click "Add IP Pool" to save the new pool
Create VPS with any one of the IPs in the above IP range. The VPS will have a working internet access
Done!
From the VPS I can ping:
# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=5.30 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=5.43 ms
On the other hand if I do a ping on www.google.fr (or any other domain name it does not work).
# ping www.google.com
Ping: www.google.fr: Temporary failure in name resolution
I thought it was from the DNS but
# cat /etc/resolv.conf
nameserver 4.2.2.1
nameserver 4.2.2.2