cdp(cisco discovery protocol,cisco發現協定)
思科專屬協定,可取得直接相連的鄰居資料
屬OSI layer2層,沒設IP也可交換資訊
不管上層協定,或vlan,…等為何,都可以使用
10.3版後才有此協定
ps:可取得鄰居ip,方便進行telnet
啟動cdp
(config)#[no] cdp run
預設是啟動狀態,若加no表示關閉
該介面啟動cdp
(config-if)#[no] cdp enable
預設是啟動狀態,若加no表示關閉
…………….
取得cdp計時器與保留期限
#show cdp
畫面大致如下:
Global CDP information:
Sending CDP packets every 60 seconds //每60秒送出multicast封包
Sending a holdtime value of 180 seconds //若過180sec仍然沒收到相鄰設備的cdp封包,則丟棄
Sending CDPv2 advertisements is enabled
收集鄰居資訊
#show cdp neighbor [detail]
[detail]可在多顯示部裝置的資訊,包括ip,version…等
ps:使用detail等同於show cdp entry *
畫面大致如下:
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
router1 Eth0 173 R 2621 Fas 0/0
router2 Bri0 173 R 2621 Bri 0
router3 Ser0 173 R 2501 Ser
加detail後畫面大致如下
————————-
Device ID: router2 //可用hostname指令設定名稱
Entry address(es):
IP address: 160.10.1.2 //鄰居ip位置
Platform: Boson 2621 , Capabilities: Router
Interface: Eth0, Port ID (outgoing port): Fas 0/0 //本地收到cdp資訊的eth0介面,和鄰居的fa0/0界面相連
Holdtime: 170 sec
Version :
Boson Operating System Software
Software, Version 12.1(16), RELEASE SOFTWARE (fc2)
Copyright (c) 1986-2001 by Systems, Inc.
Compiled Fri 02-Mar-01 17:34 by dchih
————————-
Device ID: router3
…以下省略
#show cdp entry *
可將設備訊息廣播給直接相鄰的鄰居,訊息包含了mac與ip位址和對外連接的介面
實體層若可正常運作,則可顯示出所有直接連到cisco的其他設備,若無法顯示可能第一層出現問題
ps:因提供資訊充足成為潛在安全風險,因此只可在cisco設備中使用
收集埠與界面資訊
#show cdp interface
畫面大致如下:
Serial0 is up, line protocol is up
encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial1 is down, line protocol is down
encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet0 is up, line protocol is up
encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Bri0 is up, line protocol is up
encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Bri0:1 is down, line protocol is down
encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Bri0:2 is down, line protocol is down
encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
收集界面交通資訊
#show cdp traffic
畫面大致如下:
Packets output: 415, Input: 514
Hdr syntax: 408, Chksum error: 0, Encaps failed: 6
No memory: 0, Invalid packet: 0, Fragmented: 0
…………………………..
設定cdp計時器
(config)#cdp timer < sec>
可設定幾秒詢問一次鄰居
設定cdp保留期限
(config)#cdp holdtime < sec>
ps
(config)#cdp ?
run
advertise-v2 CDP sends version-2 advertisements
holdtime Specify the holdtime (in sec) to be sent in packets
timer Specify the rate at which CDP packets are sent(in sec)