TechKnowSurge
Cisco CCNA 2.3 Cisco CCST Networking 5.5 Cisco CCST Networking 5.4
VideoNetworkFree

DEMO: CDP

Cisco Discovery Protocol (CDP) is a Cisco-proprietary Layer 2 protocol that automatically detects and shares device information between directly connected Cisco equipment. This coverage includes key CDP commands, interpreting neighbor data, and managing CDP at both the global and interface levels.

Complete this video to capture a CTF flag worth 1 point.

About this video

Cisco Discovery Protocol (CDP) is a Cisco-proprietary Layer 2 protocol that runs by default on Cisco devices and automatically discovers directly connected Cisco neighbors regardless of the underlying media type. When Cisco devices are connected, they exchange Layer 2 CDP advertisements every 60 seconds, and each device holds that neighbor information for 180 seconds before expiring it. Because CDP is enabled out of the box, newly connected devices may take up to a full advertisement cycle before appearing in neighbor tables. The show cdp command displays global CDP timer and holdtime settings, while show cdp neighbors provides a summary of each neighbor's hostname, local and remote interface, holdtime, and platform. The show cdp neighbors detail command expands this output to include IPv4 and IPv6 addresses, IOS software version, and device capabilities, giving administrators a comprehensive picture of the adjacent network infrastructure without requiring physical access to those devices. CDP can be disabled across an entire device by entering no cdp run in global configuration mode, and re-enabled with cdp run. For more granular control, CDP can be turned off on a specific interface using no cdp enable at the interface configuration level, which stops CDP advertisements from leaving that port while leaving the rest of the device unaffected. When CDP is re-enabled after being disabled, neighbor entries will not repopulate until the next advertisement cycle completes. While CDP is a practical troubleshooting tool that also enables certain Cisco-specific features, it does expose device and topology details to anyone who can connect equipment to the network. Administrators should evaluate their environment's security requirements when deciding whether to run CDP globally, restrict it to trusted interfaces, or disable it entirely.

What you'll learn

What's covered

Cisco Discovery Protocol (CDP)

Aligned to

Cisco CCNA
2.3 Configure and verify Layer 2 discovery protocols (CDP and LLDP)
Cisco CCST Networking
5.5 Run basic show commands on a Cisco network device
5.4 Differentiate between different ways to access and collect data about network devices

Key terms

Cisco Discovery Protocol
CDP
A Cisco proprietary Layer 2 protocol that allows Cisco devices to discover and share information about directly connected Cisco neighbors, including device type, IP address, and interface details. CDP operates independently of Layer 3 protocols and is used for network topology mapping and troubleshooting.
Protocol
A set of rules governing the format and transmission of data between devices.
Data Link Layer
Layer 2 of the OSI model responsible for node-to-node data transfer and error detection on a single network segment.
Switch
A network device that connects devices within a LAN and forwards traffic based on MAC addresses.
Router
A network device that forwards data packets between networks based on IP addresses.

Topics

Cisco Discovery Protocol Network Protocols Cisco Ios Layer 2 Network Configuration Networking

Transcript

Cisco Discovery Protocol

Cisco devices have something running on them that can help you troubleshoot equipment, and that's called CDP, or Cisco Discovery Protocol. Like the name suggests, Cisco Discovery Protocol is a Cisco proprietary protocol, so Cisco uses it to discover other devices that are on the network.

What happens is, when you plug Cisco equipment together, they send out layer 2 information to discover what's on the other side. If it's another piece of Cisco equipment, the two will communicate and let each other know details about each other. That is Cisco Discovery Protocol. It's media independent, so it doesn't matter what media it's going across, whether it's fiber or ethernet. You just have two devices that are going to connect together, and it runs by default on the Cisco equipment.

Showing CDP and Its Neighbors

We're going to take a look at a few of the commands that work with Cisco Discovery Protocol. First of all, on this switch I'm going to type in show cdp. The first thing we see is just some information about CDP. It's sending packets every 60 seconds, so if you don't see a change when you first initially plug in a device, it could be that you just need to wait 60 seconds. It's going to get updates every 60 seconds, and it's going to hold on to that information for 180 seconds before it expires that information.

Now let's go ahead and take a look at the neighbors that are attached to this device. CDP makes a neighbor connection with these other devices. If we do a show cdp neighbor, we can see what those neighbors are, and I've got three devices plugged into here. One of them is called r1.andy.lan, one is hq-s2.andy.lan, one is hq-3.andy.lan, and then this device right here is hq-s1.

For these different devices, it shows you what interface it's plugged into, it shows the hold time — so when it will actually expire that if it doesn't get an update — and then it gives some information about the platform and the port that this is plugged into on the other side. So on switch 1's side, but on the switch 3 side, its fa047 is the port that it's plugged into.

There's actually a lot more information that we can get out of this too. If I do show cdp neighbors detail, then I can see a lot more information. Here's router 1: it gives the IP address, it gives the IPv6 link local address right here, and then the global unicast address. It shows some of the capabilities that it has, it shows the software that it's running — it shows all sorts of information about this device. So there's a lot of information that you can gather from this.

Turning CDP Off and Back On

Some people would like to turn this off because of security concerns: if somebody plugs in devices, it's a way to explore the different devices on the network. Although I will say that CDP does add certain functionality, and you can use it for troubleshooting, so you're going to have to weigh out the pros and cons on whether you want to turn CDP off or keep it on.

You can turn it off; it's pretty easy to turn off. What we need to do is be in the global configuration mode, and we just type in no cdp run. Now we've turned it off. If I do show, it is not enabled, so it's showing me that it's not enabled. If I do show cdp neighbors, it's not going to show me that either, because it's not enabled, so I can't run any of those commands.

To turn it back on, all I have to do is cdp run, and now it's back on. So I can type in these commands again and start seeing the information. My neighbors are not going to immediately pop up in here, because once again it's going to send out advertisements every 60 seconds, so it's just going to be whenever it hits it at the right time. Looks like s3 finally sent its advertisement out and let s1 know that it exists. And there's s2, now shows up in there, and then r1 should show up here in just a short period of time.

Turning CDP Off on a Single Interface

Now let's say, as an example, I don't want maybe r1 to show up in here. I can actually turn off a single interface so I'm not sending advertisements out. I might want to do this for, once again, security concerns — maybe I have security concerns over the device that's plugged into r1, and so I want to turn it off.

To do that, I can get into the interface. It should be popping up here — there we go, finally pops up. So what I'm going to do is jump into the interface that that one's plugged into. So that's the interface that I'm going to jump into: interface fa, hit enter. And then I will type in no cdp enable, and that's turning it off on that single interface, 47.

I can see that it actually shows that on the running configuration. It will not immediately take effect; it's going to wait that 180 seconds before it retires and it goes away on here. So it's going to exist on here for another 180 seconds before it actually goes away.

Now I'm going to reverse this just by typing in cdp enable. I'm going to hit enter, and now it should start getting advertisements again for the CDP neighbors.

About TechKnowSurge

TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.

Explore free tools and programs →