2.14.2012

esxcfg-vswitch Cheat Sheet; Especially for DVS Commands

It is not uncommon to migrate a NIC or vmk that causes one to lose management connectivity to the ESX host.  Some/all of the following commands can be used to restore uplinks to the standard/DVS switch:

  • 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

No comments:

Post a Comment