In this article I describe the process to configure and verify layer2 discovery protocol CDP in router. The purpose of layer2 discovery protocol is to find the routers in the network and add them in the routing table of the router. All networks have multiple switches and router for data flow. It is necessary to know the map of the networking device to manage the network. Networking devices should communicate with each other for better performance of the network. CDP is a Cisco prosperity and run on all the Cisco networking devices. CDP remains enable by default in all Cisco networking devices. Let’s see the process to configure and verify layer 2 discovery protocol CDP along with some common details of CDP.
Cisco Discovery Protocol CDP introduction
Cisco Discovery Protocol CDP is a tool which allow to discover the networking devices in the network. The network administrator can manage the networking devices with the help of CDP. CDP protocol remains enable by default in all Cisco routers and switches. CDP supports all LAN and WAN media. The CDP packets forwarded on a fix interval of 60 seconds on multicast addresses in the network. The SNMP message of CDP contains the hardware platform, IP addresses, hostname and duplex setting etc.
CDP find the networking devices and their configuration in the network. CDP find the IP address of a router out of the gateway or WAN link. The CDP is compatible with LLDP on another device than Cisco. In short we can say the CDN helps to collect the information of hardware and protocols of the next devices. These information can be used for troubleshooting and maintenance of the network.
Configure and verify Layer2 discovery protocol CDP
Now lets see the process to configure and verify layer 2 discovery protocol CDP in a network. I have a simple network as shown in the image below. Here we have 3 routers in the network which are connected with each other. The IP address scheme is same as shown in the image. We can see the commands related to CDP by command line of any router to configure and verify layer 2 discovery protocol.
CDP have three options to show see the commands below
R1>enable R1#show cdp? cdp R1#show cdp ? entry Information for specific neighbor entry interface CDP interface status and configuration neighbors CDP neighbor entries <cr> R1#show cdp
Now I am taking the first option entry to configure and verify layer2 discovery protocol CDP. The first command to configure and verify layer2 discovery protocol is “show cdp entry *”. See the output of the command in the below command window.
R1#show cdp entry * Device ID: R3 Entry address(es): IP address : 10.10.20.2 Platform: cisco C2800, Capabilities: Router Interface: FastEthernet0/1, Port ID (outgoing port): FastEthernet0/0 Holdtime: 161 Version : Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2007 by Cisco Systems, Inc. Compiled Wed 18-Jul-07 06:21 by pt_rel_team advertisement version: 2 Duplex: full --------------------------- Device ID: R2 Entry address(es): IP address : 10.10.10.2 Platform: cisco C2800, Capabilities: Router Interface: FastEthernet0/0, Port ID (outgoing port): FastEthernet0/0 Holdtime: 161 Version : Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2007 by Cisco Systems, Inc. Compiled Wed 18-Jul-07 06:21 by pt_rel_team advertisement version: 2 Duplex: full R1#
In above command output you can see all the two router’s information available on router 1. Now I am going to see the result of second option command of “show cdp interface”.
R1#show cdp interface Vlan1 is administratively down, line protocol is down Sending CDP packets every 60 seconds Holdtime is 180 seconds FastEthernet0/0 is up, line protocol is up Sending CDP packets every 60 seconds Holdtime is 180 seconds FastEthernet0/1 is up, line protocol is up Sending CDP packets every 60 seconds Holdtime is 180 seconds FastEthernet1/0 is up, line protocol is up Sending CDP packets every 60 seconds Holdtime is 180 seconds FastEthernet1/1 is administratively down, line protocol is down Sending CDP packets every 60 seconds Holdtime is 180 seconds R1#
You can see in above command output the status of all interfaces display. Now see the third option of show cdp command to configure and verify the layer2 discovery protocol which is “show cdp neighbors”.
R1#show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone Device ID Local Intrfce Holdtme Capability Platform Port ID R3 Fas 0/1 153 R C2800 Fas 0/0 R2 Fas 0/0 153 R C2800 Fas 0/0 R1#
In above command you can see the information of neighbors displayed as output of command “show cdp neighbors”. In above command output you can see the output is in the form of device ID, local interface, holdtime capability, platform and port ID.
Process to disable CDP in configure and verify layer2 discovery protocol.
We I Explained above the CDP protocol remains enable in all cisco networking devices by default. You can disable the CDP protocol in routers by running some commands as shown below. It is not good to keep disable the CDP for network performance. Some network administrator keep disable the CDP to increase the bandwidth and avoid the congestion as cdp broadcast the snmp msg on every 60 seconds. So lets see the process to configure and verify layer2 discovery protocol by disable and enable CDP in a router R1.
The command to disable CDP is “no cdp run”. The command should be run from global configuration mode in CLI. See the result below
R1>enable R1#config t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#no cdp run R1(config)#do wr Building configuration... [OK] R1(config)#exit R1# R1>enable R1#show cdp % CDP is not enabled R1#
You can disable the cdp on a particular interface also rest all interface remains in CDP enable mode. See the commands below to disable the CDP on a particular interface.
R1>enable R1#show cdp Global CDP information: Sending CDP packets every 60 seconds Sending a holdtime value of 180 seconds Sending CDPv2 advertisements is enabled R1#config t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#interface fastEthernet 0/0 R1(config-if)#no cdp run R1(config)#do wr Building configuration... [OK] R1(config)#exit R1#
We see the process to configure and verify layer2 discovery protocol cdp in above command output. I describe how to disable CDP in a router now we need to enable the CDP in any router the command to enable the CDP is “cdp run”. The command should be run in the global configuration mode. See the example below
R1>enable R1#config t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#cdp run R1(config)#do wr Building configuration... [OK] R1(config)#exit R1# %SYS-5-CONFIG_I: Configured from console by console R1#show cdp Global CDP information: Sending CDP packets every 60 seconds Sending a holdtime value of 180 seconds Sending CDPv2 advertisements is enabled R1#
In this article I describe the process to configure and verify layer2 discovery protocol CDP. I hope you found this article helpful for CCNA exam 200-301. For any query or suggestions on this topic you may contact us or drop a comment below. Your suggestions are always welcome by us.