实验目的
- 了解思科发现协议CDP的运行原理
- 掌握思科发现协议CDP的配置方法
实验拓扑
实验需求
- 根据实验拓扑图,完成设备的基本配置;
- 在R1上使用CDP查看SW1和R2的设备信息;
- 注意:CDP默认已经运行,不需要打开。
实验步骤
步骤1:设备的基本配置
配置R1:
Router>enable
Router#configure terminal
Router(config)#hostname R1
R1(config)#no ip domain-lookup
R1(config)#line console 0
R1(config-line)#exec-timeout 0 0
R1(config-line)#logging synchronous
R1(config-line)#exit
R1(config)#interface ethernet0/0
R1(config-if)#ip address 192.168.1.254 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface ethernet0/1
R1(config-if)#ip address 192.168.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#end
R1#
配置R2:
Router>enable
Router#configure terminal
Router(config)#hostname R2
R2(config)#no ip domain-lookup
R2(config)#line console 0
R2(config-line)#exec-timeout 0 0
R2(config-line)#logging synchronous
R2(config-line)#exit
R2(config)#interface ethernet0/0
R2(config-if)#ip address 192.168.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#end
R2#
配置SW1:
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW1
SW1(config)#no ip domain-lookup
SW1(config)#line console 0
SW1(config-line)#exec-timeout 0 0
SW1(config-line)#logging synchronous
SW1(config-line)#exit
SW1(config)#interface vlan 1
SW1(config-if)#ip address 192.168.1.1 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#ip default-gateway 192.168.1.254
SW1(config)#end
SW1#
实验检查
步骤1:检查设备的接口状态
检查R1:
R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.1.254 YES manual up up
Ethernet0/1 192.168.12.1 YES manual up up
Ethernet0/2 unassigned YES unset administratively down down
Ethernet0/3 unassigned YES unset administratively down down
R1使用到的接口已经配置好IP地址,并且是up up状态。
检查R2:
R2#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.12.2 YES manual up up
Ethernet0/1 unassigned YES TFTP administratively down down
Ethernet0/2 unassigned YES unset administratively down down
Ethernet0/3 unassigned YES unset administratively down down
R2使用到的接口已经配置好IP地址,并且是up up状态。
检查SW1:
SW1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 unassigned YES unset up up
Ethernet0/1 unassigned YES unset up up
Ethernet0/2 unassigned YES unset up up
Ethernet0/3 unassigned YES unset up up
Vlan1 192.168.1.1 YES manual up up
SW1使用到的接口已经配置好IP地址,并且是up up状态。
步骤2:使用CDP查看物理相连的设备信息
检查R1上运行CDP的接口:
R1#show cdp interface
Ethernet0/0 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds //CDP报文每60秒发送一次
Holdtime is 180 seconds //CDP保持时间是180秒
Ethernet0/1 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet0/2 is administratively down, line protocol is down
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet0/3 is administratively down, line protocol is down
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
cdp enabled interfaces : 4
interfaces up : 2
interfaces down : 2
R1的E0/0和E0/1接口已经运行CDP。
检查R1上的CDP邻居:
R1#show 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
SW1 Eth 0/0 169 R S I Linux Uni Eth 0/0
R2 Eth 0/1 163 R B Linux Uni Eth 0/0
Total cdp entries displayed : 2
R1上能够看到SW1和R2两个CDP邻居。
检查R1上的CDP条目:
R1#show cdp entry *
Device ID: SW1 //R1的CDP邻居SW1
Entry address(es):
IP address: 192.168.1.1 //SW1的IP地址
Platform: Linux Unix, Capabilities: Router Switch IGMP
Interface: Ethernet0/0, Port ID (outgoing port): Ethernet0/0 //R1的E0/0连接到了SW1的E0/0
Holdtime : 132 sec
Version :
Cisco IOS Software, Linux Software (I86BI_LINUXL2-ADVENTERPRISEK9-M), Version 15.2(CML_NIGHTLY_20190423)FLO_DSGS7, EARLY DEPLOYMENT DEVELOPMENT BUILD, synced to V152_6_0_81_E
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2019 by Cisco Systems, Inc.
Compiled Tue 23-Apr-19 02:38 by mmen
advertisement version: 2
VTP Management Domain: ''
Native VLAN: 1
Duplex: full
Management address(es):
IP address: 192.168.1.1
Device ID: R2 //R1的CDP邻居R2
Entry address(es):
IP address: 192.168.12.2 //R2的IP地址
Platform: Linux Unix, Capabilities: Router Source-Route-Bridge
Interface: Ethernet0/1, Port ID (outgoing port): Ethernet0/0 //R1的E0/1连接到了R2的E0/0
Holdtime : 124 sec
Version :
Cisco IOS Software, Linux Software (I86BI_LINUX-ADVENTERPRISEK9-M), Version 15.7(3)M2, DEVELOPMENT TEST SOFTWARE
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2018 by Cisco Systems, Inc.
Compiled Wed 28-Mar-18 11:18 by prod_rel_team
advertisement version: 2
Management address(es):
IP address: 192.168.12.2
R1有两个CDP邻居,分别是SW1和R2。
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。