Several times I had to trace a network cable from a server to the switch. Most of the times, this can be a pain, because cables are so tight to each other, that it is almost impossible to trace them. Fortunately, there is a way to trace a cable.
First, make sure that CDP is enabled on your switch, because if it’s not, nothing further will work. If you have an ESX host, by default CDP on the NICs is disabled, so you’ll have to enable it. Refer to this VMWare article, but pretty much all you have to do is to enable it on all virtual switches.
esxcfg-vswitch -B both vSwitchX
, where X is the switch number (e.g vSwitch0).
Once you do that, wait for 60 seconds for the CDP broadcast, and then go to vCenter, select the ESX host, click the Configuration tab, then Networking and on the right side, click on the comic baloon shape next to the physical NIC. You should see something like this.
This means that the physical NIC is connected to a device called SB-CORE2, the blade number is 8, and the port number is 8 as well (Gigabit8/8). If you have a Windows OS, it might be easier if you find a MAC address of the NIC, and then do show mac-address | i where aabb.ccdd.eeff is the MAC address. Most of the times, you won’t have access to the network switch, so what you have to do is to download a tool called TCPdump from here. Put this tool somewhere on the server and execute from a command prompt:
tcpdump -i 5 -nn -v -s 1500 -c 1 ether[20:2] == 0x2000
where “-i 5” is the 5th adapter. For more information, follow up this link. And, this is the output.
Update 06/13/2012: For an ESXi host, use VMware vSphere CLI:
vicfg-vswitch.pl --server your.vcenter.server -h your.esxi.host -B both vSwitch0
You are going to be prompted for an username and password. Wait for 5-10 minutes and the information will show up.