2nd Public IP Address KVM

Ben McGuire

Member
Sep 14, 2016
30
1
6
Hello

We need to add a second and third public IP to a KVM Virtual Machine but we havent found a way to do this as we use OVH .

When we setup the VM we had to do all the networking manually as OVH uses a gateway in a different subnet.

We configured eth0 and can ping 8.8.8.8 but google.com does not work. We know its because of the nameservers but these are not working.

Firstly how do we add additional IPs to the VM and how to we get the nameservers to stick in the resolv.conf as once we reboot the server they are removed. Also we added them ti the interfaces file but it looks like thye do not do much.

I have posted the current /etc/network/interfaces file below. Also we added dditioanl NIC as OVH requires virtual macs assigned to each IP in our to route.

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address XXX.XXX.XXX.220
netmask 255.255.255.255
nameservers 8.8.8.8 8.8.4.4
post-up ip route add xxx.xxx.216.254 dev eth0
post-up ip route add default via xxx.xxx.216.254
post-down ip route del 149.202.216.254 dev eth0
post-down ip route del default via xxx.xxx.216.254
auto eth1
iface eth1 inet static
address xxx.xxx.xxx.212
netmask 255.255.255.255
nameservers 8.8.8.8 8.8.4.4
post-up ip route add xxx.xxx.216.254 dev eth0
post-up ip route add default via xxx.xxx.216.254
post-down ip route del xxx.xxx.216.254 dev eth0
post-down ip route del default via xxx.xxx.216.254
 
I have not much experience, but by default i am petty sure you should be able to set up the extra block of IP's in a kvm install with google nameservers, just use bridged mode to your physical NIC on every new VM, Every IP is routed to the server NIC and can be accessed by VM's without issue. I think even containers allow you to use bridged connection and configure any IP and gateway you like as long as they have been routed. I have my server on one IP, and VM's configured to use a separate block of 13 IP's. And this works fine. OVH are one of the better known dedicated server providers that allow for this. But there are many others that allow multiple IP addresses allocated to a single NIC and IPMI installations.. Then you just need to configure your firewalls and rules and such things internally.
 
nano /etc/network/interfaces
auto lo
iface lo inet loopback

auto vmbr0
iface vmbr0 inet static
address xx.xx.xx.xx
netmask xxx.xxx.xxx.xxx
gateway xx.xx.xx.xx
bridge_ports eth0
bridge_stp off
bridge_fd 0


When you create a VM in bridged mode and input the information relative to the allocated block (provided by ISP), you should then see tap(vmid)io if you run ifconfig
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!