How to find out which switch port linux host is connected to?
7:57 PM
We can use "tcpdump" command in linux shell/command line to find out
network switch connected to the linux server. The command is (assuming
you are checking for eth0)
Output would be something similar to:
tcpdump -nn -v -i eth0 -s 1500 -c 1 'ether[20:2] == 0x2000' |
Output would be something similar to:
[root@ashinfoapp06s ~]# /usr/sbin/tcpdump -nn -v -i eth0 -s 1500 -c 1 'ether[20:2] == 0x2000'tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 1500 bytes02:33:58.252088 CDPv2, ttl: 180s, checksum: 692 (unverified), length 450 Device-ID (0x01), length: 25 bytes: 'as1c503ag1od.opsource.net' Version String (0x05), length: 264 bytes: Cisco IOS Software, s72033_rp Software (s72033_rp-ADVENTERPRISEK9_WAN-M), Version 12.2(33)SXI4a, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Fri 16-Jul-10 19:51 by prod_rel_team Platform (0x06), length: 16 bytes: 'cisco WS-C6509-E' Address (0x02), length: 13 bytes: IPv4 (1) 10.182.100.2 Port-ID (0x03), length: 19 bytes: 'GigabitEthernet9/44' Capability (0x04), length: 4 bytes: (0x00000029): Router, L2 Switch, IGMP snooping Prefixes (0x07), length: 25 bytes: IPv4 Prefixes (5): 10.182.140.0/23 127.0.0.0/8 127.0.0.0/8 10.182.100.0/23 10.182.244.176/29 VTP Management Domain (0x09), length: 10 bytes: 'ag1odash01' Native VLAN ID (0x0a), length: 2 bytes: 2909 Duplex (0x0b), length: 1 byte: full AVVID trust bitmap (0x12), length: 1 byte: 0x00 AVVID untrusted ports CoS (0x13), length: 1 byte: 0x00 Management Addresses (0x16), length: 13 bytes: IPv4 (1) 10.182.100.2 |
0 comments