配置LLDP基本功能
组网需求
如图1所示,DeviceA和DeviceB、DeviceC之间有可达链路,DeviceA、DeviceC与NMS之间有可达路由。在使能LLDP功能之前,DeviceA无法获取DeviceB和DeviceC的状态信息,NMS也不能通过SNMP报文获取DeviceA、DeviceB和DeviceC之间的拓扑结构信息。
使能LLDP功能之后,设备间可以通过交互LLDP报文获取彼此的状态信息。同时NMS可以通过LLDP管理IP地址查找DeviceA、DeviceB和DeviceC,获取它们之间的拓扑信息。
配置思路
采用如下思路进行本例的配置:
- 配置DeviceA、DeviceB和DeviceC的相关接口的IP地址和路由协议,使网络层路由可达。
- 启用DeviceA、DeviceB和DeviceC的全局LLDP功能。
- 配置DeviceA、DeviceB和DeviceC的管理IP地址,该IP地址用于在邻居节点中标识本端设备。
- 配置DeviceA、DeviceB和DeviceC的LLDP相关参数,优化LLDP的性能。
- 配置DeviceA、DeviceB和DeviceC的LLDP告警功能,合理配置设备发送LLDP告警的延迟时间,既能达到告警的目的,也能降低系统资源的消耗。
操作步骤
- 如图1所示,配置相关接口的IP地址和路由协议,具体的配置过程略。
- 启用DeviceA、DeviceB和DeviceC的全局LLDP功能。
# 配置DeviceA。
<HUAWEI> system-view [~HUAWEI] sysname DeviceA [*HUAWEI] commit [~DeviceA] lldp enable [~DeviceA] commit
# 配置DeviceB。
<HUAWEI> system-view [~HUAWEI] sysname DeviceB [*HUAWEI] commit [~DeviceB] lldp enable [~DeviceB] commit
# 配置DeviceC。
<HUAWEI> system-view [~HUAWEI] sysname DeviceC [*HUAWEI] commit [~DeviceC] lldp enable [~DeviceC] commit
- 配置DeviceA、DeviceB和DeviceC的管理IP地址。
# 配置DeviceA的管理IP地址为10.10.10.1。
[~DeviceA] lldp management-address 10.10.10.1 [*DeviceA] commit
# 配置DeviceB的管理IP地址为10.10.10.2。
[~DeviceB] lldp management-address 10.10.10.2 [*DeviceB] commit
# 配置DeviceC的管理IP地址为10.10.10.3。
[~DeviceC] lldp management-address 10.10.10.3 [*DeviceC] commit
- 配置DeviceA、DeviceB和DeviceC的LLDP相关参数,包括设备发送LLDP报文的周期和延迟时间。
# 配置DeviceA发送LLDP报文的周期和延迟时间。
[~DeviceA] lldp transmit interval 60 [*DeviceA] lldp transmit delay 9 [*DeviceA] commit
# 配置DeviceB和DeviceC发送LLDP报文的周期和延迟时间。
DeviceB和DeviceC的配置同DeviceA,具体请参考配置脚本,此处不再赘述。
- 启用DeviceA、DeviceB和DeviceC的LLDP告警功能,并配置设备发送LLDP告警的延迟时间。
# 配置DeviceA。
[~DeviceA] snmp-agent trap enable feature-name lldp [~DeviceA] lldp trap-interval 10 [*DeviceA] commit
# 配置DeviceB和DeviceC。
DeviceB和DeviceC的配置同DeviceA,具体请参考配置脚本,此处不再赘述。
检查配置结果
查看DeviceA的LLDP是否启用、LLDP管理地址是否配置、LLDP告警功能是否启用以及LLDP属性的值是否为配置的值。
命令回显中的***表示产品型号,具体取值以设备显示为准。
# 查看DeviceA的本地LLDP信息。
[DeviceA] display lldp local System information -------------------------------------------------------------------------- Chassis type :Mac Address Chassis ID :00e0-fc21-1220 System name :DeviceA System description :Huawei Versatile Routing Platform Software YunShan OS, Version 8.22.0.0 (*** V300R023C10) Copyright (C) 2012-2024 Huawei Technologies Co., Ltd. HUAWEI *** System capabilities supported :bridge router System capabilities enabled :bridge router LLDP Up time :2023/02/26 15:08:28 System configuration -------------------------------------------------------------------------- LLDP Status :enabled (default is disabled) LLDP Message Tx Interval :60 (default is 30s) LLDP Message Tx Hold Multiplier :4 (default is 4) LLDP Refresh Delay :2 (default is 2s) LLDP Tx Delay :9 (default is 2s) LLDP Notification Interval :10 (default is 5s) LLDP Notification Enable :enabled (default is enabled) Management Address :IPv4: 10.10.10.1 LLDP Fast Message Count :4 (default is 4) Remote Table Statistics: -------------------------------------------------------------------------- Remote Table Last Change Time :0 days,0 hours, 11 minutes,49 seconds Remote Neighbors Added :0 Remote Neighbors Deleted :0 Remote Neighbors Dropped :0 Remote Neighbors Aged :0 Total Neighbors :2 Port information: -------------------------------------------------------------------------- Interface 100GE1/0/1: LLDP Enable Status :txAndRx (default is disabled) Total Neighbors :2 Port ID subtype :Interface Name Port ID :100GE1/0/1 Port description :HUAWEI, 100GE1/0/1 Interface Port and Protocol VLAN ID(PPVID) :unsupported Port VLAN ID(PVID) :1 VLAN name of VLAN 1 :VLAN1 Protocol identity :LACP Auto-negotiation supported :Yes Auto-negotiation enabled :No OperMau :speed (10000) /duplex (Full) Link aggregation supported :Yes Link aggregation enabled :No Aggregation port ID :0 Maximum frame Size :9216
# 查看DeviceA的邻居设备的LLDP信息。
[DeviceA] display lldp neighbor interface 100GE1/0/1 100GE1/0/1 has 2 neighbor(s): Neighbor index :1 Chassis type :MAC Address Chassis ID :00e0-fc11-1220 Port ID subtype :Interface Name Port ID :100GE1/0/1 Port description :HUAWEI, 100GE1/0/1 Interface System name :DeviceB System description :Huawei Versatile Routing Platform Software VRP (R) software, Version 8.22.0.0 (*** V300R023C10) Copyright (C) 2012-2024 Huawei Technologies Co., Ltd. HUAWEI *** System capabilities supported :bridge router System capabilities enabled :bridge router Management address type :IPv4 Management address :10.10.10.2 Expired time :104 (s) Port VLAN ID(PVID) :1 Port And Protocol VLAN ID(PPVID) :unsupported VLAN name of VLAN 0 :VLAN0 Protocol identity :LACP Auto-negotiation supported :Yes Auto-negotiation enabled :No OperMau :speed (10000) /duplex (Full) Link aggregation supported :Yes Link aggregation enabled :No Aggregation port ID :0 Maximum frame Size :0 Discovered time :2023-02-21 11:09:15 Network Card ID :-- Neighbor index :2 Chassis type :MAC Address Chassis ID :00e0-fc33-0013 Port ID type :Interface Name Port ID :100GE1/0/1 Port description :HUAWEI, 100GE1/0/1 Interface System name :DeviceC System description :Huawei Versatile Routing Platform Software VRP (R) software, Version 8.22.0.0 (*** V300R023C10) Copyright (C) 2012-2024 Huawei Technologies Co., Ltd. HUAWEI *** System capabilities supported :bridge router System capabilities enabled :bridge router Management address type :IPv4 Management address :10.10.10.3 Expired time :104 (s) Port VLAN ID(PVID) :1 Port And Protocol VLAN ID(PPVID) :unsupported VLAN name of VLAN 0 :VLAN0 Protocol identity :LACP Auto-negotiation supported :Yes Auto-negotiation enabled :No OperMau :speed (10000) /duplex (Full) Link aggregation supported :Yes Link aggregation enabled :No Aggregation port ID :0 Maximum frame Size :0 Discovered time :2023-02-21 11:09:15
# 查看DeviceB和DeviceC的LLDP功能是否启用、LLDP管理地址是否配置。
请参见查看DeviceA的配置信息的过程。
配置脚本
-
DeviceA
# sysname DeviceA # lldp enable lldp transmit interval 60 lldp transmit delay 9 lldp restart 3 lldp fast-count 3 # interface 100GE1/0/1 undo portswitch ip address 10.10.10.1 255.255.255.0 # lldp management-address 10.10.10.1 snmp-agent trap enable feature-name lldp lldp trap-interval 10 # return
-
# sysname DeviceB # lldp enable lldp transmit interval 60 lldp transmit delay 9 lldp restart 3 lldp fast-count 3 # interface 100GE1/0/1 undo portswitch ip address 10.10.10.2 255.255.255.0 # lldp management-address 10.10.10.2 snmp-agent trap enable feature-name lldp lldp trap-interval 10 # return
-
DeviceC
# sysname DeviceC # lldp enable lldp transmit interval 60 lldp transmit delay 9 lldp restart 3 lldp fast-count 3 # interface 100GE1/0/1 undo portswitch ip address 10.10.10.3 255.255.255.0 # lldp management-address 10.10.10.3 snmp-agent trap enable feature-name lldp lldp trap-interval 10 # return
