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. _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users