Tuesday, 19 January 2016

Changing The Network Adapter Type of A Virtual Machine Without Removing The NIC

Written by Suhas Savkoor



If we have a virtual machine with the NIC given to it as E1000 and we want to change this NIC to VMXNET3, then from the Edit Settings on the virtual machine we will select the Network adapter. Here you will notice that you do not have an option to change the Adapter Type.
The classic step we would follow is to login to the virtual machine and make a note of the network settings. We then, remove the Network adapter from the Edit Settings of the virtual machine. Once the NIC is removed, we will go ahead and a new NIC, and while adding a new adapter, we get the choice of choosing the adapter type. Once the adapter is added, we login back to the VM and re-populate the network settings.
This all works good, however, removing the NIC and adding a new one will change the MAC address of the device. Every network adapter will have a MAC address which will be listed under the adapter type option in the Edit Settings of the virtual machine. If an application is dependent on the MAC address, for example a VM hosting telephone IVR operation, this might break as it uses the MAC address of the device. In scenarios like this, we will have to reconfigure the application.

The other way to change the network adapter type is:

1. Power OFF the required virtual machine.
2. Take a SSH (Putty) to the host where this virtual machine resides. Change the directory to the virtual machine's directory.
3. Open the virtual machine's .vmx file using the vi editor
# vi <vm_name>.vmx
4. Locate the following line
ethernet0.virtualDev = "e1000"
Press " i " to begin edit and change the e1000 to vmxnet3 (Retain the quotes and text is case sensitive). Press Esc and type :wq! to save and exit the file.

5. Remove the virtual machine from Inventory.
6. Browse the datastore where this VM resides and right click the .vmx file and add this vmx file of the virtual machine to the inventory.
7. Go back to Edit Settings of the virtual machine, select the network adapter and you will see the updated adapter type with the same MAC address.

You just saved a MAC address!