Thursday, September 4, 2008

Pipe-ology CDP

Ever need to get the Device name or IP address from other devices
connected to the router/switch you are currently in? A "show cdp
neighbors detail" will do the trick. But what if you have multiple
devices connected to your router or switch? Sifting through the output
could be painful. That's where the pipe (|) comes in. Our format is
show cdp neighbors detail | include [string1]|[string2]. Issue the
"sh cdp neighbors detail | include Device|IP" and we'll get the desired
output without the sifting. (sh cdp ne det | in Dev|IP - for short)

R1#sh cdp neighbors detail
-------------------------
Device ID: SW1.switch.net
Entry address(es):
IP address: 10.x.x.x
Platform: cisco WS-C2950G-24-EI, Capabilities: Switch IGMP
Interface: FastEthernet0/0.1, Port ID (outgoing port): FastEthernet0/24
Holdtime : 147 sec

Version :
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA11, RELEASE SOFTWARE (fc2)
Copyright (c) 1986-2008 by cisco Systems, Inc.
Compiled Tue 08-Jan-08 11:12 by amvarma

advertisement version: 2
Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27,

value=00000000FFFFFFFF010221FF0000000000000012009B7E00FF0000
VTP Management Domain: ''
Native VLAN: 1
Duplex: full

R1#

Using the pipe:

R1#sh cdp neighbors detail | include Device|IP
Device ID: SW1.switch.net
IP address: 10.5.5.50
R1#


Shortcut version:

R1#sh cdp ne det | in Dev|IP
Device ID: SW1.switch.net
IP address: 10.x.x.x
R1#

Note: IP addresses and Device names are blocked to protect the innocent. Also, the
strings are case sensitive.

No comments:

Post a Comment