In this lesson we'll continue studying layer 2 technologies. Today's theme is Cisco Discovery Protocol. This protocol comes in handy in many situations (trust boundary for Cisco IP Phones, auto qos and others).
What is Cisco Discovery Protocol?
CDP is Cisco proprietary layer 2 protocol. It is enabled by default on majority of Cisco devices including IP phones. It can work on any connections supporting SNAP (such as LANs, but also ATM and Frame-Relay). The only time you'll see the CDP turned off by default, is when you use frame-relay configured interfaces.
What does CDP do?
Every Cisco device using this protocol, reports information about itself by advertising special packets out of its all active interfaces. The important pieces of information it advertise include its:
- Hostname
- Platform
- Ports where CDP packets are advertised
- IOS version
- IP address
Let's take a quick tour through the CLI (command line interface) and see what major commands CDP allows us to use and what they show.
I'm connected to my Cisco switch SW1 and in the privileged mode type in the following command:
Pic. 1
Using our best friend '?' we can see the CDP options. The last line '
Pic. 2
Based on the output (Pic. 2) we see that CDP version 2 is enabled, the information packets (though technically should be called frames) are sent every 60 seconds. We also learn, that SW1 will keep CDP information it receives from its Cisco neighboring devices for 180 seconds (holdtime). Let's look at another CDP command:
Pic. 3
In the Pic. 3 we can see the traffic statistics such as CDP packets sent, received, any CDP encapsulation problems etc.
The below command (output in Pic. 4) will tell you which interfaces CDP is running on.
You can disable CDP on a specific interface or group of interfaces. For instance, if you do not want to run CDP on Fas0/1 interface, you could use the following command:
SW1#show cdp interface
You can disable CDP on a specific interface or group of interfaces. For instance, if you do not want to run CDP on Fas0/1 interface, you could use the following command:
SW1#configure terminal
SW1(config)#interface Fas0/1
SW1(config-if)#no cdp enable
If you want to disable CDP on a group of interfaces you can use 'interface range' command. For instance, disabling CDP on Fas0/1, Fas0/2, Fas0/5 and Fas0/8 would look like this:
SW1#configure terminal
SW1(config)#interface range fas0/1 - 2 , fas0/5 , fas0/8
SW1(config-if-range)#no cdp enable
NOTICE
If you use the 'interface range' command, the consecutive ports can be specified with '-' but make sure your use 'space' before and after '-' (fas0/1 - 2). The same applies to non-consecutive ports (fas0/5 , fas0/8). There is 'space' before and after the comma character ','.
As you will see later, CDP discloses some vital information (e.g. IOS version), so for the security reasons you may decide to turn off CDP altogether. Be careful before you do that though, as some application may rely on this protocol. Disabling CDP can cause cascading problems in your network. The command which disables CDP completely (on all interfaces) is:
SW1#configure terminal
SW1(config)#no cdp run
Pic. 4
Pic. 5
Dissecting the Pic. 5 output we learn the following:
- SW1 received CDP packets from the device named 'R1' (hostname).
- This CDP packet was sent from R1's Fas0/0 interface (the last column 'Port ID').
- SW1 received this CDP information packet on its Fas0/1 local interface ('Local Intrfce').
- This leads us to a conclusion that R1's Fas0/0 interface is directly connected to SW1's Fas0/1 interface.
- R1 neighbor is a router as the capability list shows 'R S I' (R=router, S=switching capability, I=IGMP support).
- R1 is 2611XM platform.
Pic. 6
It shows you information about IOS version running on R1, as well as its IP address 192.168.10.254 configured on Fas0/0 interface. Now you understand why you might consider turning off CDP on some interfaces. You do not want to show such details to a third party company (like your service provider), that connect to your devices.
Instead of using 'show cdp entry R1', you can also use the following command that displays detailed (similar to Pic. 6) output about ALL discovered neighbors :
SW1#show cdp neighbor detail
In lesson 11, you will learn the commands related to switch mac-address-table which was covered in theory only (lesson 9). Also, we'll hone all our skills we have obtained so far. Things will begin to fall into place. At least that's my hope.