1、实验目的
通过本实验可以掌握:
- LLDP特征。
- LLDP配置和调试方法。
- 通过LLDP查看设备直连邻居信息的方法。
2、实验拓扑
配置LLDP的实验拓扑如下图所示。
3、实验步骤
(1)配置路由器R1
R1(config)#lldp run //全局启用LLDP功能,默认是关闭的
R1(config)#interface gigabitEthernet 0/0
R1(config-if)#ip address 172.16.1.1 255.255.255.0
R1(config-if)#lldp receive //配置接口发送LLDP数据包,这是默认配置
R1(config-if)#lldp transmit //配置接收LLDP数据包,这是默认配置
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#
(2)配置交换机S1
S1(config)#lldp run
S1(config)#interface vlan 1
S1(config-if)#ip address 172.16.1.100 255.255.255.0
S1(config-if)#no shutdown
S1(config-if)#exit
4、实验调试
(1)查看LLDP运行的信息
R1#show lldp //查看LLDP运行的信息
Global LLDP Information:
Status: ACTIVE //LLDP为活跃状态
LLDP advertisements are sent every 30 seconds
LLDP hold time advertised is 120 seconds
LLDP interface reinitialisation delay is 2 seconds
R1#
以上输出表明LLDP状态是活跃的,每30秒从接口发送 LLDP消息。邻居收到LLDP消息后会放入自己的 LLDP 表中,并保存120秒。LLDP 接口重新初始化延时为2秒,可以避免因接口工作模式频繁改变而导致接口不断执行初始化操作。
LLDP
(2)查看接口LLDP的运行情况
R1#show lldp interface GigabitEthernet1/0/1 //查看接口LLDP的运行情况
GigabitEthernet1/0/1:
Tx: enabled //启用LLDP发送能力
Rx: enabled //启用LLDP接收能力
Tx state: IDLE //发送状态
Rx state: WAIT FOR FRAME //接收状态
R1#
(3)查看直连设备LLDP邻居的信息
R1#show lldp neighbors //查看直连设备LLDP邻居的信息
Capability codes:
(R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device
(W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other
Device ID Local Intf Hold-time Capability Port ID
S1 Gig0/0 120 R Gig1/0/1
Total entries displayed: 1
R1#
以上输出表明路由器RI有1个 LLDP邻居S1,各字段的含义如下所述。
- Device ID:表示LLDP邻居的主机名。
- Local Intf:本地接口,表示R1通过自己哪个接口和 LLDP邻居连接。
- Hold-time:维持时间。
- Capability:表示邻居的设备类型和功能,前两行Capability Codes对各符号进行了说明。
- Port ID:端口ID,表示R!与对方设备S1的哪个端口连接。
(4)查看直连设备LLDP邻居的详细信息
R1#show lldp neighbors detail //查看直连设备LLDP邻居的详细信息
------------------------------------------------
Chassis id: 0060.2F81.6201
Port id: Gig1/0/1
Port Description: GigabitEthernet1/0/1
System Name: S1
System Description:
Cisco IOS Software [Denali], Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 16.3.2, RELEASE SOFTWARE (fc4)
Technical Support : http://www.cisco.com/techsupport
Copyright(c) 1986 - 2016 by Cisco Systems, Inc.
Compiled Tue 08 - Nov - 16 17:31 by pt_team
Cisco IOS-XE software, Copyright(c) 2005 - 2016 by cisco Systems, Inc.
All rights reserved.Certain components of Cisco IOS - XE software are
licensed under the GNU General Public License("GPL") Version 2.0.The
software code licensed under GPL Version 2.0 is free software that comes
with ABSOLUTELY NO WARRANTY.You can redistribute and / or modify such
GPL code under the terms of GPL Version 2.0.For more details, see the
documentation or "License Notice" file accompanying the IOS - XE software,
or the applicable URL provided on the flyer accompanying the IOS - XE
software.
Time remaining: 90 seconds
System Capabilities: R
Enabled Capabilities: R
Management Addresses - not advertised
Auto Negotiation - supported, enabled
Physical media capabilities:
1000baseT(FD)
1000baseT(HD)
Media Attachment Unit type: 10
Vlan ID: 1
Total entries displayed: 1
R1#
(5)关闭与开启LLDP以及LLDP参数调整
R1(config)#interface gigabitEthernet 0/0
R1(config-if)#no lldp receive
R1(config-if)#no lldp transmit
R1(config-if)#exit
R1(config)#no lldp run
R1(config)#lldp run
R1(config)#lldp timer 15
R1(config)#lldp holdtime 60