How to Migrate the Management VMkernel Adapter of an ESXi host from a Virtual Distributed Switch to a Standard Switch.
search cancel

How to Migrate the Management VMkernel Adapter of an ESXi host from a Virtual Distributed Switch to a Standard Switch.

book

Article ID: 377194

calendar_today

Updated On:

Products

VMware vSphere ESXi VMware vCenter Server

Issue/Introduction

This article provides guidance on how to migrate vmkernel networking from a vSphere Distributed Switch to a Virtual Standard Switch.

 

Environment

  • VMware ESXi 7.x
  • VMware ESXi 8.x
  • VMware vCenter Server 7.x
  • VMware vCenter Server 8.x

 

Cause

Sometimes if you have a need to remove an ESXi host from vCenter inventory and then add it back again, you will need to migrate the Management vmkernel adapter to a standard vSwitch.

This is because when you remove an ESXi host from Inventory, that is using a vDS for networking to the Management vmkernel, the act of removing the host from Inventory will also remove the ESXi host from the vDS from a vCenter perspective.  

Because of this, you will need to first migrate the Management vmkernel networking to a standard vSwitch, so you can then properly re-adjust the vDS in vCenter after the ESXi host has been removed and re-added.  

Resolution

For this example, assume the following scenario:

  1. ESXi host with a standard vSwitch0 still present
  2. vmnic0 and vmnic1 attached to a vDS
  3. vmk0 is the Management vmkernel
  4. vmnic0 and vmnic1 happen to be bonded together in an Etherchannel (portchannel) and LACP is not in use in this example.  
  5. The host is part of a cluster of ESXi hosts, but it is not a VSAN cluster or NSX-prepared.  
  6. The NIC Teaming settings of the two NICs is IP hash, per requirements for an Etherchannel (portchannel) configuration.
  7. The configuration of the dvPortgroup used by the Management vmkernel interface regarding VLAN is "VST" (Virtual Switch Tagging) and the VLAN ID is NNNN (where NNNN=the numeric VLAN)

 

STEPS TO ACHIEVE THE MIGRATION OF A Management VMkernel Adapter of an ESXi host from a Virtual Distributed Switch to a Standard Switch

 

  1. SSH (or use a Remote Console such as iLO, iDRAC, UCS Manager, or other KVM) into the ESXi host with root privileges.
  2. Determine the port IDs of the vmnics associated with the vDS using the command "esxcli network vswitch dvs vmware list".
  3. Look for the port ID Number after the string "Port ID: " below the line that contains the string "Client: " that also shows the vmnic(s).
  4. Drop one of the vmnics from the vDS using the command "esxcfg-vswitch -Q <vmnic> -V <uplink port ID> <dvS-name>", where <vmnic> would be vmnic1, in this case, the <uplink port ID> would be the number obtained in step 2) above, and <dvS-name> is the name of the vDS.
  5. Add the vmnic dropped in step 3) to standard switch (in this case, vSwitch0):  "esxcli network vswitch standard uplink add -u vmnic1 -v vSwitch0"
  6. Determine the following pieces of information that you will need in next steps:  The IP address and Netmask of the existing Management vmkernel (Use command "esxcfg-vmknic -l"), the IP address of the default gateway for the Management vmkernel (Use command "esxcfg-route -l"), and the VLAN ID presently configured (Use command "esxcfg-vswitch -l", make a note of the dvPort number associated with the Management vmkernel interface, and then look in the output of command "net-dvs -l | less" for the VLAN number configured for that dvPort number associated with the Management vmkernel interface)
  7. At this point, if you have been using an SSH client instead of the Remote Console to access the server, log out of the ESXi host and log back in with root privileges using the Remote Console.
  8. Create a new temporary portgroup on the vSwitch where you will attach.  In this example, use command "esxcli network vswitch standard portgroup add -p "Temp_vmk0" -v vSwitch0"
  9. Set the VLAN ID required for the Management vmkernel.  In this example, use command "esxcli network vswitch standard portgroup set -p "Temp_vmk0" -v NNNN" (where NNNN is the number obtained in Step 6 above).
  10. Then remove the existing Management vmkernel interface.  In this example, use command "esxcli network ip interface remove -i vmk0"
  11. Next, add a new Management vmkernel interface.  In this example, use command "esxcli network ip interface ipv4 set -i vmk0 -I ###.###.###.### -N 255.255.255.0 -g ###.###.###.### -t static " (where the entries after "-I" and "-g" are the settings obtained in step 6 above.
  12. Next, set the default gateway in the routing table.  In this example, use command "esxcfg-route -a default ###.###.###.###" where the entry for "###.###.###.###" is the IP address used for the "-g" entry in step 11 above.
  13. Using the Hosts and Clusters view of vCenter, right-click on the Host and select Connection --> Disconnect
  14. After the host goes to a Disconnected state,  right-click on the Host and "Remove from Inventory".
  15. Once the host is removed, right-click on a Datacenter object and "Add Host" to add the host back again.
  16. You now should observe that the host gets added, and the networking between vCenter and the host regarding the Management vmkernel interface will be using the "Temp_vmk0" portgroup on vSwitch0 and the traffic will be flowing on vmnic1. 
  17. If your goal at this point is to get the ESXi host re-attached fully to the vDS instead of using the standard switch, then proceed as below.
  18. Using the Networking icon view of vCenter, right-click on the vDS object and select Add / Manage Hosts --> Add Host.  In this example:  a) Physical Adapters --> vmnic0 --> Uplink 1 ; b) Virtual Adapters --> vmk0 --> The dvPortgroup assigned for the Management VLAN ; c) Proceed through the wizard to Finish. 
  19. At this point you should observe that the ESXi host is now communicating on the Management vmkernel interface (in this example, vmk0) using the vDS, with the traffic flowing over the vmnic0 instead of vmnic1.
  20. Switch to the Hosts and Clusters view, select the Host, and under Configure --> Virtual Switches navigate to vSwitch0, select Manage Physical Adapters, highlight vmnic1 (in this example) and Delete it.
  21. Switch to the Networking icon view, right-click on the vDS --> Add / Manage hosts --> Manage Host Networking and in this example: a) Physical Adapters --> vmnic1 --> Uplink 2; b) Proceed through the wizard to Finish
  22. At this point, you can switch back to Hosts and Clusters view, Exit Maintenance Mode on the host, as it should be ready to be placed back into service.  Click-Drag it back into whichever Cluster you wish.  

 

If at any time you do not get the results expected as above, please STOP and log a case with Broadcom Support, Networking team.