VMware Cloud Community
peterdabr
Hot Shot
Hot Shot

Secondary IPs for VMs in vCloud Director

Hi All,

I have a question regarding assignment of secondary IP addresses to the same nic interface for VMs in vCD (I'm on 5.1).

My understanding is that vCloud Director UI does not offer functionality to assign multiple IP addresses to the same nic interfaces.

For certain configurations, multiple IPs from the same network on a single NIC is a neccessity to get things running properly. I've tried setting up secondary IPs from within OS in ifcfg-eth scripts on linux and adding secondary IPs to the interface on Windows, but vCD's behavior  is pretty much the same all across various OS's: when guest customization runs (which is pretty much every time VM is powered on after making neworking or hardware changes), vCD removes all secondary IPs that it doesn't know about.

As a workaround, we've been disabling guest custmization on all VMs that have secondary IPs (from an IP range outside of the one defined in vCD) but it is error prone as any hardware change prompts end-user with a popup message "Enable guest customization?" to which 'yes' can mistakenly be chosen, essentially  causing secondary IPs to be removed by vCD.

Another option I was contemplating was handling secondary IPs through vApp/VM->'Guest Properties' customization but it is really not scalable as it would require API calls to set the custom properties and then have custom script to pull the values using VMware Tools. Awful lot of work.

Does anybody have any thoughts on how to best handle secondary IPs for VMs in vCD?

Thanks

Peter

Reply
0 Kudos
3 Replies
aneverov
VMware Employee
VMware Employee

Hi Peter,

I think you summarized it very well. OVF properties + post-customization script would be the best available option.

For Linux, you do have an alternative - to change customization scripts (written mostly in shell) to handle your particular setup. For Windows you can't do that as easy, because it's done by binary. You would have to have one which adheres to our internal protocol. It's possible, but not obvious. I would only go this way if you want to preserve some other things in files we generate/override.

So, I think it will be even more work + you still have to provide IP addresses in some way (again OVF properties). But that's usually the case when someone hits design limitation. Actually, there is no that much code needed in the post-customization script to make things work. You can see how it's done for Linux in $VCLOUD_HOME/guestcustomization/unix/customize-guest.sh.

/Andrii

/* Please remember to mark answer as 'helpful' or 'correct' such that other users know it can be used and people focusing on ‘unanswered’ questions can skip it. */
peterdabr
Hot Shot
Hot Shot

Thank you Andrii. I very much appreciate your valuable input.

"For Linux, you do have an alternative to change customization scripts (...)" -if you're referring to customize-guest.sh script on vCD cell, it'd be a global change that would apply to all tenants within the same vCD instance. Not sure if I want to go that route...
The only two remaining options based on your input and my research would be:
#1 vCloud API call to create Guest Properties on a VM, provide secondary IP values there and finally use post-customization script which pulls values
using vmware tools
#2 Use 'Guest OS Customization' -'Customization script' to apply secondary IPs during postcustomization, as decribed here:

Question: which script in Linux guest OS handles post-customization tasks? Is it /root/.customization/post-customize-guest.sh that I would need to modify? How about the name of the post-customization script in Windows guest?

PeterD

Reply
0 Kudos
aneverov
VMware Employee
VMware Employee

Hi Peter,

> if you're referring to customize-guest.sh script on vCD cell,  it'd be a global change that would apply to all tenants within the same  vCD instance. Not sure if I want to go that route...

It depends on your use-case. If you can't use pre-/post-customization scripts for some reason (like users may be expected to provide their own one), that might be the only option. But you're right that's definitely a heavy artillery Smiley Wink

> #1 vCloud API call to create Guest Properties on a VM, provide  secondary IP values there and finally use post-customization script  which pulls values
using vmware tools
Yes, I could only add that another way is to put these properties into ProductSection of the OVF before uploading it to vCloud. But it again depends on your use-case.
> #2 Use 'Guest OS Customization' -'Customization script' to apply secondary IPs during postcustomization, as decribed here:
Yes.
> Question: which script in Linux guest OS handles post-customization  tasks? Is it /root/.customization/post-customize-guest.sh that I would  need to modify? How about the name of the post-customization script in  Windows guest?
You don't need to modify anything in the guest. Script is provided via UI (VM > Properties > Guest OS Customization tab > Customization script) or API (GuestCustomizationSection > CustomizationScript element.
/root/.customization/post-customize-guest.sh is implementation detail. It's the way we use to invoke post-customization (the "pre-" one is executed at the beginning of customization process) after the last reboot. It's registered in /etc/rc.local on some OSes. It will get overriden next time somebody provides different post-customization script. On other OSes (SLES) we actually don't do that and register it as "service". Maybe I should have done that for RHEL too, but there is always room for improvement Smiley Wink On Windows post-customization runs as scheduled Windows Task.
Hope that helps.
/Andrii
/* Please remember to mark answer as 'helpful' or 'correct' such that other users know it can be used and people focusing on ‘unanswered’ questions can skip it. */
Reply
0 Kudos