10

When building a VM, you can select which virtual device type you would like a vNIC to be (E1000, VMXNET3, etc).

After the VM is created, can you change the type of vNIC in use on a given connection (eg from E1000 to VMXNET3)?

If so, how?

ewwhite
  • 201,205
warren
  • 19,297

4 Answers4

13

Yes, you can change the type.

Use the Set-NetworkAdapter powercli cmdlet. The "Type" switch allows you to modify adapter. Note that the VM has to be turned off to do this.

https://www.vmware.com/support/developer/PowerCLI/PowerCLI41U1/html/Set-NetworkAdapter.html

vSphere PowerCLI can be downloaded here:

https://my.vmware.com/group/vmware/details?downloadGroup=VSP510-PCLI-510&productId=285

It can be installed on any Windows machine that has network access to the ESXi server. I typically install it directly on my laptop/workstation where I also have vSphere installed.

After installing, open it up. Use Connect-VIServer to connect to your ESXi host. It will prompt you for server ip, and credentials.

Use Get-VM to retrieve the list of VMs on the ESXi host. Confirm the one you want to change is there, and note the exact name.

Use this command to change the adapter, replacing server name with exact name from the Get-VM list and type with the adapter type you want:

get-vm 'myserver'|get-networkadapter|set-networkadapter -type e1000

Note that if the VM has multiple NICs you may need another switch in the command to specify the correct one.

jlehtinen
  • 1,966
6

As you might be learning there are a number of ways to change the adapter type. One caveat to remember relates to MAC address generation.

When you create a virtual NIC there are two options related to the MAC address:

  • Automatic: (default) ESX autogenerates a MAC address for you
  • Manual: You, the user, manually enters a MAC address that you select

If you are using auto-generated MACs then changing the adapter type results in the address being regenerated. This means that any configurations you have, on the guest or the network infrastructure itself, that rely on a MAC address will fail. So if you change the adapter type you must let if autogenerate a new MAC address or manually set your own. You cannot, however, manually set the old address as the interface as ESX reserves this prefix for it's own purposes.

WARNING WARNING WHEN THIS FAILS BLAME ONLY YOURSELF

An alternative that I have used is to manually edit the virtual machine's configuration file. This method requires SSH be enabled on the ESX host and you be willing to bypass all the data integrity protections that using a GUI or API provide.

Before you do any of these steps make sure the guest is powered off and the settings window is closed.

  1. SSH into your host
  2. Locate vmx file for your virtual machine (ex. /vmfs/volumes/datastore1/testvm.priv/testvm.priv.vmx
  3. Open the file for editing: vi /vmfs/volumes/datastore1/testvm.priv/testvm.priv.vmx
  4. Find the line that defines the interface type. E.g., for the first vNIC ethernet0.virtualDev = "e1000"
  5. Change e1000 to vmxnet3
  6. Save the file and exit.

Now you will have changed the virtual NIC device type without having to change the MAC address.

Scott Pack
  • 15,097
2

I don't think it's productive to suggest a PowerCLI or scripting solution to this question... Too many assumptions about the surrounding infrastructure for what's a 30-second manual fix.

The answer is that you really shouldn't change the type of adapter in-flight. The more accepted process is to remove the existing adapter and add a new adapter of the type you desire.

existing E1000 NIC attached to a VM enter image description here

remove the E1000 NIC enter image description here

add a new Network device
enter image description here

specify the type of adapter to be used in the new network device enter image description here

In your operating system, reconfigure network settings.

ewwhite
  • 201,205
1

You cannot change the type, but you can easily delete the unwanted type and add a new vNIC of the wanted type.

John
  • 9,208
  • 1
  • 32
  • 34