Wednesday, July 20, 2011

Top Ten Cisco IOS Commands - 4) sh cdp neighbor

CDP (Cisco discovery protocol) is a layer 2 proprietary protocol for Cisco devices. It sends announcements (default is every 60 seconds) about IOS version, IP address, hostname, etc. to multicast address 0100-0ccc-cccc on each connected interface. The type of information that you receive from the "show cdp neighbors" command varies depending on the version of IOS you are running. CDP can be enabled on a per-interface basis and I would recommend disabling it on external facing interfaces. (You may not want devices outside your network to glean anything from the CDP protocol running on your router!) Also, it is often used in conjunction with snmp by some monitoring software to map networks, poll IOS versions, etc.

Here are some examples...

R1# sh cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
                  D - Remote, C - CVTA, M - Two-port Mac Relay
Device ID                   Local Intrfce     Holdtme    Capability    Platform     Port ID
SEPE9CA70FB2479  Fas 3/0/11        125             H P M        IP Phone     Port 1            Fas 1/0/48        134             R S I          2821            Gig 0/0.1

R1# sh cdp neighbors ?
  Async                     Async interface
  Auto-Template      Auto-Template interface
  BVI                          Bridge-Group Virtual Interface
  CTunnel                 CTunnel interface
  Dialer                      Dialer interface
  FastEthernet         FastEthernet IEEE 802.3
  Filter                       Filter interface
  Filtergroup            Filter Group interface
  GigabitEthernet   GigabitEthernet IEEE 802.3z
  GroupVI                Group Virtual interface
  Lex                        Lex interface
  Port-channel        Ethernet Channel of interfaces
  Portgroup             Portgroup interface
  Pos-channel        POS Channel of interfaces
  Tunnel                  Tunnel interface
  Vif                          PGM Multicast Host interface
  Virtual-Template Virtual Template interface
  Virtual-TokenRingVirtual TokenRing
  Vlan                      Catalyst Vlans
  detail                    Show detailed information
  fcpa                      Fiber Channel
  |                            Output modifiers

R1# sh cdp neighbors detail
Device ID: SEPE9CA70FB2479
Entry address(es):
  IP address:
Platform: Cisco IP Phone 7975,  Capabilities: Host Phone Two-port Mac Relay
Interface: FastEthernet3/0/11,  Port ID (outgoing port): Port 1
Holdtime : 178 sec
Second Port Status: Up

advertisement version: 2
Duplex: full
Power drawn: 12.000 Watts
Power request id: 31097, Power management id: 3
Power request levels are:12000 0 0 0 0
Management address(es):
Device ID:
Entry address(es):
  IP address:
Platform: Cisco 2821,  Capabilities: Router Switch IGMP
Interface: FastEthernet1/0/48,  Port ID (outgoing port): GigabitEthernet0/0.1
Holdtime : 127 sec

advertisement version: 2
VTP Management Domain: ''
Duplex: full
Management address(es):

R1# sh cdp traffic
CDP counters :
        Total packets output: 393013, Input: 15743
        Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
        No memory: 0, Invalid packet: 0,
        CDP version 1 advertisements output: 0, Input: 0
        CDP version 2 advertisements output: 393013, Input: 15743

R1# sh cdp interface Fa1/0/48
FastEthernet1/0/48 is up, line protocol is up
  Encapsulation ARPA
  Sending CDP packets every 60 seconds
  Holdtime is 180 seconds

As I mentioned, you can and should disable it on some interfaces...

R1# config t
R1(config)# int fa0/0
R1(config-if)# no cdp enable

No comments:

Post a Comment