1.show cdp 显示cdp更新时间及保持时间
R1#sh cdp
*Mar 1 00:14:28.951: %SYS-5-CONFIG_I: Configured from console by console
R1#sh cdp nei
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 0/0 167 R S I 30 Ser 0/0
2.show cdp neighors 显示每个接口的邻居信息
R1#sh cdp nei
R1#sh cdp neighbors
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 0/0 142 R S I 30 Ser 0
3.show cdp interface 显示各端口的cdp状态。
R1#sh cdp int
R1#sh cdp interface
Serial0/0 is up, line protocol is up
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial0/1 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial0/2 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial0/3 is administratively down, line protocol is down
Encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
FastEthernet1/0 is administratively down, line protocol is down
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
4.show cdp traffic (显示cdp 广播的数量统计)本命令显示路由器已发送和接收了多少cdp报文。也显示收到了多少错误的cdp报文。
R1#sh cdp tra
R1#sh cdp traffic
CDP counters :
Total packets output: 12, Input: 6
Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
No memory: 0, Invalid packet: 0, Fragmented: 0
CDP version 1 advertisements output: 0, Input: 0
CDP version 2 advertisements output: 12, Input: 6
5.clear cdp counters 计数从0重新开始
R1#clear cdp counters
R1#
6.clear cdp table 将清除路由器的CDP表。
R1#clear cdp table
R1#
7.cdp run 使用cdp应用到整个路由器上,而应用no cdp run 命令将废除任何cdp功能。因为缺省设置为应用cdp,故在路由器配置总不在出现,本命令是全局模式
R1(config)#cdp run
R1(config)#
R1(config)#no cdp run
R1(config)#
8.cdp enable和no cdp enable 在接口下启用cdp 和关闭cdp
R1(config-if)#cdp enable
R1(config-if)#
R1(config-if)#no cdp enable
R1(config-if)#
9.cdp timer 本命令设置路由器发送cdp更新数据的间隔,缺省设置为60s。本命令为全局模式下。Cdp holdtime 设置保持时间
R1(config)#cdp timer 60
R1(config)#
R1(config)#cdp h
R1(config)#cdp holdtime 180
R1(config)#
10.debug cdo packers 调试
R1#debug cdp packets
CDP packet info debugging is on
R1#
11.show cdp entry * 显示整个cdp 信息
R1#show cdp entry *
-------------------------
Device ID: R2
Entry address(es):
Platform: Cisco 30, Capabilities: Router Switch IGMP
Interface: Serial0/0, Port ID (outgoing port): Serial0/0
Holdtime : 134 sec
Version :
Cisco IOS Software, 3600 Software (C30-IS-M), Version 12.4(10), RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Wed 16-Aug-06 04:04 by prod_rel_team
advertisement version: 2
VTP Management Domain: ''
R1#
*Mar 1 00:49:19.171: CDP-PA: Packet received from R2 on interface Serial0/0
*Mar 1 00:49:19.175: **Entry found in cache**
R1#
*Mar 1 00:49:44.723: CDP-PA: version 2 packet sent out on Serial0/0
cdp更新时间的设置范围:
R2(config)#cdp timer ?
<5-254> Rate at which CDP packets are sent (in sec)
cdp 保持时间的设置范围:
R2(config)#cdp holdtime ?
<10-255> Length of time (in sec) that receiver must keep this packet
show cdp entry * protocols 显示每个直连邻居的ip地址
R2#sh cdp entry * protocol
Protocol information for R1 :
IP address: 192.168.1.1
show cdp entry * version 显示邻居打的ios版本
R2#sh cdp entry * version
Version information for R1 :
Cisco IOS Software, 3600 Software (C30-IS-M), Version 12.4(10), RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Wed 16-Aug-06 04:04 by prod_rel_team
Show cdp entry * 和show cdp neighbors detail 命令一样
R2#sh cdp neighbors detail
-------------------------
Device ID: R1
Entry address(es):
IP address: 192.168.1.1
Platform: Cisco 30, Capabilities: Router Switch IGMP
Interface: Serial0/0, Port ID (outgoing port): Serial0/0
Holdtime : 136 sec
Version :
Cisco IOS Software, 3600 Software (C30-IS-M), Version 12.4(10), RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Wed 16-Aug-06 04:04 by prod_rel_team
advertisement version: 2
VTP Management Domain: ''
R2#sh cdp ent
R2#sh cdp entry *
-------------------------
Device ID: R1
Entry address(es):
IP address: 192.168.1.1
Platform: Cisco 30, Capabilities: Router Switch IGMP
Interface: Serial0/0, Port ID (outgoing port): Serial0/0
Holdtime : 176 sec
Version :
Cisco IOS Software, 3600 Software (C30-IS-M), Version 12.4(10), RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Wed 16-Aug-06 04:04 by prod_rel_team
advertisement version: 2
VTP Management Domain: ''
Device ID 直连设备的主机名
Local Interface 要接收cdp数据包的端口或接口
Holdtime 如果没有接收到其他CDP数据包,路由器在丢弃接收到的信息之前将要保存的时间量。
Capability 邻居设备的性能,如路由器、交换机或中继器。性能代码在命令中输出的顶端 列出
Platfirm 直连的Cisco 设备类型。
Port ID 组播cdp数据包的相邻设备的端口或接口。