Wednesday, May 11, 2011

Gathering Neighbor Information Through CDP

The show cdp neighbor command delivers information about directly connected devices. It's important to remember that CDP packets aren't passed through a Cisco Switch and that you only see what's directly attached. So this means that if your router is connected to a switch, you won't see any of the devices hooked up to that switch.
The following output shows the show cdp neighbor command used on my R1 router.

R1#show cdp neighbor
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
R2               Ser 1/0            158           R       7206VXR   Ser 1/0
R3               Ser 1/1            150           R       7206VXR   Ser 1/0

Okay, we are directly connected with a console cable to the R1 Router. and the router is directly connect to two devices. We have one connection to the Router R2 and one connection to the router R3. The device ID shows the configured hostname of the connected devices, the local interface is our interface, and the port ID is the remote devices' directly connected interface. All you get to review are directly connected devices.

Given table summarizes the information displayed by the show cdp neighbor command for each device.

Device ID     |     the hostname of the device directly connected.

Local Interface     |     The port or interface on which you are receiving the CDP packet.

Holdtime     |     The amount of time the router will hold the information before discarding it if no more CDP packet are received.

Capability     |     The capability of the neighbor, such as the router, switch, or repeater. the capability codes are listed at the top of the command output.

Platform     |     The type of Cisco device directly connected. In the privious coutput, A Cisco 7200 router is attached directly to the 7200 router.

Port ID     |     The neighbor device's port or interface on which the CDP packets are multicast.


Another command that'll deliver the goods on neighbor information is the show cdp neighbors detail command. this command can be run on both routers and switches, and it displays detailed information about each device connected to the device you're running the command on. Check out this router output for an example:

R1#show cdp neighbors detail
-------------------------
Device ID: R2
Entry address(es):
  IP address: 12.1.1.2
Platform: Cisco 7206VXR,  Capabilities: Router
Interface: Serial1/0,  Port ID (outgoing port): Serial1/0
Holdtime : 123 sec

Version :
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(20)T, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 11-Jul-08 04:22 by prod_rel_team

advertisement version: 2

-------------------------
Device ID: R3
Entry address(es):
  IP address: 13.1.1.3
Platform: Cisco 7206VXR,  Capabilities: Router
Interface: Serial1/1,  Port ID (outgoing port): Serial1/0
Holdtime : 175 sec

Version :
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(20)T, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 11-Jul-08 04:22 by prod_rel_team

advertisement version: 2


What are we being shown here? First, we're given the hostname and IP address of all directly connected devices. In addition to the same information displayed by the show cdp neighbor command, the show cdp neighbor detail command gives us the IOS version of the neighbor device.

The show cdp entry * command displays the same information as the show cdp neighbors detail command. Here's an example of the router output using the show cdp entry * command:

R1#show cdp entry *

-------------------------
Device ID: R2
Entry address(es):
  IP address: 12.1.1.2
Platform: Cisco 7206VXR,  Capabilities: Router
Interface: Serial1/0,  Port ID (outgoing port): Serial1/0
Holdtime : 171 sec

Version :
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(20)T, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 11-Jul-08 04:22 by prod_rel_team

advertisement version: 2

-------------------------
Device ID: R3
Entry address(es):
  IP address: 13.1.1.3
Platform: Cisco 7206VXR,  Capabilities: Router
Interface: Serial1/1,  Port ID (outgoing port): Serial1/0
Holdtime : 163 sec

Version :
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(20)T, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 11-Jul-08 04:22 by prod_rel_team

advertisement version: 2

There isn't any difference between the show cdp neighbors detail and show cdp entry * commands. However, the show cdp entry * command has two options that the show cdp neighbors detail command does not:

R1#show cdp entry * ?
  protocol  Protocol information
  version   Version information
  |         Output modifiers
 


R1#show cdp entry * protocol
Protocol information for R2 :
  IP address: 12.1.1.2
Protocol information for R3 :
  IP address: 13.1.1.3

The preceding output of the show cdp entry * protocols command can show you just the IP addresses of each directly connected neighbor. The show cdp entry * version will show you only the IOS version of your directly connected neighbors:

R1#show cdp entry * version

Version information for R2 :
  Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(20)T, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 11-Jul-08 04:22 by prod_rel_team


Version information for R3 :
  Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(20)T, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 11-Jul-08 04:22 by prod_rel_team

Although the show cdp neighbors detail and show cdp entry commands are very similar, the show cdp entry command allows you to display only one line of output for each directly connected neighbor, whereas the show cdp neighbor detail command does not.

Source: CCNA: Cisco Certified Network Associate Study Guide, 6th Edition

No comments:

Post a Comment