In most networks, we have several routers, switches, and more. We want to make management
for networks easy, most of the admins take the help of CDP and LLDP to know about
what type of devices are present in the network, the IP addresses, and how all
the devices are connected with each other (which means the interface or port) and the
information about which VLAN they belong.
Cisco discovery protocol
CDP (Cisco
discovery protocol) is a Cisco proprietary protocol which is designed by Cisco.
CDP is used to collect information about directly connected devices. We can collect
the hardware and protocol information about neighboring devices. This information
is very helpful when we do troubleshoot or document the network.
What information do we collect from neighbors?
- Device ID
means the hostname of the neighbor.
- The local interface
is the port on which CDP enables the device to receive the CDP packets.
- Hold time means
the router's remaining amount of time is left to hold the information before the router
is discarding it. The router discards the information if no more CDP packets are
received. {You can choose the length from 10 – 255 seconds.}
- Capability
means what is the capability of the neighbor it’s a router or switch or it’s a repeater.
- Platform
means the type of Cisco device directly connected. In the previous output,
- Port ID means
the neighbor device’s port or interface on which the CDP packets are multicasting.
Let's see the configuration and we will see some
interesting show commands.
Topology: -
- configure the topology as per the diagram
- configure the Hostname
- assign the IPs to their respective ports as per the topology
- configure CDP in global mode. or you can also configure CDP on an interface.
- make sure the router-1-core will collect all the information.
R1(config)#hostname router-1-core-
R1(config)#interface serial 2/0
R1(config-if)#ip address 10.1.1.1 255.0.0.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface serial 2/1
R1(config-if)#ip address 20.1.1.1 255.0.0.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 30.1.1.1 255.0.0.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fastEthernet 6/0
R1(config-if)#ip address 40.1.1.1 255.0.0.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fastEthernet 1/1
R1(config-if)#ip address 30.1.1.1 255.0.0.0
R1(config-if)#no shu
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 50.1.1.1 255.0.0.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface ethernet 3/0
R1(config-if)#ip address 60.1.1.1 255.0.0.0
R1(config-if)#no shu
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface ethernet 3/2
R1(config-if)#ip address 70.1.1.1 255.0.0.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface ethernet 3/1
R1(config-if)#ip address 80.1.1.1 255.0.0.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fastEthernet 1/0
R1(config-if)#ip address 90.1.1.1 255.0.0.0
R1(config-if)#no shutdown
R1(config-if)#exit
R6(config)#hostname router-6-
router-6-(config)#interface serial 0
router-6-(config-if)#ip address 10.1.1.2 255.0.0.0
router-6-(config-if)#no shutdown
router-6-(config-if)#exit
R5(config)#hostname router-5-
router-5-(config)#interface serial 2/0
router-5-(config-if)#ip address 20.1.1.2 255.0.0.0
router-5-(config-if)#no shutdown
router-5-(config-if)#exit
R2(config)#hostname router-2-
router-2-(config)#interface fastEthernet 0/0
router-2-(config-if)#ip address 50.1.1.2 255.0.0.0
router-2-(config-if)#no shutdown
router-2-(config-if)#exit
R3(config)#hostname router-3-
router-3-(config)#interface fastEthernet 0/0
router-3-(config-if)#ip address 90.1.1.2 255.0.0.0
router-3-(config-if)#no shutdown
router-3-(config-if)#exit
- configure CDP in global mode. or you can also configure CDP on an interface.
router-1-core-#configure terminal
router-1-core-(config)#cdp ?
advertise-v2 CDP sends version-2 advertisements
holdtime Specify the holdtime (in sec) to be sent in packets
log Log messages generated by CDP
run Enable CDP
source-interface Insert the interface's IP in all CDP packets
timer Specify rate (in sec) at which CDP packets are sent
router-1-core-(config)#cdp advertise-v2
router-1-core-(config)#exit
(now let's collect information about our neighbors)
router-1-core-#show cdp
Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Sending CDPv2 advertisements is enabled
(From the above output you see the default time)
router-1-core-#show cdp ?
entry Information for specific neighbor entry
interface CDP interface status and configuration
neighbors CDP neighbor entries
traffic CDP statistics
| Output modifiers
<cr>
router-1-core-#show cdp entry ?
* all CDP neighbor entries
WORD Name of CDP neighbor entry
router-1-core-#show cdp entry *
-------------------------
-------------------------
Device ID: router-3-
Entry address(es):
IP address: 90.1.1.2
Platform: Cisco 7206VXR, Capabilities: Router
Interface: FastEthernet1/0, Port ID (outgoing port): FastEthernet0/0
Holdtime : 162 sec
Version :
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(24)T, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2009 by Cisco Systems, Inc.
Compiled Thu 26-Feb-09 00:31 by prod_rel_team
advertisement version: 2
Duplex: half
-------------------------
Device ID: router-2-
Entry address(es):
IP address: 50.1.1.2
Platform: Cisco 7206VXR, Capabilities: Router
Interface: FastEthernet0/0, Port ID (outgoing port): FastEthernet0/0
Holdtime : 153 sec
Version :
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(24)T, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2009 by Cisco Systems, Inc.
Compiled Thu 26-Feb-09 00:31 by prod_rel_team
advertisement version: 2
Duplex: half
-------------------------
Device ID: router-6-
Entry address(es):
IP address: 10.1.1.2
Platform: Cisco 1720, Capabilities: Router Switch
Interface: Serial2/0, Port ID (outgoing port): Serial0
Holdtime : 111 sec
Version :
Cisco IOS Software, C1700 Software (C1700-ADVENTERPRISEK9-M), Version 12.4(8), RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Mon 15-May-06 12:42 by prod_rel_team
advertisement version: 2
VTP Management Domain: ''
-------------------------
Device ID: router-5-
Entry address(es):
IP address: 20.1.1.2
Platform: Cisco 3725, Capabilities: Router Switch IGMP
Interface: Serial2/1, Port ID (outgoing port): Serial2/0
Holdtime : 151 sec
Version :
Cisco IOS Software, 3700 Software (C3725-ADVSECURITYK9-M), Version 12.4(15)T12, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2010 by Cisco Systems, Inc.
Compiled Fri 22-Jan-10 03:58 by prod_rel_team
advertisement version: 2
VTP Management Domain: ''
-------------------------
(You can see we have collected lots of information about neighbors)
router-1-core-#show cdp interface
FastEthernet0/0 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
FastEthernet1/0 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
FastEthernet1/1 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial2/0 is up, line protocol is up
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial2/1 is up, line protocol is up
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial2/2 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial2/3 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet3/0 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet3/1 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet3/2 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet3/3 is administratively down, line protocol is down
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet3/4 is administratively down, line protocol is down
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet3/5 is administratively down, line protocol is down
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet3/6 is administratively down, line protocol is down
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet3/7 is administratively down, line protocol is down
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial4/0 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial4/1 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial4/2 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial4/3 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial4/4 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial4/5 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial4/6 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial4/7 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
FastEthernet6/0 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
router-1-core-#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
switch-1 Eth 3/2 135 R S I Linux Uni Eth 0/0
router-3- Fas 1/0 171 R 7206VXR Fas 0/0
router-2- Fas 0/0 162 R 7206VXR Fas 0/0
router-6- Ser 2/0 140 R S 1720 Ser 0
router-5- Ser 2/1 168 R S I 3725 Ser 2/0
vIOS-L2-01 Eth 3/0 20 R S I IOSv Gig 0/0
vIOS-L2-01 Eth 3/1 5 R S I IOSv Gig 0/0
IOU2 Fas 6/0 153 R S I Linux Uni Eth 0/0
IOU1 Fas 1/1 173 R S I Linux Uni Eth 0/0
router-1-core-#show cdp traffic
CDP counters :
Total packets output: 406, Input: 308
Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
No memory: 0, Invalid packet: 0, Fragmented: 0
CDP version 1 advertisements output: 0, Input: 0
CDP version 2 advertisements output: 406, Input: 308
(If you want to collect information about a specific neighbor, not the whole network you can enable CDP on that particular port) (if you want to completely disable CDP)
router-1-core-(config)#no cdp run
router-1-core-#show cdp neighbors
% CDP is not enabled
router-1-core-(config)#cdp ?
advertise-v2 CDP sends version-2 advertisements
holdtime Specify the holdtime (in sec) to be sent in packets
log Log messages generated by CDP
run Enable CDP
source-interface Insert the interface's IP in all CDP packets
timer Specify rate (in sec) at which CDP packets are sent
- here you can change the timer.
- let's change the holdtime from 180 sec to 15 sec.
router-1-core-#show cdp
Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Sending CDPv2 advertisements is enabled
router-1-core-(config)#cdp holdtime ?
<10-255> Length of time (in sec) that receiver must keep this packet
router-1-core-(config)#cdp holdtime 15
router-1-core-#show cdp
Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 15 seconds
Sending CDPv2 advertisements is enabled
- let's change the CDP packets time from 60 sec to 20 sec
router-1-core-(config)#cdp timer ?
<5-254> Rate at which CDP packets are sent (in sec)
router-1-core-(config)#cdp timer 20
router-1-core-(config)#end
router-1-core-#show cdp
Global CDP information:
Sending CDP packets every 20 seconds
Sending a holdtime value of 15 seconds
Sending CDPv2 advertisements is enabled
I hope you like this Lab, if you like it, please visit our YouTube channel.
No comments:
Post a Comment