Friday, September 15, 2017

CentOS 6 7 Network Card and VMware ESXi Template

CentOS 6 7 Network Card and VMware ESXi Template


Having a CentOS template in a VMware ESXi environment is not like having a Windows Server template when it comes to networking. There are a few gotchas to getting the network card to function after deploying from a template. This KB  from VMware was helpful in detailing what was needed to get the recently deployed template connected to the network.

Because a templates MAC address changes and the CentOS does not update it automatically we need to get the new address. To do this, right click on the virtual machine and go to "Edit Settings" in the "Network Adapter 1" you will find the new MAC address, make note of the last two octets and open the console of the virtual machine. Now youll need to edit the ifcfg-eth0 configuration file with either vi or nano. My machine only has vi installed. This is located here:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

edit the HWADDR to reflect the new MAC address, save the file and exit.

The next step is to edit the 70-persistent-rules file. This is another configuration file for the network interfaces in CentOS. To edit the file:

vi /etc/udev/rules.d/70-persistent-net.rules

On my virtual machine there were three lines with an eth0 configuration. I removed all but the one that was current with the new MAC address, which is usually the one at the end of the file. After editing, the file was saved and the virtual machine was rebooted. When logging in, the new network card was up and connected to the network.