Use Cisco Discovery Protocol (CDP)
Cisco Discovery Protocol (CDP) is a proprietary protocol from Cisco that is used to discovers basic information about the locally attached routers and switches. With CDP, an administrator can gather hardware and protocol information about neighbor devices, which can be helpful when troubleshooting or documenting the network.
To discover information, Cisco devices send CDP messages out each of their interfaces. These messages contain information about the device that sent the CDP message, such as the hostname, network and data link addresses, the device model, IOS version, etc.
To display information about directly connected devices, use the show cdp neighbor command:
As you can see from the example above, there is one directly connected device. Here is a description of each field of the output:
- Device ID – the hostname of the directly connected device. In this case the hostname is HQ_SWITCH.
- Local Interface – the local interface on which the CDP messages were received (Fa0/1 in this case).
- Holdtime – the amount of time the local device will hold the information before discarding it if no more CDP packets are received.
- Capability – the capability of the directly connected device – is it a router or a switch? In this case the letter S indicates that the directly connected device is a switch. The letter R would indicate a router.
- Platform – the model and OS level running on the neighbor, 2950 series switch in this case.
- Port ID – the neighbor device’s interface on which the CDP packets were sent, in this caase Fa0/5.
To get even more information about your neighbors, use the show cdp neighbors detail command: