Tuesday, September 22, 2015

Cisco discovery protocol aka CDP


                  You would have heard of CDP (Cisco discovery protocol )  if you are working in a environment related to networking. This is one of the vital tool which is used to pull information from the neighboring device. If you are working in a environment that you are not familiar with, then CDP is of great help to discover the network. There are certain tools in the market which uses CDP to built a network topology which the users can use for troubleshooting. By now you should know the draw back is this works only on Cisco devices. 

This article is written mainly to help people who are not into networking but still update diagrams.
                
Cisco discovery protocol (CDP) is a layer 2 protocol that is commonly used to obtain IP addresses of neighboring devices, interface information,discover platform etc. CDP is Cisco proprietary,media and protocol independent which Runs on all the devices manufactured by Cisco(router,switches etc. 

How CDP works in layer-2?
           By default,each device configured for CDP sends periodic  advertisements to a multicast address( 01-00-0c-cc-cc-cc) out of each connected network interface.Hold time,IP address etc are listed in the advertisement. Each device also listens to the periodic CDP messages sent by others in order to learn about neighboring devices and determine when their interfaces to the media go up or down. 
 Version-2 is the recent release of the protocol. The enhancement  includes error tracking which logs duplex mismatch,native VLAN mismatch on the console or the log buffer.The show commands show up more information which includes VTP domain,duplex settings, VLAN etc.

How does CDP information propagate to other switches? If you are aware every switch will have a default VLAN i.e VLAN 1 which is used for CDP and VTP messages. Note VLAN 1 can be shut but can not be removed from the switch. If tried you will get a error message as below.

Switch-1(config)#no int vlan 1
% Default interface VLAN 1 may not be deleted

Type-Length-Value fields (TLVs) are blocks of information embedded in CDP advertisements. Lets look at the TLV is version 2 which most of the recent devices have by default.


TLV

Definition

Device-ID TLV

Identifies the device name in the form of a character string.

Address TLV

Contains a list of network addresses of both receiving and sending devices.

Port-ID TLV

Identifies the port on which the CDP packet is sent.

Capabilities TLV

Describes the functional capability for the device in the form of a device type(switch,router etc)

Version TLV

Contains information about the software release version on which the device is running.

Platform TLV

Describes the hardware platform name of the device

IP Network Prefix TLV

Contains a list of network prefixes to which the sending device can forward IP packets. This information is in the form of the interface protocol and port number.

VTP Management Domain TLV

Advertises the system's configured VTP management domain name-string. Used by network operators to verify VTP domain configuration in adjacent network nodes.

Native VLAN TLV

Indicates, per interface, the assumed VLAN for untagged packets on the interface. CDP learns the native VLAN for an interface. This feature is implemented only for interfaces that support the IEEE 802.1Q protocol.

Full/Half Duplex TLV

Indicates status (duplex configuration) of CDP broadcast interface. Used by network operators to diagnose connectivity problems between adjacent network elements


 Let's take a look at the configuration, CDP can be enabled on the device or per interface in global configuration mode.
 Device: Switch-1(config)#cdp run
 Per interface: Switch-1(config-if)# cdp enable 

CDP transmission timer and hold down timer are the other parameters to be looked at. CDP transmission timer specifies frequency of transmission of CDP updates.
Switch-1(config)# cdp timer seconds       

CDP hold down timer Specifies the amount of time a receiving device should hold  the information sent by your device before discarding it.
Switch-1(config)# cdp holdtime seconds //

 show cdp can be used to verify if CDP is enabled/disabled.

Switch-1# show cdp
Global CDP information:
        Sending CDP packets every 60 seconds
        Sending a holdtime value of 180 seconds
        Sending CDPv2 advertisements is  enabled

 Show cdp neighbors detail is the command that list lot of information including VTP domain,duplex,platform of other device,
 interface, operating system etc.

Switch-1#show cdp neighbors detail
-------------------------
Device ID: Switch-3
Entry address(es):
  IP address: 10.19.169.83
Platform: cisco 7206VXR,  Capabilities: Router
Interface: Ethernet0,  Port ID (outgoing port): FastEthernet0/0/0
Holdtime : 123 sec

Version :
Cisco Internetwork Operating System Software
IOS (tm) 5800 Software (C5800-P4-M), Version 12.1(2)
Copyright (c) 1986-2002 by Cisco Systems, Inc.

advertisement version: 2
Duplex: half 
 
  
Further Reading:

CDP commands

CDP behaviour 

No comments:

Post a Comment