<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div>Hi,<br><br></div>Can someone share me sample java code for assigning IP address for VM on eth0 through Java SDK via CloudInit ?<span class=""></span><br></div><div>
<br></div><div><u><b>Something Like this but in Java:</b></u><br></div><div><pre>&lt;network_configuration&gt;
         &lt;nics&gt;
           &lt;nic&gt;
             &lt;name&gt;eth0&lt;/name&gt;
             &lt;boot_protocol&gt;STATIC&lt;/boot_protocol&gt;
             &lt;network&gt;
               &lt;ip address=&quot;192.168.2.11&quot; netmask=&quot;255.255.0.0&quot; gateway=&quot;192.168.2.1&quot; /&gt;
             &lt;/network&gt;
             &lt;on_boot&gt;true&lt;/on_boot&gt;
           &lt;/nic&gt;
           &lt;nic&gt;
             &lt;name&gt;eth1&lt;/name&gt;
             &lt;boot_protocol&gt;DHCP&lt;/boot_protocol&gt;
           &lt;/nic&gt;
           &lt;nic&gt;
             &lt;name&gt;eth2&lt;/name&gt;
             &lt;boot_protocol&gt;NONE&lt;/boot_protocol&gt;
             &lt;on_boot&gt;true&lt;/on_boot&gt;
           &lt;/nic&gt;
         &lt;/nics&gt;
         &lt;dns&gt;
           &lt;servers&gt;
             &lt;host&gt;
               &lt;address&gt;1.1.2.2&lt;/address&gt;
             &lt;/host&gt;
             &lt;host&gt;
               &lt;address&gt;1.2.3.4&lt;/address&gt;
             &lt;/host&gt;
           &lt;/servers&gt;
           &lt;search_domains&gt;
             &lt;host&gt;
               &lt;address&gt;qa.lab&lt;/address&gt;
             &lt;/host&gt;
             &lt;host&gt;
               &lt;address&gt;<a href="http://google.com">google.com</a>&lt;/address&gt;
             &lt;/host&gt;
           &lt;/search_domains&gt;
         &lt;/dns&gt;
       &lt;/network_configuration&gt;</pre><br><br><br></div><div dir="ltr">-- <br><span class=""></span><span class=""></span></div></div><div>Thanks &amp; Regards</div>
<div>Tejesh</div>
</div>