思科发现协议CDP

思科发现协议

思科发现协议CDP是思科专有数据链路层协议,只能在思科路由器、交换机等设备上使用。CDP与网络层协议及物理层的连接介质无关,可以帮助网络管理者获得相邻设备的硬件和协议信息。
运行CDP的设备通过所有活动接口向邻居发送CDP分组,默认时间间隔60秒,这个时间称为CDP定时器。CDP分组不会被转发,所以只能在相邻设备之间传送相邻设备在接收到CDP分组后需要保持一个规定时间,默认180秒,称为CDP保持时间。两个时间都可以修改。

查看CDP

test#show cdp
Global CDP information:
    Sending CDP packets every 60 seconds
    Sending a holdtime value of 180 seconds
    Sending CDPv2 advertisements is enabled

启用/关闭CDP

启动:test(config)#cdp run
关闭:test(config)#no cdp run
关闭某个接口的CDP功能:test(config-if)#no cdp enable

显示相邻设备信息

show cdp neighbors显示相邻设备信息

test#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID    Local Intrfce   Holdtme    Capability   Platform    Port ID
router    Fas 0/0          168            R       C2800       Fas 0/1

show cdp neighbors detail 显示相邻设备详细信息
show cdp entry 【xxx】 显示相邻设备详细信息,xxx是想看的设备hostname,*查看所有设备信息

show cdp interface 查看相邻设备接口状态及接口上的CDP定时器和CDP保持时间。

test#show cdp interface
Vlan1 is administratively down, line protocol is down
  Sending CDP packets every 60 seconds
  Holdtime is 180 seconds
FastEthernet0/0 is up, line protocol is up
  Sending CDP packets every 60 seconds
  Holdtime is 180 seconds
FastEthernet0/1 is administratively down, line protocol is down
  Sending CDP packets every 60 seconds
  Holdtime is 180 seconds

如果要观察非相邻设备的运行状态,可以通过Telnet登录到其邻居设备,然后观察。
连接到互联网的接口可以考虑关闭CDP功能,降低网络被攻击的可能性。

posted @ 2021-04-25 10:21  一个只会爆零的小菜鸡  阅读(570)  评论(0)    收藏  举报