This document lists various ESX and ESXi commands to troubleshoot n1k issues on UCS. In ESX with a Console OS, these commands are in the /usr/sbin directory. This procedure assumes you have the KVM IP addresses setup and assigned already. To get to a misconfigured UCS blade for recovery, please click on the KVM item under the server view.
Commands to Add/Delete and Manage Config
To list information on current configuration:
esxcfg-vswif -l To list information on the current vswifs
esxcfg-vswitch -l To list information on the current vswitches and DVS
To manage the existence of a vSwitch:
esxcfg-vswitch -a vSwitch0 To add a vSwitch named vSwitch0 to the server
esxcfg-vswitch -d vSwitch0 To delete a vSwitch named vSwitch0 from server
To manage the port-groups on a vSwitch:
esxcfg-vswitch -A "Service Console" vSwitch0 To add a port-group named Service Console to vSwitch0
esxcfg-vswitch -D "Service Console" vSwitch0 To remove a port-group named Service Console from vSwitch0
To assign VLAN membership to a port-group on a vSwitch:
esxcfg-vswitch -p "Service Console" -v 102 vSwitch0 To set a port-group named Service Console to user VLAN 102 on vSwitch0
To view available NICs that ESX can see:
esxcfg-nics -l To see list of vmnics
To manage uplinks from the DVS or N1k:
First run the list commands (mentioned above) to get the port numbers for the existing uplinks (vmnic0, vmnic1,etc.) In this document lets call this as port#.
esxcfg-vswitch -Q vmnic0 -V [port#] myN1kDVS To remove the vmnic0 uplink from the DVS named myN1kDVS
esxcfg-vswitch -P vmnic0 -V [port#] myN1kDVS To add the vmnic0 uplink to the DVS named myN1kDVS
To add the vmnic's back into a DVS it is good to do this via vCenter and not the command line.
To manage uplinks to a vSwitch:
esxcfg-vswitch -L vmnic0 vSwitch0 To add vmnic0 as an uplink to vSwitch0
esxcfg-vswitch -U vmnic0 vSwitch0 To remove vmnic0 as an uplink to vSwitch0.
To remove a vmnic from a vSwitch, it is good to do this via vCenter and not the command line while migrating from vSwitch to N1k DVS.
To delete a vswif from a ESX server port group:
esxcfg-vswif -d vswif0 -p "Service Console" vSwitch0 To delete a vswif from the port-group on vSwitch0
esxcfg-vswif -d vswif0 -p "Service Console" -P xxx -V myN1kDVS To delete a vswif from the port-group on the Nexus1000V.
This is a common task if an error situation arises, and you lose connectivity to the ESX server when migrating to Nexus 1000V. You will have to add the port-group to the vSwitch0, then add the vswif on it.
To add a vswif to the ESX server:
esxcfg-vswif -a vswif0 -p "Service Console" -i 10.1.1.10 -n 255.255.255.0 To add a vswif0 with IP 10.1.1.10/24 to port-group Service Console
esxcfg-vswif -a vswif0 -p "Service Console" -i 10.1.1.10 -n 255.255.255.0 -P [port#] -V myN1kDVS To add a vswif0 with IP 10.1.1.10/24 to port-group Service Console to the port = port# on the DVS myN1kDVS.
The port# is usually just the last unused entry to the list of available port numbers when listing the DVS configuration with esxcfg-vswitch -l.
To manage a default gateway for the ESX server:
On the vCenter GUI, you can change this directly, but on the CLI, you must edit the /etc/sysconfig/network file and update the vswifs default gateway. The file will look similar to:
After saving the file, the ESX server must be rebooted to accomplish the change
Commands to Troubleshoot
To Ping test out a VMkernel interface:
esxcfg-route -l To get the routes on the VMKernel network
vmkping X.X.X.X To ping an IP on the VMKernel network
To test for the VEM installation on an ESX host:
vmkload_mod -l | grep vem To ensure the appropriate VEM is loaded (should return the modules)