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