Migrating ESXi host networking from Distributed Switch (vDS) to Standard Switch (vSS) via CLI
search cancel

Migrating ESXi host networking from Distributed Switch (vDS) to Standard Switch (vSS) via CLI

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 Virtual Distributed Switch (vDS) to a standard switch (vSS) using ESXi CLI commands.

Environment

VMware vSphere ESXi
VMware vCenter Server

Resolution

Follow the below steps to migrate host networking from a vDS to a vSS:

  1. Back up the vSphere Distributed Switch configuration. For more information, see Exporting/importing/restoring Distributed Switch configs

  2. Make note of IP configuration of vmkernel running on the vDS before proceeding with migration.
    1. In the vSphere Client, navigate to the host.
    2. 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.

  1. Verify the vSwitch configuration by running the below command
    • esxcfg-vswitch -l

Make note of the dvPort_ID of the vmnic being removed for use in STEP 4.

  1. Remove one of the uplinks from the DVS switch and create a standard switch using that uplink.
    Important: The Distributed Switch (DVS) must have two physical adapters configured for the management VMkernel adapter.
    • To remove  network cards (known as vmnics) to or from a vNetwork Distributed Switch(vDS), use the below command:
      • esxcfg-vswitch -Q vmnic -V <dvPort_ID_of_vmnic> <dvSwitch_name>

    • 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_name>
  1. 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_name>

  2. 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_name>
      Sample  :- esxcli network vswitch standard portgroup add --portgroup-name=Management_Temp --vswitch-name=vSwitch0

  3. 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=<vmk#>

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

    • 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=<vmk#> --portgroup-name=<portgroup>
      • esxcli network ip interface ipv4 set --interface-name=<vmk#> --ipv4=<ip_address> --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.

  1. 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_ID>

  2. Add a static route to the host's routing table
    • esxcfg-vswitch -a default <default_gateway_ip> 

  3. 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_name>

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