You can enable or disable Cisco Discovery Protocol on a router as a whole (global) or on a port-by-port (interface) basis. You can also view Cisco Discovery Protocol information with the show cdp command. This command has several keywords that enable access to different types of information and different levels of detail. The following example shows the different show cdpoptions.
您可以在路由器整體(全域)或逐一連接埠(介面)的層級啟用或停用 Cisco 探索協定。您也可以使用 show cdp 指令來檢視 CDP 資訊。此指令有多個關鍵字,可用來存取不同類型與不同詳細程度的資訊。以下範例顯示 show cdp的各種選項。
RouterA# show cdp ?
entry Information for specific neighbor entry
interface CDP interface status and configuration
neighbors CDP neighbor entries
traffic CDP statisticsThe Cisco Discovery Protocol is enabled by default on most interfaces (except for some legacy interfaces), but you can disable this functionality at the device and interface level.
大多數介面(部分舊式介面除外)預設會啟用 CDP,但您可以在裝置層級與介面層級停用此功能。
To prevent other Cisco Discovery Protocol capable devices from accessing information about a specific device, use the no cdp run global configuration command. To disable Cisco Discovery Protocol on an interface, use the no cdp enable command. To enable Cisco Discovery Protocol on an interface, use the cdp enable interface configuration command.
若要防止其他支援 CDP 的裝置取得特定裝置的資訊,請使用全域設定指令 no cdp run。若要在介面上停用 CDP,請使用 no cdp enable 指令。若要在介面上啟用 CDP,請使用介面設定指令 cdp enable。
RouterA(config)# no cdp run
! Disable CDP Globally
RouterA(config)# interface serial0/0/0
RouterA(config-if)# no cdp enable
! Disable CDP on just this interfaceThe show cdp neighbors command displays information about Cisco Discovery Protocol neighbors. The following example shows the Cisco Discovery Protocol output for Router A.
show cdp neighbors 指令會顯示 CDP 鄰居的相關資訊。以下範例顯示路由器 A 的 CDP 輸出結果。
For each Cisco Discovery Protocol neighbor, the following information is displayed:
對於每個 CDP 鄰居,會顯示以下資訊:
- Device ID裝置 ID
- Local interface—the interface on this device that is connected to the neighbor本地介面,即此裝置上連接到鄰居的介面
- Holdtime value, in seconds保留時間值(Holdtime),以秒為單位
- Device capability code裝置能力代碼
- Hardware platform硬體平台
- Port ID—the interface on the neighboring device that is connected to this device連接埠 ID,即鄰近裝置上連接到此裝置的介面
The hold time value indicates how long (in seconds) the receiving device should hold the Cisco Discovery Protocol information before discarding it.
保留時間值指出接收裝置在捨棄 CDP 資訊之前,應保留該資訊多長時間(以秒為單位)。
Cisco Discovery Protocol information is sent periodically; the hold time counts down, and if it reaches zero, the information is discarded.
CDP 資訊會定期傳送;保留時間會倒數計時,若倒數至零,該資訊就會被捨棄。
The format of the show cdp neighbors output varies among different types of devices, but the available information is generally consistent across devices.
show cdp neighbors 輸出的格式在不同類型的裝置間有所差異,但所提供的資訊在各裝置間大致一致。
You can use the show cdp neighbors command on a Cisco Catalyst switch to display the Cisco Discovery Protocol updates that the switch receives on the local interfaces. Note that on a switch, the local interface is referred to as the local port.
您可以在 Cisco Catalyst 交換器上使用 show cdp neighbors 指令,顯示交換器在本地介面上收到的 CDP 更新。請注意,在交換器上,本地介面稱為本地連接埠。
If you add the detail argument to the show cdp neighbors command, the resulting output includes additional information, such as the network layer addresses of neighboring devices. The output from the show cdp neighbors detail command is identical to the one that the show cdp entry * command produces.
若在 show cdp neighbors 指令中加上 detail 參數,輸出結果會包含更多資訊,例如鄰近裝置的網路層位址。show cdp neighbors detail 指令的輸出結果與 show cdp entry * 指令所產生的結果相同。
RouterA# show cdp neighbors detail
Device ID: RouterB
Entry address(es):
IP address: 10.1.1.2
Platform: Cisco 2811, Capabilities: Router Switch IGMP
Interface: Serial0/0/0, Port ID (outgoing port): Serial0/0/1
Holdtime : 155 sec
Version :
Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(12), RELEASE
SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Fri 17-Nov-06 12:02 by prod_rel_team