Using the Cisco Discovery Protocol:
You want to see summary information about what is connected to your router’s interfaces.
You can selectively enable or disable Cisco Discovery Protocol (CDP) on the entire router, or on individual interfaces:
CDP is enabled by default on the router, and on all interfaces. If you have previously disabled it,and you want to re-enable CDP on the router, you can issue the cdp run global configuration command:
This turns on CDP processing on all supported interfaces by default. If you don’t want to run CDP on a particular interface, you can use the no cdp enable command, as we did for the serial interface in the example:
CDP is a Cisco proprietary protocol that allows Cisco devices to identify one another and exchange useful identifying information. The show cdp neighbors command gives a summary of information about adjacent devices that also happen to be running CDP:
As you can see, this output tells you the name and type of device of each neighbor, including the model number. It also includes both the interface on this router that connects to each neighbor and the corresponding interface on the neighbor device.
Notice that the last of the devices listed is actually a Cisco Catalyst Ethernet switch. This switch points out one of the most useful features of CDP. While other mechanisms such as the ARP cache, routing protocols, or even simple PING tests can tell you things about the Layer 3 neighbors, CDP gives you information about the Layer 2 neighbors. This is true even when the Layer 2 neighbor does not have an IP addresses configured.
You can see additional information about these neighboring devices by adding the detail keyword:
There is a lot of information in this output. It tells you the IP addresses of the adjacent interfaces on the neighbor devices. It also gives details about the Cisco IOS or CatOS version.
Both of these neighbor devices support CDP Version 2. In IOS Version 12.0(3)T, Cisco introduced this new version of CDP, which includes three new fields that are quite useful on LANs: VTP Domain Name, 802.1Q Native VLAN, and duplex. As you can see in the above output, the router and switch agree that they are operating at full duplex.
This new duplex option in particular is extremely useful because the router and switch can now automatically detect duplex mismatches. We deliberately created a duplex problem by changing the switch’s setting to half duplex for the port facing this router. The router was able to detect the problem through CDP and issue the following log message:
CDP Version 2 is enabled by default on all IOS versions 12.0(3)T and higher. You can globally disable Version 2 support on a router, allowing only Version 1, by issuing the following global configuration command:
However, it is not entirely clear what purpose this would serve. We know of no interoperability problems between CDP Version 1 and Version 2.
You can see global information about the router’s CDP configuration with the show cdp command:
Here you can see that this router sends out CDP advertisement packets every 60 seconds, which is the default. The holdtime parameter is the length of time the router will wait to hear the next CDP advertisement from one of its neighbors. If it doesn’t receive this advertisement packet within this time period, the router will flush the corresponding entry from its CDP neighbor table.
You can adjust these parameters globally for the entire router as follows:
Both of these commands accept an argument in seconds. The advertisement timer can have any value between 5 and 254 seconds, while the hold timer must be between 10 and 255 seconds.