Discover Switch Port Using tcpdump and wireshark
Discover the Switch Port to which the Server is Connected A previous article, Advanced Linux Networking Tools , covered the basic usage of tcpdump and tshark to discover switch ports on a Cisco switch, but there are times a system may be connected to a different brand, or using a different protocol. Also, wireshark is not always installed, so relying on tshark is not always the most convenient way to get the required info. By default, Cisco uses a proprietary method of communication between switches and routers called Cisco Discovery Protocol (CDP). There is another protocol called Link Layer Discovery Protocol (LLDP), which used by other brands, so it is useful to list other options. Find switch information First, use ifconfig to find the interface names. Then, use tcpdump to listen for packets. Optional: write the packet capture output to a .cap file, and use tshark to read the output. Cisco Discovery Protocol (CDP) YOUR_INTERFACE=eth0 ...