Moving host from DVS to standard switch using ESXi CLI commands.
search cancel

Moving host from DVS to standard switch using ESXi CLI commands.

book

Article ID: 376245

calendar_today

Updated On:

Products

VMware vSphere ESXi VMware vCenter Server

Issue/Introduction

This article guides you through the process of migrating host networking from a DVS switch to a standard switch using ESXi CLI commands.

Environment

  • VMware vSphere ESXI 6.X
  • VMware vSphere ESXI 7.X
  • VMware vSphere ESXI 8.X

 

Resolution

STEP:- 1

 

STEP:- 2

  • Make note of IP configuration of vmkernal running on the DVS switch before proceeding with migration.

      • In the vSphere Client, navigate to the host.
      • Click the Configure tab and expand the Networking menu.
      • To view information about all VMkernel adapters on the host, select VMkernel adapters.
      • Select an adapter from the VMkernel adapters list to view its settings.

 

Note: If the management VMkernel is running on a Distributed Switch, you should perform the steps from the DCUI remote console, as you may lose connectivity to the management network during the process. Otherwise, you can execute these steps via SSH on the ESXi host using root credentials to move all VM network port groups only.

 

STEP:- 3

  • Verify the vSwitch configuration by running the below command 

      • esxcfg-vswitch  -l 

Important: The Distributed Switch (DVS) must have two physical adapters configured for the management VMkernel adapter.

 

STEP:- 4

  • Remove one of the uplink from DVS switch and create standard switch using that uplink.

                        To remove  network cards (known as vmnics) to or from a vNetwork Distributed Switch (vDS) using below command:

      • esxcfg-vswitch -Q vmnic -V dvPort_ID_of_vmnic dvSwitch 

                       Create a Standard Switch for the virtual machine, VMkernel, and Service Console port group depending on the environment on the ESX host you are migrating using below command :

      • esxcli network vswitch standard add --vswitch-name=vSwitch 

 

STEP:- 5

  • Add the uplink that was removed from the DVS switch to the newly created standard switch.

      • esxcli network vswitch standard uplink add --uplink-name=vmnic --vswitch-name=vSwitch

 

STEP:- 6

  • Create a port group on the newly created vSwitch with the same configuration as the DVS switch using the following command:

      • esxcli network vswitch standard portgroup add --portgroup-name=portgroup --vswitch-name=vSwitch
Sample  :- esxcli network vswitch standard portgroup add --portgroup-name=Management_Temp --vswitch-name=vSwitch0

 

STEP:- 7

  • Delete the existing VMkernel from the DVS switch and create new vmkernal on standard switch with same IP configuration using below command 

      • esxcli network ip interface remove --interface-name=vmkX

Note: The vmk interface number used for management can be determined by running the esxcli network ip interface list command.

                        To create a VMkernel port and attach it to a portgroup on a Standard vSwitch, run these commands:

      • esxcli network ip interface add --interface-name=vmkX --portgroup-name=portgroup
      • esxcli network ip interface ipv4 set --interface-name=vmkX --ipv4=ipaddress --netmask=netmask --type=static

Note: By default, the ESXi, the management vmkernel port is vmk0 and resides in a Standard Switch portgroup called Management Network.

 

STEP:- 8

  • If the vmnics associated with the management network are VLAN trunks, you may need to specify a VLAN ID for the management portgroup. To set or correct the VLAN ID required for management connectivity on a Standard vSwitch, run this command:

      • esxcli network vswitch standard portgroup set -p portgroup --vlan-id VLAN

 

STEP:- 9

  • If VMs are running on the DVS switch and you want to migrate them, create port groups for the VM network on the standard switch with the same configuration as the DVS switch using the following command:

      • esxcli network vswitch standard portgroup add --portgroup-name=portgroup --vswitch-name=vSwitch

STEP:- 10

  • After the host is connected to the network, migrate the VMs to the standard switch.