Identificar a que Switch esta conectado nuestro servidor con TCPDUMP y CDP
Con el comando tcpdump
podemos consultar informacion sobre el switch al cual estamos conectados via CDP
La sintaxis del comando es la siguiente:
tcpdump -nn -vvv -i interfaz -s 1500 -c 1 'ether[20:2] == 0x2000'
Cambiando interfaz
por el nombre de la interfaz a traves de la cual quieres hacer la consulta, por ejemplo bond0
:
$ sudo tcpdump -nn -vvv -i bond0 -s 1500 -c 1 'ether[20:2] == 0x2000'
tcpdump: listening on bond0, link-type EN10MB (Ethernet), capture size 1500 bytes
16:37:12.606879 CDPv2, ttl: 180s, checksum: 692 (unverified), length 389
Device-ID (0x01), length: 26 bytes: 'SW-3'
Version String (0x05), length: 180 bytes:
Cisco IOS Software, C3560 Software (C3560-IPBASE-M), Version 12.2(25)SEE3, RELEASE SOFTWARE (fc2)
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Thu 22-Feb-07 14:40 by myl
Platform (0x06), length: 20 bytes: 'cisco WS-C3560G-48PS'
Address (0x02), length: 13 bytes: IPv4 (1) 110.10.22.160
Port-ID (0x03), length: 18 bytes: 'GigabitEthernet0/2'
Capability (0x04), length: 4 bytes: (0x00000028): L2 Switch, IGMP snooping
Protocol-Hello option (0x08), length: 32 bytes:
VTP Management Domain (0x09), length: 6 bytes: 'ejemplo'
Native VLAN ID (0x0a), length: 2 bytes: 2355
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.0.2.160
unknown field type (0x1a), length: 12 bytes:
0x0000: 0000 0001 0000 0000 ffff ffff
1 packets captured
5 packets received by filter
0 packets dropped by kernel
El comando tarda unos segundos, luego nos trae toda la informacion tal como en el ejemplo de arriba, donde podemos ver el nombre de switch, en este caso SW-3
y el puerto al cual estamos conectados, en este caso GigabitEthernet0/2
Relacionado