CCNA實驗二(cisco發現協議CDP)網絡
1.實驗目的:異步
掌握思科路由器CDP配置方法。
掌握經過CDP查看鄰居設備信息ide
2.實驗原理:orm
CDP協議版本:CDP協議分爲CDPv1和CDPv2兩個版本,cisco路由器12.0(3)T或以上
的IOS版本支持CDPv2.在10.3到12.0(3)T版本的IOS中CDPv1協議默認是開啓的。blog
經過CDP協議,思科設備可以自動發現鄰居交換機、路由器的相關信息,如設備名
稱、版本信息、相連接的鏈路物理方式以及IP地址。接口
CDP有兩個全局參數:CDP timer(CDP定時器)和CDP holdtime(保持時間)ci
CDP定時器是多長時間將CDP數據包傳輸到全部接口的時間量。路由
CDP保持時間是設備保留從相鄰設備接收到的數據包的時間量。get
3.CDP命令簡介:it
cdp run命令:
這個命令是用來在全局模式下開啓CDP協議,默認狀況下,CDP協議在全局模式下是開啓的,咱們能夠經過使用no cdp run命令來關閉CDP協議。這樣作的好處是CDP協議不會按期發送CDP消息,從而節省了帶寬。
cdp enable命令:
這個命令須要在端口模式下配置,它在一個特定的端口開啓CDP協議,在默認狀況下,CDP支持全部的端口發送和接收CDP協議消息,但是在例如異步端口,CDP協議是關閉的。咱們也能夠經過使用no cdp enable來在某個端口關閉CDP協議消息更新。
提示:若是在全局模式下用no cdp run命令手動關閉了CDP協議,網絡端口就不能開啓CDP協議。
clear cdp counters命令:
這個命令是用來重置CDP協議流量計數器的,當使用這個命令後,咱們再用show cdp traffic命令時,就會看到全部的進出CDP數據包信息等信息都被清空了。
show cdp命令:
這個命令的功能是顯示發送CDP協議消息的間隔時間。咱們還能夠經過這個命令來查看CDP協議的版本信息。
show cdp entry {*|device-name[*][protocol | version]}
咱們能夠用show cdp entry命令來查看特定鄰居設備的信息,經過這個命令,咱們能夠查看特定鄰居的IP地址、硬件平臺、相鏈接的端口、IOS版本信息。
show cdp interface [type number]
若是你想查看CDP協議在特定端口是開啓的仍是關閉的,能夠使用show cdp interface命令,這個命令也能夠顯示CDP的消息更新時間等內容。
show cdp neighbors [type number] [detail]
用show cdp neighbors命令咱們能夠得到相鏈接的CDP鄰居的平臺、設備類型和相鏈接的端口等信息。
4.實驗拓撲圖:
5.實驗步驟:
1)在RTA,RTB和RTC上啓用CDP協議
RTA#config t
Enter configuration commands, one per line. End with CNTL/Z.
RTA(config)#cdp run //啓用全局CDP,no cdp run關閉CDP
RTA(config)#
單獨開啓某個端口的CDP(前提是全局CDP開啓)
RTA#config t
Enter configuration commands, one per line. End with CNTL/Z.
RTA(config)#interface fa0/0
RTA(config-if)#cdp enable //關閉使用no cdp enable
RTA(config-if)#
2)經過CDP查看各類信息
查看CDP相關命令
RTA#show cdp ?
entry Information for specific neighbor entry
interface CDP interface status and configuration
neighbors CDP neighbor entries
查看全部鄰居彙總信息
RTA#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
SW-L2 Fas 0/0 157 S 2950 Fas 0/24
RTB Ser 0/0/0 164 R C2800 Ser 0/0/0
RTC Ser 0/0/1 147 R C2800 Ser 0/0/1
查看全部鄰居詳細信息
RTA#show cdp neighbors detail
Device ID: SW-L2
Entry address(es):
Platform: cisco 2950, Capabilities: Switch
Interface: FastEthernet0/0, Port ID (outgoing port): FastEthernet0/24
Holdtime: 175
Version :
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA4, RELEASE SOFTWARE(fc1)
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Wed 18-May-05 22:31 by jharirba
advertisement version: 2
Duplex: full
---------------------------
Device ID: RTB
Entry address(es):
IP address : 1.1.1.2
Platform: cisco C2800, Capabilities: Router
Interface: Serial0/0/0, Port ID (outgoing port): Serial0/0/0
Holdtime: 123
Version :
Cisco IOS Software, 2800 Software (C2800NM-IPBASE-M), Version 12.3(14)T7, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by cisco Systems, Inc.
Compiled Wed 3-Nov-06 06:50 by miwang
advertisement version: 2
Duplex: full
---------------------------
Device ID: RTC
Entry address(es):
IP address : 2.2.2.2
Platform: cisco C2800, Capabilities: Router
Interface: Serial0/0/1, Port ID (outgoing port): Serial0/0/1
Holdtime: 166
Version :
Cisco IOS Software, 2800 Software (C2800NM-IPBASE-M), Version 12.3(14)T7, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by cisco Systems, Inc.
Compiled Wed 3-Nov-06 06:50 by miwang
advertisement version: 2
Duplex: full
查看全部鄰居詳細信息也可用
RTA#show cdp entry * //等同於show cdp neighbors detail
Device ID: RTC
Entry address(es):
IP address : 2.2.2.2
Platform: cisco C2800, Capabilities: Router
Interface: Serial0/0/1, Port ID (outgoing port): Serial0/0/1
Holdtime: 173
Version :
Cisco IOS Software, 2800 Software (C2800NM-IPBASE-M), Version 12.3(14)T7, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by cisco Systems, Inc.
Compiled Wed 3-Nov-06 06:50 by miwang
advertisement version: 2
Duplex: full
---------------------------
Device ID: SW-L2
Entry address(es):
Platform: cisco 2950, Capabilities: Switch
Interface: FastEthernet0/0, Port ID (outgoing port): FastEthernet0/24
Holdtime: 123
Version :
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA4, RELEASE SOFTWARE(fc1)
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Wed 18-May-05 22:31 by jharirba
advertisement version: 2
Duplex: full
---------------------------
Device ID: RTB
Entry address(es):
IP address : 1.1.1.2
Platform: cisco C2800, Capabilities: Router
Interface: Serial0/0/0, Port ID (outgoing port): Serial0/0/0
Holdtime: 130
Version :
Cisco IOS Software, 2800 Software (C2800NM-IPBASE-M), Version 12.3(14)T7, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by cisco Systems, Inc.
Compiled Wed 3-Nov-06 06:50 by miwang
advertisement version: 2
Duplex: full
查看RTA其中一個鄰居RTC的詳細信息
RTA#show cdp entry RTC
Device ID: RTC
Entry address(es):
IP address : 2.2.2.2
Platform: cisco C2800, Capabilities: Router
Interface: Serial0/0/1, Port ID (outgoing port): Serial0/0/1
Holdtime: 132
Version :
Cisco IOS Software, 2800 Software (C2800NM-IPBASE-M), Version 12.3(14)T7, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by cisco Systems, Inc.
Compiled Wed 3-Nov-06 06:50 by miwang
advertisement version: 2 Duplex: full ---------------------------