Multiple ips to a single nic

Hi All, I would like to add multiple ips to a single nic using the ovirt api function. Is it possible to assign multiple ips to a single nic using the ovirt api ? -- Regards Shanil

----- Original Message -----
From: "Shanil S" <xielesshanil@gmail.com> To: users@ovirt.org, "Juan Hernandez" <jhernand@redhat.com> Cc: ahadas@redhat.com Sent: Tuesday, September 16, 2014 11:46:38 AM Subject: [ovirt-users] Multiple ips to a single nic
Hi All,
I would like to add multiple ips to a single nic using the ovirt api function. Is it possible to assign multiple ips to a single nic using the ovirt api ?
I made a draft (means written but not really tested) vdsm hook for doing this. Look at the readme for usage and report any issue you encounter. With your help we can iron out issues and merge it ;-) http://gerrit.ovirt.org/#/c/29738/
-- Regards Shanil
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

----- Original Message -----
From: "Antoni Segura Puimedon" <asegurap@redhat.com> To: "Shanil S" <xielesshanil@gmail.com> Cc: users@ovirt.org Sent: Tuesday, September 16, 2014 1:28:51 PM Subject: Re: [ovirt-users] Multiple ips to a single nic
----- Original Message -----
From: "Shanil S" <xielesshanil@gmail.com> To: users@ovirt.org, "Juan Hernandez" <jhernand@redhat.com> Cc: ahadas@redhat.com Sent: Tuesday, September 16, 2014 11:46:38 AM Subject: [ovirt-users] Multiple ips to a single nic
Hi All,
I would like to add multiple ips to a single nic using the ovirt api function. Is it possible to assign multiple ips to a single nic using the ovirt api ?
I made a draft (means written but not really tested) vdsm hook for doing this. Look at the readme for usage and report any issue you encounter. With your help we can iron out issues and merge it ;-)
I'm not sure the intention was for a host nic. Shanil could you confirm if you desire to configure ip for a vm (cloud-init ?) or for the host ?
http://gerrit.ovirt.org/#/c/29738/
-- Regards Shanil
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

On Tue, Sep 16, 2014 at 08:31:49AM -0400, Moti Asayag wrote:
Hi All,
I would like to add multiple ips to a single nic using the ovirt api function. Is it possible to assign multiple ips to a single nic using the ovirt api ?
I made a draft (means written but not really tested) vdsm hook for doing this. Look at the readme for usage and report any issue you encounter. With your help we can iron out issues and merge it ;-)
I'm not sure the intention was for a host nic. Shanil could you confirm if you desire to configure ip for a vm (cloud-init ?) or for the host ?
FWIW, we have a recent RFE for host-side multiple IPv4 addresses https://bugzilla.redhat.com/show_bug.cgi?id=1140245 If you want it included on ovirt-3.6 this is the time to advocate for it on Itamar's thread. Dan.

On 09/16/2014 11:46 AM, Shanil S wrote:
Hi All,
I would like to add multiple ips to a single nic using the ovirt api function. Is it possible to assign multiple ips to a single nic using the ovirt api ?
Remember that you can't set any IP configuration of a network interface from outside the guest, so you need to use cloud-init or similar. With cloud-init you can use the "nic" element several times, using names like eth0:0, eth0:1, etc: <action> <vm> <initialization> <cloud_init> <network_configuration> <nics> <nic> <name>eth0</name> <boot_protocol>static</boot_protocol> <network> <ip address="192.168.122.31" netmask="255.255.255" gateway="192.168.122.1"/> </network> <on_boot>true</on_boot> </nic> <nic> <name>eth0:0</name> <boot_protocol>static</boot_protocol> <network> <ip address="192.168.122.32" netmask="255.255.255.0" gateway="192.168.122.1"/> </network> <on_boot>true</on_boot> </nic> <nic> <name>eth0:1</name> <boot_protocol>static</boot_protocol> <network> <ip address="192.168.122.33" netmask="255.255.255.0" gateway="192.168.122.1"/> </network> <on_boot>true</on_boot> </nic> </nics> </network_configuration> </cloud_init> </initialization> </vm> </action> This will produce a network configuration file like this: iface eth0 inet static address 192.168.122.31 netmask 255.255.255 gateway 192.168.122.1 iface eth0:0 inet static address 192.168.122.32 netmask 255.255.255.0 gateway 192.168.122.1 iface eth0:1 inet static address 192.168.122.33 netmask 255.255.255.0 gateway 192.168.122.1 auto eth0 eth0:0 eth0:1 Cloud-init should then translate that into the correct configuration within the host. It should work correctly in RHEL/Fedora, but I guess this isn't a contract of cloud-init, so it may fail in other distros or in future versions. Anyhow, you may consider adding multiple network interfaces to the VM, instead of multiple IPs in the same interface. They don't cost anything and give you more flexibility if you want to physically separate networks. -- Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta 3ºD, 28016 Madrid, Spain Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.

Hi Juan, Okay.. Thanks.. i will check it with your solution. -- Regards Shanil On Tue, Sep 16, 2014 at 8:23 PM, Juan Hernandez <jhernand@redhat.com> wrote:
On 09/16/2014 11:46 AM, Shanil S wrote:
Hi All,
I would like to add multiple ips to a single nic using the ovirt api function. Is it possible to assign multiple ips to a single nic using the ovirt api ?
Remember that you can't set any IP configuration of a network interface from outside the guest, so you need to use cloud-init or similar. With cloud-init you can use the "nic" element several times, using names like eth0:0, eth0:1, etc:
<action> <vm> <initialization> <cloud_init> <network_configuration> <nics> <nic> <name>eth0</name> <boot_protocol>static</boot_protocol> <network> <ip address="192.168.122.31" netmask="255.255.255" gateway="192.168.122.1"/> </network> <on_boot>true</on_boot> </nic> <nic> <name>eth0:0</name> <boot_protocol>static</boot_protocol> <network> <ip address="192.168.122.32" netmask="255.255.255.0" gateway="192.168.122.1"/> </network> <on_boot>true</on_boot> </nic> <nic> <name>eth0:1</name> <boot_protocol>static</boot_protocol> <network> <ip address="192.168.122.33" netmask="255.255.255.0" gateway="192.168.122.1"/> </network> <on_boot>true</on_boot> </nic> </nics> </network_configuration> </cloud_init> </initialization> </vm> </action>
This will produce a network configuration file like this:
iface eth0 inet static address 192.168.122.31 netmask 255.255.255 gateway 192.168.122.1 iface eth0:0 inet static address 192.168.122.32 netmask 255.255.255.0 gateway 192.168.122.1 iface eth0:1 inet static address 192.168.122.33 netmask 255.255.255.0 gateway 192.168.122.1 auto eth0 eth0:0 eth0:1
Cloud-init should then translate that into the correct configuration within the host. It should work correctly in RHEL/Fedora, but I guess this isn't a contract of cloud-init, so it may fail in other distros or in future versions.
Anyhow, you may consider adding multiple network interfaces to the VM, instead of multiple IPs in the same interface. They don't cost anything and give you more flexibility if you want to physically separate networks.
-- Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta 3ºD, 28016 Madrid, Spain Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
participants (5)
-
Antoni Segura Puimedon
-
Dan Kenigsberg
-
Juan Hernandez
-
Moti Asayag
-
Shanil S