I have a computer connected to an unlabeled RJ-45 port. Because it is not labeled, I do not know which switch port the computer is plugged into.

My initial thought was that I could login to the Catalyst switch and run the following command to find the switch port:

sh mac add | inc <MAC>

However, the computer's MAC address is not appearing in the MAC address table of the switch, despite the fact that the computer has a link light (and thus, must be physically connected to the switch). The computer is autoconfiguring a 169.254.x.x address because it cannot find a DHCP server. I suspect this is because the specific VLAN that is configured on the switch port doesn't have access to a DHCP server.

I tried manually configuring a few static IP addresses on the computer, and that seemed to make no difference in terms of getting the computer's MAC address registered in the switch's MAC table. I was trying random static IP addresses because I do not know to which subnet the VLAN is associated.

My question: does this mean that a connected device, like a computer, must have a valid IP address within the correct subnet to register its MAC address to the switch's MAC table? Until today, I thought a mere physical connection was sufficient to register a MAC address to a switch's MAC address table.


Working link is not sufficient for working MAC level.

Consider different VLANs to be very similar to different cabling and a switch. So you need to have a proper (tagged) VLAN for both your computer and your switch port. But it's only an infinite (4096) number of possible VLANs. Then you need to convince your party to ask for your MAC address - so you need at least a basic communication.

No, IP addresses are not important if there is no ACL or port security interfering in the communication.

  • Understood, and that is good to know. Is it fair to say that there isn't anything that can be done at the switch level to determine in which switch port the computer is connected without at least Layer 2 communication? – JasonF Apr 10 at 17:11
  • Also: is this an example where a Cisco Catalyst switch would show the interface as "<interfaceName> is up, line protocol is down"? If so, I may be able to get a clue by looking for that via "show ip int brief" no? – JasonF Apr 10 at 17:52
  • @JasonF: As for the first comment: Well, you can see the link itself going up/down when the computer interface is connecting/disconnecting (or getting up/down). That's equivalent of staring at the switch lights and trying to know if the light goes up/down in consequence with your pulling/putting the cable out/in the socket. I do it on Linux witch ip link set ethX down and up again. About the Cisco: I would need to check it. – d.c. Apr 10 at 21:31
  • 1
    CDP is your friend in this case: wiki.wireshark.org/CDP A quick packet capture should tell you everything you need to know. (Assuming CDP is enabled on your switch) – Brandon Xavier Apr 11 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.