2.3 Configure and verify Layer 2 discovery protocols (Cisco Discovery Protocol and LLDP)
CDP or Cisco Discovery Protocol and LLDP or Link Layer Discovery Protocol allow different network devices to automatically discover each other. CDP is proprietary while LLDP is open source.
What can a device learn about another device through CDP?
- Device Identifier – the hostname of the remote device
- Address – the IP and MAC address of the remote device
- Port – the port on the remote device that we are connected to
- Capabilities – the capabilities of the remote device
- Platform – the model and IOS version running on the remote device
I can ask a router or switch to tell me about the neighbors it learned about through CDP by typing show cdp neighbors. I can view more details by typing show cdp neighbors detail.
The Local Interface is the port on the local device that connects to the neighboring device. The Port ID is the interface of the neighboring device that connects to the local device. We can also see the capabilities of the neighboring device.
In this case, our Switch connects from Port G0/0/23 to the neighboring Switch 2 Port G0/0/20. We also know that the neighboring switch model is a C2960.
CDP Neighbors only tells us about directly connected devices. A Cisco device won’t forward details about a neighbor to its other neighbors. For security reasons, we should disable CDP on any interface that doesn’t need it.
How do we check CDP?
- We can check if CDP is running by typing show cdp.
- We can check if cdp is running on an interface by typing show cdp interface <interface name>.
- We can check statistics by typing show cdp traffic.
Our router tells us that CDP runs every 60 seconds. That means that our router advertises itself to neighboring routers every 60 seconds.
Our router also tells us that the holdtime is 180 seconds. That means that if our router doesn’t receive a new CDP message from a neighboring router after 180 seconds, it removes it from its list of neighbors.
We can change the CDP time by typing
- cdp timer <seconds>
- cdp holdtime <seconds>
To enable LLDP, we type lldp run in global configuration mode. By default, even after enabling LLDP, it stays disabled on all the interfaces. We must manually enable it on any interface that requires it.
If we want an interface to stop sending LLDP messages, we can type no lldp transmit. We can enable it by typing lldp transmit. If we want an interface to ignore received LLDP messages, we type no lldp receive, and if we want to accept LLDP messages we type lldp receive.
I have configured LLDP on Interface G0/0/1. Now the router will both send and receive LLDP messages on that interface.
We can view the LLDP status by typing show lldp.
We can view our LLDP neighbors by typing show lldp neighbors. The output from show lldp neighbors is almost the same as the show cdp neighbors.
The difference between CDP and LLDP is that LLDP does not identify the neighbor’s platform or IGMP capabilities. Also, CDP lists a neighbor’s capabilities whether they are enabled or not, while LLDP only lists a neighbor’s capabilities when they are enabled. If we want to see a device’s full capabilities under LLDP, we must type show lldp neighbors detail.
Like CDP, LLDP has a timer to send messages and a hold time after which it removes a neighbor from its list.
We can change the LLDP time by typing
- lldp timer <seconds>
- lldp holdtime <seconds>