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.
Cisco Discovery Protocol (CDP)
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.
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.
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.
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.
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 →