Tuesday, October 9, 2012

Dealing with network connections on Linux VM templates in Lab Manager



So you have a VM template you are pulling into a configuration, and each time you do you frustratingly end up with eth1 instead of eth0 for your default interface.  Here is the solution and what is going on.



Start the VM as a template, configure it.  Then once you are done  be sure to run these commands as the last thing you do then shut the system down.

sudo rm –f /etc/udev/rules.d/70-persistent-net.rules
sudo rm –f /etc/sysconfig/network-scripts/ifcfg-eth*


You can now shutdown, undeploy, and publish the template.

The issue is with the hardware regeneration of MAC addresses when you create a VM based on this template in your configuration.  The new MAC is detected as a new interface on boot so the system creates new interface configuration files but has the old ones left as well. 

So if you ever fire up that template in the future to make changes just keep in mind that you will need to run these again before you shut down.  I like to keep a script on my CentOS templates to take care of this.

vCenter Lab Manager 4.0 (4.0.2.1269)

1 comment:

  1. Hi, nice post. This is an interesting and very informative topic. Thanks for sharing your ideas.
    pogo games technical support phone number usa

    ReplyDelete

Let us know if you found anything helpful, or have an even better solution. Thanks for your participation in the discussion.