Sometimes it is convenient to use the Cisco Discovery Protocol (CDP) to get an overview over a Cisco topology, especially when familiarizing yourself with an unknown network. CDP is also helpful when dealing with integration of UNIX gateways into an existing Cisco Works network management infrastructure. Cisco Works, for example, heavily relies on CDP. UNIX workstations can send CDP packets to Cisco neighbors.
Depending on the tool, these packets are either CDPv1 or CDPv2. Four UNIX CDP implementations pretty much achieve the same:
lcdpd (Linux kernel patch)
Because UNIX workstations usually do not care about CDP neighbors, they transmit only CDP packets; they do not digest received protocol information. Example 6-18 shows the CDP configurations of the lab gateways. The callisto scdp crontab entry is activated every 60 seconds to match the Cisco default timers.
Castor: /usr/local/libexec/cdpd ?a Callisto crontab entry: * * * * * /usr/local/bin/scdp -i eth0 -v2 Scar: Cisco CDP can be enabled per-interface via the cdp enable command
The result of this setup is shown in Example 6-19, and Example 6-20 shows a sniffer trace of the CDP protocol traffic.
scar# show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater Device ID Local Intrfce Holdtme Capability Platform Port ID callisto Eth 1 124 H Linux eth0 castor Eth 0 147 H i386 ed0 scar# show cdp neighbors detail ------------------------- Device ID: callisto Entry address(es): IP address: 192.168.14.1 Platform: Linux, Capabilities: Host Interface: Ethernet1, Port ID (outgoing port): eth0 Holdtime : 178 sec Version : 2 advertisement version: 1 ------------------------- Device ID: castor Entry address(es): IP address: 192.168.7.7 Platform: i386, Capabilities: Host Interface: Ethernet0, Port ID (outgoing port): ed0 Holdtime : 142 sec Version : FreeBSD 4.9-RELEASE FreeBSD 4.9-RELEASE #0: Tue Nov advertisement version: 1
[root@callisto:~#] tcpdump -i eth0 ether dst 01:00:0c:cc:cc:cc tcpdump: listening on eth0 14:41:00.784334 CDP v1, ttl=180s DevID 'callisto' Addr (1): IPv4 192.168.14.1 PortID 'eth0' CAP 0x10 Version: (suppressed) Platform: 'Linux' 14:41:04.922217 CDP v2, ttl=180s DevID 'scar' Addr (1): IPv4 192.168.14.254 PortID 'Ethernet1' CAP 0x01 [!cdp] 14:41:04.923162 CDP v1, ttl=180s DevID 'scar' Addr (1): IPv4 192.168.14.254 PortID 'Ethernet1' CAP 0x01 [!cdp] [root@castor~#] tcpdump -i ed0 ether dst 01:00:0c:cc:cc:cc tcpdump: listening on ed0 14:09:04.837219 CDP v2, ttl=180s DevID 'scar' Addr (1): IPv4 192.168.7.254 PortID 'Ethernet0' CAP 0x01 [!cdp] 14:09:04.838186 CDP v1, ttl=180s DevID 'scar' Addr (1): IPv4 192.168.7.254 PortID 'Ethernet0' CAP 0x01 [!cdp] 14:11:24.686029 CDP v1, ttl=180s DevID 'castor' Addr (1): IPv4 192.168.7.7 PortID 'ed0' CAP 0x10 [!cdp]