Reputation: 7612
Is it possible to figure out what is the mac address of the switch port you are connected to?
I was looking in tcpdump, but it seems that in each ethernet packet the MAC of the sender and destination, but not of those MAC's it passing. But i'm looking for way to find out the MAC of the switch you are directly connected to.
I should be a generic solution. For example a managed CISCO switch, is not a solution (yet).
I have C/C++ at my disposal or any other language.
Upvotes: 1
Views: 1814
Reputation: 7608
Read this: http://en.wikipedia.org/wiki/Network_switch#Layer_1_.28Hubs_versus_higher-layer_switches.29
In a normal switch they don't have a MAC address. Unless what you are using is a bridge.
Upvotes: 3
Reputation: 400019
TCP/IP are above the switch in network layer abstractions. Specifically, they're at the Transport and Internet layers, respectively (Transport is above Internet). You need to inspect the raw Ethernet packet, for Link layer data.
Upvotes: 0