Assign multiple IPs to a VM

Hello all!

I appreciate all your help! I’m back with a new one. I have an IP range defined in Virtual Networking, and I’m using OpenVSwitch.

The first IP, first nic, works fine on the server. I want a VM to have multiple IPs, so I assigned multiple public NICs out of the public “pool”. The second nic though doesn’t seem to respond at all to pings or anything else. I looked at the logs, and the OVS seemed to create the flow properly. I’m not sure why it’s misbehaving.

Thanks!

Try to reboot the VM. The guest operating system has to configure the IP (e.g. with Ubuntu/Debian in the /etc/network/interfaces) and in your case, this is probably done using contextualization.

However, I’m not sure if network contextualization handles multiple NICs, so you might want to modify the /etc/network/interfaces manually and remove the one-context package, so it won’t overwrite your changes. Then, reboot the VM or try “ifup eth1”.

Be aware that after removing one-context, the contextualization won’t work anymore, i.e. you will have to change the IP and ssh key settings on the VM manually. Actually I prefer this approach as I’m also having some issues with contextualization…

Hey :slight_smile:
Thanks, I’ll give this a try. I honestly don’t know if I’ve rebooted. I have checked all of the settings, and I’ve even manually configured the interfaces, but I don’t know about rebooting.

Thanks!

No, still didn’t seem to work. It appears to be loading the scripts properly. If I do public and private, it works fine. The issue seems to occur when I do two public. On public, I’m doing MAC spoofing filter, and IP spoofing filter, I wonder if this is having an unintended consequence.

Edit: I’m also having the same problem on the private side. IE, if I have a VM with:

Public 1
Public 2
Private 1
Private 2

Public 1 and Private 1 both work, but Public 2 and Private 2 do not.

Thanks!

I added an edit, but realized I hadn’t saved it.

I have also same issue for assign multiple 5 public ip on a vm using ip range in a single vnet. first interface working fine, and rest of all interfaces assigned ip’s not pinging.

For the temporary solution i had followed : the link to this tutorial

as it was for multiple addresses in the same subnet.

After that rebooted vm then all goes back.

Please suggest us…

Tested. Confirmed!

root@localhost:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 62.xxx.xxx.100 netmask 255.255.255.252 broadcast 62.xxx.xxx.103
inet6 fe80::3eff:fe95:1564 prefixlen 64 scopeid 0x20
ether 02:00:3e:95:15:64 txqueuelen 1000 (Ethernet)
RX packets 479 bytes 34118 (33.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 263 bytes 27335 (26.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 1362

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 62.xxx.xxx.101 netmask 255.255.255.252 broadcast 62.xxx.xxx.103
inet6 fe80::3eff:fe95:1565 prefixlen 64 scopeid 0x20
ether 02:00:3e:95:15:65 txqueuelen 1000 (Ethernet)
RX packets 230 bytes 11078 (10.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10 bytes 788 (788.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 62.xxx.xxx.102 netmask 255.255.255.252 broadcast 62.xxx.xxx.103
inet6 fe80::3eff:fe95:1566 prefixlen 64 scopeid 0x20
ether 02:00:3e:95:15:66 txqueuelen 1000 (Ethernet)
RX packets 230 bytes 11100 (10.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11 bytes 830 (830.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 62.xxx.xxx.103 netmask 255.255.255.252 broadcast 62.xxx.xxx.103
inet6 fe80::3eff:fe95:1567 prefixlen 64 scopeid 0x20
ether 02:00:3e:95:15:67 txqueuelen 1000 (Ethernet)
RX packets 225 bytes 10810 (10.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10 bytes 788 (788.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 62.xxx.xxx.104 netmask 255.255.255.252 broadcast 62.xxx.xxx.107
inet6 fe80::3eff:fe95:1568 prefixlen 64 scopeid 0x20
ether 02:00:3e:95:15:68 txqueuelen 1000 (Ethernet)
RX packets 237 bytes 11466 (11.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11 bytes 830 (830.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Why broadcast 62.xxx.xxx.103 and 62.xxx.xxx.107?

root@localhost:~# systemctl status networking
● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-12-19 09:28:53 UTC; 7s ago
Docs: man:interfaces(5)
Process: 875 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
Process: 872 ExecStartPre=/bin/sh -c [ “$CONFIGURE_INTERFACES” != “no” ] && [ -n “$(ifquery --read-environment --list --exclude=lo)” ] && udevadm settle (code=exited, status=0/SUCCESS)
Main PID: 875 (code=exited, status=1/FAILURE)

Dec 19 09:28:53 localhost ifup[875]: RTNETLINK answers: File exists
Dec 19 09:28:53 localhost ifup[875]: ifup: failed to bring up eth2
Dec 19 09:28:53 localhost ifup[875]: RTNETLINK answers: File exists
Dec 19 09:28:53 localhost ifup[875]: ifup: failed to bring up eth3
Dec 19 09:28:53 localhost ifup[875]: RTNETLINK answers: File exists
Dec 19 09:28:53 localhost ifup[875]: ifup: failed to bring up eth4
Dec 19 09:28:53 localhost systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Dec 19 09:28:53 localhost systemd[1]: Failed to start Raise network interfaces.
Dec 19 09:28:53 localhost systemd[1]: networking.service: Unit entered failed state.
Dec 19 09:28:53 localhost systemd[1]: networking.service: Failed with result ‘exit-code’.

Destination Gateway Genmask Flags Metric Ref Use Iface
default 62.xxx.xxx.1 0.0.0.0 UG 0 0 0 eth0
62.xxx.xxx.100 0.0.0.0 255.255.255.252 U 0 0 0 eth0
62.xxx.xxx.100 0.0.0.0 255.255.255.252 U 0 0 0 eth1
62.xxx.xxx.100 0.0.0.0 255.255.255.252 U 0 0 0 eth2
62.xxx.xxx.104 0.0.0.0 255.255.255.252 U 0 0 0 eth4

If you are using openvswitch driver, you have some openflow rules that prevent the use of IP outside the one assigned to your interface by OpenNebula. This is for security reason. I guess you can disable it, I’ve seen some option like IP_SPOOFING in one of opennebula config files. You can also check the openflow rules on your hypervisor.
Or just use an Ethernet AR.

I resolve problem in my Opennebula. Internet Provider give me wrong netmask. Now all work fine.