Explain the Working of CDP and LLDP Network Discovery Protocol
Sometimes we want to sit near our computer network devices, such as routers and switches, to collect information about connected network devices without the need to go there. We can perform such tasks through CDP and LLDP. CDP stands for Cisco Discovery Protocol while LLDP stands for Link Layer Discovery Protocol. Both perform the same task, but there is one difference between them. CDP works exclusively with Cisco networking devices, while LLDP is an open standard that functions across various vendor devices, such as between Cisco and HP switches or routers. We use CDP and LLDP commands for the neighbor device to determine which type of device is connected, and what the platform of the neighbor device is. CDP and LLDP are commands that tell about the neighbor device, which type of devices are connected, and what the platform of neighbor devices.
1) CDP
Lab setup for Cisco Discovery Protocol
Take R1, R2, and switch1 step by step and run the command “show CDP neighbors” command. Run the “show cdp neighbors” command first on R1.
Device ID: It tells about a device you are operating or it is a local device.
Local Interface: The local interface through which a device is connected to the other side
Hold time: How much it takes time to up
Capability: it shows whether it is a router or switch, R represents the router, while S, represents the switch
Platform: Which series of router or switch belongs to?
Port ID: The interface of the other side of the router or switch
So
From the above command, we noticed that there is a router on the right side, while there is a switch on the left side.
Run show cdp neighbor on R2
There is only Router R C2800 on the left side of Router R2,
Now take the switch and apply the command
Show CDP on the Switch
The cdp command on the switch shows that there is only one device which is Router R C2800.
Also, the cdp command doesn’t tell about the end device just as in the case of the switch because there is a PC connected to the switch but the cdp command on the switch doesn’t show it.
The network engineer can disable cdp on the interface level.
Disable CDP
R1(config)#interface FastEthernet 0/0
R1(config-if)#no cdp enable
Check cdp on R1, but it still shows cdp because of hold time, which is 180, and now 109, 101.
The hold time of the switch is 124 on interface Fast Ethernet 0/1. The hold time of R2 on interface Fast ethernet 0/0 is continuously decreasing to 27.
At last router R2 disappeared from the picture by completing 180 seconds of hold time.
So the #no cdp enable on interface Fast Ethernet 0/0 disable cdp only at that interface level. If you want to completely disable cdp on any device, then apply the command # no cdp run, which will completely disable cdp on that device as I am going to disable cdp on switch1.
Its hold time gradually decreases, as shown below.
After completing 180 seconds, the switch disappeared from the scene.
Also apply the command on Router R2, which states that the switch also disappears in the router.
Now, enable CDP on the Fast Ethernet 0/0 interface of the router, which connects to router R2.
Another command of cdp is # show cdp entry * which tells more detail of remote or neighbor devices just like its iOS, iOS version, cdp version, duplex, etc…
2) LLDP
LLDP is an open standard discovery protocol defined by IEEE under 802.2AB. It discovers information about neighbor’s devices. We can run LLDP on any vendor device, while CDP is a Cisco proprietary protocol. Cisco devices have LLDP disabled by default, but you can enable it with the command ‘lldp run’.
Lab Set up for LLDP
As LLDP is disabled by default,
The router doesn’t show any information about the neighbor device, i.e. switch1, because the lldp is not run by the switch by default. So we manually run on it by the command # lldp run.
Now check the output on the router.
Similarly, run the lldp neighbor command at the switch as below to check the output: