We usually use the following command to execute, monitor, and maintain CDP information:
Cdp run command:
This command is used to enable CDP in global mode. By default, CDP is enabled in global mode. We can use the no cdp run Command to disable CDP. The advantage of this is that the CDP protocol does not regularly send CDP messages, thus saving bandwidth.
Cdp enable command:
This command needs to be configured in Port mode. It enables the CDP protocol on a specific port. By default, CDP supports sending and receiving CDP protocol messages on all ports, however, for an asynchronous port, CDP is disabled. We can also disable cdp protocol message updates on a port by using no CDP enable.
Tip:If you use the no cdp run Command to manually disable the CDP protocol in global mode, the network port cannot enable the CDP protocol.
Clear cdp counters command:
This command is used to reset the CDP traffic counter. When we use this command, we use the show cdp traffic command again, all incoming and outgoing data packets and other information are cleared.
Show cdp command:
The function of this command is to display the interval of sending CDP protocol messages. We can also use this command to view the CDP protocol version information.
Show cdp entry {* | device-name [*] [protocol | version]}
We can use the show cdp entry command to view the information of a specific neighbor device. Through this command, we can view the IP address, hardware platform, connected port, and IOS version of a specific neighbor.
Show cdp interface [type number]
If you want to check whether the CDP protocol is enabled or disabled on a specific port, you can use the show cdp interface command, which can also display the CDP message Update time and other content.
Show cdp neighbors [type number] [detail]
Run the show cdp neighbors command to obtain the platform, device type, and connected port of the CDP neighbor.