Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Configuring vSwitch or vNetwork Distributed Switch from the command line in ESX/ESXi

Symptoms

  • You are unable to connect to the ESX or ESXi host via the network because uplinks have changed or are not in the right order
  • Primary Service Console is moved from a switch to a distributed switch on a non-routable network

Purpose

This article provides steps to restore the Service Console connection to the correct vmnic interface.

Resolution

Notes:
  • In ESX 4.0 Update 2, a new command-line tool, console-setup, was included to simplify the process of creating or restoring networking in the ESX service console. For more information, see Configuring or restoring networking from the ESX service console using console-setup (1022078).
  • In ESXi 4.x and 5.0, you can restore the network to a Standard vSwitch using the Restore Standard Switch option from the Direct Console User Interface (DCUI) console screen (press F2 from console). Note this will result in a blank network configuration (1 x vSwitch with 1 x vmkernel port group) on the ESXi host. Any existing vSwitch, portgroup, and vmkernel information will be removed. It is recommended to take a screenshot of your network configuration from the vSphere client or the output from the esxcfg-vswitch -l and esxcfg-vmknic -l commands before using this option.
To restore the Service Console connection to the correct vmnic interface:
  • These commands allow you to add or remove network cards (known as uplinks) to or from a Standard vSwitch:

    # esxcfg-vswitch -U vmnic vSwitch    # unlink an uplink
    # esxcfg-vswitch -L vmnic vSwitch    # add an uplink

    Note: Unlink and relinking from or to a distributed switch depending on the scenario.

  • These commands allow you to add or remove network cards (known as uplinks) to or from a vNetwork Distributed Switch (vDS):

    # esxcfg-vswitch -Q vmnic -V dvPort_ID_of_vmnic dvSwitch   # unlink a DVS uplink
    # esxcfg-vswitch -P vmnic -V unused_dvPort_ID dvSwitch     # add a DVS uplink
     

  • To create an ESX Service Console management interface (vswif) and uplink it to the vDS, run the command:

    Note: This command does not apply to ESXi.

    # esxcfg-vswif -a -i IP_address -n Netmask -V dvSwitch -P DVPort_ID vswif0

    For example:

    # esxcfg-vswif -a -i 192.168.76.1 -n 255.255.255.0 -V dvSwitch -P 8 vswif0

  • To use the same IP address of the management VMkernel port, perform one of these options:
    • Delete an existing VMkernel port from a vDS with the command:

      # esxcfg-vmknic -d -s DVswitchname -v virtual_port_ID

    • Disable the management VMkernel port with the command:

      # esxcfg-vmknic -D -s DVswitchname -v virtual_port_ID vmnic#

  • To create a VMkernel port and attach it to the DVPort ID on a vDS, run the command:

    # esxcfg-vmknic -a -i IP_address -n netmask -s DVswitchname -v virtual_port_ID

  • To create a VMkernel port and attach it to the DVPort ID on a vSS, run the command:

    # esxcfg-vmknic -a -i IP_address -n netmask  portgroup

For ESXi 4.x and 5.0 commands, see vSphere Command-Line Interface Installation and Scripting Guide. 

Note: The command-line tool provides limited functionality when running the esxcfg-vswitch command with vNetwork Distributed Switch. For example, you cannot create a dvportgroup or assign VLAN IDs to dvportgroups using this command.

Additional Information

Tags

configure-restore-service-console-networking no-network-connectivity network-connectivity-issues lose-network-connectivity

See Also

Update History

11/29/2011 - Added commands to delete the VMkernel DVport and to create the VMkernel port and attach it to the DVPort ID 01/19/2012 - Added note on using the Restore Standard Switch option from DCUI

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback


Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
Actions