CDP : CDP, short for Cisco Discovery Protocol runs over Layer 2 (the data link layer) on all Cisco routers, bridges, access servers, and switches. CDP allows network management applications to discover Cisco devices that are neighbors of already known devices. CDP runs on all LAN and WAN media that support SubNetwork Access Protocol (SNAP). Cisco Discovery Protocol (CDP) is a protocol supported by Cisco devices and gives limited information about the devices and used for automatic discovery of Cisco networking components in a network.
The following are true about CDP:
1. CDP - Cisco Discovery Protocol is a Cisco proprietary Layer 2 protocol.
2. CDP uses a multicast packet to the common destination address 01-00-0c-cc-cc.
3. CDP packets are sent out with a non zero TTL after an interface is enabled and with a zero TTL value immediately before and interface is made idle. This enables the neighbouring devices to quickly discover the state of neighbours.
4. CDP packets will never be forwarded beyond the directly connected devices. To find CDP information on indirectly connected routers, administrators can "telnet" to the intended destination device and run CDP command.
The following command sets the cdp timer, holdtime
R1(config)#cdp timer 30
R1(config)#cdp holdtime 90
The "Show cdp interface" command displays the status of all interfaces that are running cdp. For determining the neighbouring devices in a Cisco network, you can use the command "show cdp neighbours".
The following example is sample output from the show cdp neighbors command.
The Device ID column in the output indicates the remote node ID and the Port ID column indicates the remote port.
The command : Switch#show cdp interface [<type> <mod>/<num>]
Displays the CDP information pertaining to a specific interface.
The command : Switch#show cdp neighbors [<type> <mod>/<num> | vlan <vlan-id>][detail]
Displays the cdp information in detail, including the IP address for telnetting to the neighbor device.
LLDP : LLDP(Link Layer Discover Protocol) is a neighbor discovery protocol that is used for network devices to advertise information about themselves to other devices on the network. LLDP like CDP, runs over the data-link layer of your network that includes a non Cisco devices or different network layer protocols.
LLDP supports a set of attributes that it uses to discover neighbor devices. These attributes contain type, length, and value descriptions and are referred to as TLVs. LLDP supported devices can use TLVs to receive and send information to their neighbors. Details such as configuration information, device capabilities, and device identity can be advertised using this protocol.
To globally disable LLDP the following command is used
Switch(config)#no lldp run
To globally enable lldp following command is used
clear lldp counters - Resets the traffic and error counters to zero.
clear lldp table - Deletes the LLDP table of information about neighbors.
show lldp - Displays global information, such as frequency of transmissions, the holdtime for packets being sent, and the delay time for LLDP to initialize on an interface.
show lldp entry entry-name - Displays information about a specific neighbor.
You can enter an asterisk (*) to display all neighbors, or you can enter the name of the neighbor about which you want information.
show lldp errors - Displays LLDP computational errors and overflows.
show lldp interface[interface-id] - Displays information about interfaces where LLDP is enabled. You can limit the display to the interface about which you want information.
show lldp neighbors - displays information about neighbors.
Typical output show lldp neighbors command output is shown below
show lldp neighbors[interface-id][detail] - Displays information about neighbors, including device type, interface type and number, holdtime settings, capabilities, and port ID.
You can limit the display to neighbors of a specific interface or expand the display to provide more detailed information.
show lldp traffic - Displays LLDP counters, including the number of packets sent and received, number of packets discarded, and number of unrecognized TLVs.
The following example shows sample output for statistics for all LLDP traffic on the system
show lldp traffic Field Descriptions
|Total frames out||Number of LLDP advertisements sent from the device.|
|Total entries aged||Number of LLDP neighbor entries removed due to expiration of the hold time.|
|Total frames in||Number of LLDP advertisements received by the device.|
|Total frames received in error||Number of times the LLDP advertisements contained errors of any type.|
|Total frames discarded||Number of times the LLDP process discarded an incoming advertisement.|
|Total TLVs discarded||Number of times the LLDP process discarded a Type Length Value (TLV) from an LLDP frame.|
|Total TLVs unrecognized||Number of TLVs that could not be processed because the content of the TLV was not recognized by the device or the contents of the TLV were incorrectly specified.|