Badges

gestaltitbadge

follow-me-twitter

Subscribe to me on FriendFeed

Comments / DISQUS
Feedjit.com

Identify ESX Server Switch Ports Without Tracing Cables

If you’ve ever had to manually trace the cables from servers to network switches in a rack you probably were not very happy about it. In fact, if you’ve ever had to trace 10 cables from each ESX host to multiple network switches you were most likely aggravated to say the least. The good news is that if you have ESX 3.5 and Cisco switches you can determine the switch ports in use via the Cisco Discovery Protocol (CDP). Even better, the VMware administrator doesn’t even need access to the network switch and can obtain the switch port information directly from the VI Client.

VMware KB article 1003885 explains that CDP was introduced as of version ESX version 3.5 and provides the instructions for checking the status of CDP on the virtual switches from the Service Console.

To Configure the ESX 3.5 host: 

  1. Log in as root to the Service Console (via SSH, remote console, or physical console).
  2. Verify the current CDP setting for the desired virtual switch (vSwitch1, in this example).    [root@server root]# esxcfg-vswitch -b vSwitch1
    down
    The output of down indicates CDP is currently not implemented
            

To change CDP status the KB article instructs you to enter the following commands at the Service Console:

  1. Set the CDP status for a given virtual switch. Possible values here are down, listen, advertise, or both.

    [root@server root]#  esxcfg-vswitch -B both vSwitch1
  2. Verify the new setting:

    [root@server root]# esxcfg-vswitch -b vSwitch1
    both

Be sure to repeat the commands for every virtual switch on the ESX host

When I checked the virtual switches on one of our lab ESX 3.5 Servers I received the following output:

[root@vmware01 root]# esxcfg-vswitch -b vSwitch0

listen

[root@vmware01 root]# esxcfg-vswitch -b vSwitch1

listen

[root@vmware01 root]# esxcfg-vswitch -b vSwitch2

listen

Although the preferred configuration would be “both” so that the switch receives the CDP information from the ESX host as well, “listen” satisfies the need to use the VI Client for figuring out the switch ports in use.

Now, using the VI Client you can go to the Configuration tab of a host and select Networking. To the right of each vSwitch is what I’ll describe as a dialogue icon.

Clicking this icon brings up the switch port info you are seeking.

In the screen shots above this is the information just for vmnic1. If you have 10 nic ports in your ESX hosts you will have to click the icons next to all your vmnics – 0 through 9.

If you have a lot of ESX hosts to click through, then VMware KB Article1007069 explains how to extract the CDP information from all vnics simultaneously from the ESX Console.

To extract CDP information using the ESX command line:

  1. Log in into ESX 3.5 via SSH as root.
  2. Run the following command on ESX command line : > vmware-vim-cmd hostsvc/net/query_networkhint
            

  3. The following information is displayed:
  • Virtual switch port information
  • CDP information from the physical Cisco switch connecting to the ESX host .

The following screen shot shows the same info about vnic1 from the ESX Console. The entire output of the command showed the same for all the vnics on the ESX host.

Should you have access to the network switch and you’ve configured the ESX CDP status for “both” as described earlier, VMware KB article 1003885 shows an example of the commands to use to display the CDP information from the switch IOS:

The following is an example of configuring CDP for a Cisco 6500 physical switch:

  1. switch#
  2. switch# config terminal
  3. switch(config)# cdp run
  4. switch(config)# interface g1/1
  5. switch(config-if)# cdp enable
  6. switch# show cdp neighborsCapability Codes: R – Router, T – Trans Bridge, B – Source Route Bridge
    S – Switch, H – Host, I – IGMP, r – Repeater, P – Phone
    Device ID Local Intrfce Holdtme Capability Platform Port ID
    pa-tse-h24.pasl.vmware.com Gig   1/1 121 S VMware ESXvmnic2
    pa-tse-h24.pasl.vmware.com Gig   1/2      121 S VMware ESXvmnic3

Other bloggers have posted about enabling and using CDP in ESX. I’ve found the following posts helpful to me in the past on this topic.

Related Posts

Get My Podcast On iTunes!
Support VM /ETC
Support VMETC.com

Support VMETC.com

Free Business and Tech Magazines and eBooks
@rbrambley tweets
VMTN Roundtable Podcasts
Subscribe



Add to Google Reader or Homepage
Subscribe in NewsGator Online
Add to netvibes
Add to Plusmo