We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

Assigning multiple IPs to a KVM instance


jayk806
2016-04-07, 07:31 PM
I figured this out a few days ago. I posted about the solution in this thread: https://forum.ovh.us/showthread.php/...o-make-it-work

Jay

HTMLtag
2016-03-24, 03:20 AM
Maybe this will help. This is for Debian/Ubuntu based distros, but it can help.
Both VMacs are set to the same MAC address.
The biggest thing that helps is setting the routes.
The DNS servers are also assigned in resolv.conf.


Template:
Code:
# The loopback network interface
auto lo
iface lo inet loopback


auto eth0
iface eth0 inet static
        address 
        netmask 255.255.255.255
        broadcast 
        dns-nameservers 8.8.8.8 8.8.4.4

        post-up route add 
.254 dev eth0 post-up route add default gw
.254 post-down route del
.254 dev eth0 post-down route del default gw
.254 auto eth0:0 iface eth0:0 inet static address netmask 255.255.255.255 broadcast
Example:
Code:
# The loopback network interface
auto lo
iface lo inet loopback


auto eth0
iface eth0 inet static
        address 192.58.206.62
        netmask 255.255.255.255
        broadcast 192.58.206.62
        dns-nameservers 8.8.8.8 8.8.4.4

        post-up route add 192.97.33.254 dev eth0
        post-up route add default gw 192.97.33.254
        post-down route del 192.97.33.254 dev eth0
        post-down route del default gw 192.97.33.254

auto eth0:0
iface eth0:0 inet static
        address 192.138.212.227
        netmask 255.255.255.255
        broadcast 192.138.212.227

FredQc
2016-03-21, 09:04 PM
Quote Originally Posted by WebHostingNeeds
Did you set VMAC for other IP ? When adding vMAC for 2nd IP, you have option to use existing vMAC, so select same vMAC as main IP. NETMASK should be 255.255.255.255
What I said:
Each IP has a vMAC assigned in the OVH Manager AND Virtualizor.
And yes, I tried 255.255.255.255 for the netmask and no success.

WebHostingNeeds
2016-03-19, 02:43 AM
Did you set VMAC for other IP ? When adding vMAC for 2nd IP, you have option to use existing vMAC, so select same vMAC as main IP. NETMASK should be 255.255.255.255

FredQc
2016-03-18, 01:31 PM
I have a Host-32H and installed KVM for Virtualizor on it., since OpenVz won't work with 10Gbps cards. Now, getting the IPs to work in the VMs are a real pain in the ass, but finally managed to do it with virtual MACs. Now, my problem is, how to add more IPs to a VM ? Each IP has a vMAC assigned in the OVH Manager AND Virtualizor. When bringing up the eth0:0 I'm getting the message:

Code:
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining if ip address xxx.xxx.xxx.aaa is already in use for device eth0...
Determining if ip address xxx.xxx.xxx.bbb is already in use for device eth0...
SIOCADDRT: Network is unreachable
                                                           [  OK  ]
Content of ifcfg-eth0:

Code:
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=xxx.xxx.xxx.xxx
NETMASK=255.255.255.0
GATEWAY=aaa.aaa.aaa.254
Content of ifcfg-eth0:0 generated by Virtualizor:

Code:
DEVICE=eth0:0
BOOTPROTO=static
ONBOOT=yes
IPADDR=xxx.xxx.xxx.bbb
NETMASK=255.255.255.0
The VM first IP is pingnable fro the outside world but not the other, how do I make it work ?

This is so frustrating...