实验7:CDP<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1. 实验目的

通过本实验,读者可以掌握如下技能:

1) 查找CDP 邻居

2) 熟悉CDP 的配置

2. 实验拓扑

2-11 实验7 拓扑图

3. 实验步骤

1) 步骤1:打开接口

R1(config)#int g0/0

R1(config-if)#no shutdown

R1(config-if)#int s0/0/0

R1(config-if)#no shutdown

R2(config)#int g0/0

R2(config-if)#no shutdown

R2(config-if)#int s0/0/0

R2(config-if)#no shutdown

R2(config-if)#clock rate 128000

//以上是打开路由器间互连的各个接口,而默认时交换机S1 的所有接口就是打开的。

2) 步骤:查看CDP 配置

R1#show cdp

Global CDP information: Global CDP information:

Sending CDP packets every 60 seconds

Sending a holdtime value of 180 seconds

Sending CDPv2 advertisements is enabled

//默认时CDP 是运行的,每60 秒从接口发送cdp 消息;发送出的CDP 消息,邻居会为它保

180

R1#show cdp interface

GigabitEthernet0/0 is up, line protocol is up

Encapsulation ARPA

Sending CDP packets every 60 seconds

Holdtime is 180 seconds

GigabitEthernet0/1 is administratively down, line protocol is down

Encapsulation ARPA

Sending CDP packets every 60 seconds

Holdtime is 180 seconds

Serial0/0/0 is down, line protocol is down

Encapsulation HDLC

Sending CDP packets every 60 seconds

Holdtime is 180 seconds

Serial0/0/1 is administratively down, line protocol is down

Encapsulation HDLC

Sending CDP packets every 60 seconds

Holdtime is 180 seconds

//以上显示在哪些接口运行CDP 协议

3) 步骤3:查看CDP 邻居

R1#show cdp neighbors

Device ID Local Intrfce Holdtme Capability Platform Port ID

R2 Ser 0/0/0 137 R S I 2821 Ser 0/0/0

S1 Gig 0/0 172 S I WS-C3560- Fas 0/1

//以上显示R1 路由器有两个邻居:R2 S1。“Device ID”表示邻居的主机名;“Local Intrfce

表明R1 通过该接口和邻居连接,注意是R1 上的接口;“Holdtme”指收到邻居发送的CDP

消息的时间,采用倒计时;“Capability”表明邻居是什么设备,第一、二行Capability Codes

对各符号进行了说明;“Platform”指明了邻居的硬件型号;“Port ID”指明了R1 是连接对

方的哪个接口上。

R1#show cdp entry R2

-------------------------

Device ID: R2

Entry address(es):

Platform: Cisco 2821, Capabilities: Router Switch IGMP

Interface: Serial0/0/0, Port ID (outgoing port): Serial0/0/0

Holdtime : 158 sec

Version :

Cisco IOS Software, 2800 Software (C2800NM-ADVENTERPRISEK9-M), Version 12.4(11)T1, RELEASE

SOFTWARE (fc5)

Technical Support: http://www.cisco.com/techsupport

Copyright (c) 1986-2007 by Cisco Systems, Inc.

Compiled Thu 25-Jan-07 12:50 by prod_rel_team

advertisement version: 2

VTP Management Domain: ''

//以上是显示邻居R2 的详细信息,甚至可以知道邻居的IOS 版本

R1#clear cdp table

//清除CDP

4) 步骤4:关、启CDP;调整CDP 参数

R1(config)#int g0/0

R1(config-if)#no cdp enable

//以上是在g0/0 接口上关闭cdp,其他接口还运行CDP

R1(config-if)#exit

R1(config)#no cdp run //以上是在整个路由器上关闭cdp

R1(config)#cdp run //在整个路由器上打开cdp

R1(config)#cdp timer 30 //调整CDP 消息发送时间为30

R1(config)#cdp holdtime 120

//调整CDP 消息的holdtime 120 ,对方收到该路由器发送的CDP 消息后将保持120

R1#show cdp

Global CDP information:

Sending CDP packets every 30 seconds

Sending a holdtime value of 120 seconds

Sending CDPv2 advertisements is enabled