LLDP协议
LLDP协议概述
LLDP提供了一种标准的链路层发现方式,可以将本端设备的主要能力、管理地址、设备标识、接口标识等信息封装到LLDP报文中传递给邻居设备,邻居设备在收到这些信息后将其以标准MIB(Management Information Base,管理信息库)的形式保存起来,供NMS(Network Management System,网络管理系统)查询及判断链路的通信状况。
LLDP的实现
LLDP的实现过程如下:
- DeviceA将本端的状态信息封装成LLDP报文,发送给邻居设备DeviceB。
- DeviceB解析接收到的LLDP报文,并将该报文中的关于DeviceA的信息存储到设备上的远端MIB数据库中,供NMS提取拓扑信息使用。
- 同样,DeviceB也将本端的状态信息封装成LLDP报文发送给DeviceA,DeviceA解析接收到的LLDP报文,并将该报文中的关于DeviceB的信息存储到设备上的远端MIB数据库中,供NMS提取拓扑信息使用。
- NMS通过与DeviceA和DeviceB交互SNMP报文,从两者的MIB数据库中提取本地信息和邻居信息并进行拓扑分析,最终发现整网的拓扑结构。
LLDP的主要作用
通过在网络中部署LLDP协议,NMS的能力迅速提升,既能掌握更详细的网络拓扑信息以及网络拓扑变化信息,还能及时发现网络中实际存在的不合理的配置,这些信息有助于网络管理员实时监控网络状态,有效提升了网络的安全性和稳定性。使能LLDP功能
使能LLDP功能之后,设备能够向使能了LLDP功能的邻居节点发送携带本端状态信息的LLDP报文,同时也能够通过接收邻居节点发送的LLDP报文获取对端的状态信息。LLDP功能有两个开关,一个是全局开关,一个是接口下的开关,两者有如下的关系:
- 去使能全局的LLDP功能后,设备上所有接口的LLDP功能都处于去使能状态。
- 只有全局的LLDP功能和接口下的LLDP功能都处于使能状态时,相应的接口才能够发送和接收LLDP报文。
- 全局的LLDP功能处于去使能状态时,使能和去使能接口的LLDP功能的命令都是无效的。
LLDP配置操作步骤
- 执行命令system-view,进入系统视图。
- 执行命令lldp enable,使能全局的LLDP功能。
- 执行命令interfaceinterface-type interface-number,进入接口视图。
- (可选)执行命令lldp admin-status { tx | rx | txrx },配置指定接口的LLDP工作模式。
- (可选)通过以下步骤使能子接口上的LLDP功能。
- 执行命令lldp vlan-mode enable,使能主接口的VLAN模式功能。
- 执行命令interfaceinterface-type interface-number,创建子接口视图。
- 执行命令vlan-type dot1qvlan-id,指定接口关联的VLAN。
- 在子接口视图下执行命令lldp enable ,使能子接口的LLDP功能。
- 执行命令commit,提交配置。
检查配置结果
查看LLDP基本功能的配置结果。
- 使用display lldp local [ interface interface-type interface-number ]命令查看全局或者指定接口的本地LLDP状态信息。
- 使用display lldp neighbor [ interface interface-type interface-number ]命令查看全局或者指定接口的邻居节点的LLDP状态信息。邻居接口为POS接口时,如果希望LLDP能够发现该POS接口,其封装的协议只能是PPP或者HDLC协议。
- 使用display lldp neighbor brief命令查看邻居节点的概要LLDP状态信息。邻居接口为POS接口时,如果希望LLDP能够发现该POS接口,其封装的协议只能是PPP或者HDLC协议。
- 使用display lldp tlv-config [ interface interface-type interface-number ]命令查看全局或者指定接口下配置的允许发送的可选TLV信息。
配置LLDP的管理IP地址
配置LLDP管理IP地址,NMS可根据该IP地址标识设备,有助于网络拓扑的绘制。
管理IP地址是指被携带在LLDP报文中的Management Address TLV中,供网管系统标识设备,并进行网络管理的IP地址。管理IP地址可以明确地标识一台设备,从而有利于网络拓扑的绘制,便于网络管理。
非接口模式下,LLDP管理IP地址按照以下优先级选举:
- 用户通过lldp management-address命令或lldp management-address ipv6命令配置了管理IP地址时,该IP地址的优先级最高,设备优选该IP地址作为管理IP地址。
- 用户既未通过lldp management-address命令或lldp management-address ipv6命令配置管理IP地址,又没有配置管理IP地址和接口的绑定关系时,系统将自动从IP地址列表中查找并指定一个IP地址作为LLDP的管理IP地址,如果没有找到缺省的IP地址,则用系统的桥MAC作为管理IP地址。
LLDP配置管理IP地址操作步骤
- 执行命令system-view,进入系统视图。
- 执行命令lldp management-addressip-address,配置LLDP管理IP地址。
- 执行命令commit,提交配置。
实验
配置NE1
1 2 3 4 5 | <HUAWEI> system-view [~HUAWEI] sysname DeviceA [*HUAWEI] commit [~DeviceA] lldp enable [*DeviceA] commit |
配置NE2
1 2 3 4 5 | <HUAWEI> system-view [~HUAWEI] sysname DeviceB [*HUAWEI] commit [~DeviceB] lldp enable [*DeviceB] commit |
配置NE3
1 2 3 4 5 | <HUAWEI> system-view [~HUAWEI] sysname DeviceC [*HUAWEI] commit [~DeviceC] lldp enable [*DeviceC] commit |
配置NE1 NE2 NE3的管理地址
NE1
1 2 | [~DeviceA] lldp management-address 10.10.10.1 [*DeviceA] commit |
NE2
1 2 | [~DeviceB] lldp management-address 10.10.10.2 [*DeviceB] commit |
NE3
1 2 | [~DeviceC] lldp management-address 10.10.10.3 [*DeviceC] commit |
检查配置结果
检查NE1上的配置结果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | <DeviceA> display lldp local System information -------------------------------------------------------------------------- Chassis type :macAddress Chassis ID :00e0-fc21-1220 System name :DeviceA System description :Huawei Versatile Routing Platform Software VRP (R) software, Version 8.200 (NE40E V800R012C10SPC300) Copyright (C) 2012-2015 Huawei Technologies Co., Ltd. HUAWEI NE40E System capabilities supported :bridge router System capabilities enabled :bridge router LLDP Up time :2015/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 disabled) 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 Gigabitethernet 1/0/1: LLDP Enable Status :txAndRx ( default is disabled) Total Neighbors :2 Port ID subtype :interfaceName Port ID :Gigabitethernet 1/0/1 Port description : Port and Protocol VLAN ID(PPVID) :unsupported Port VLAN ID(PVID) :0 VLAN name of VLAN :-- Protocol identity :STP RSTP/MSTP LACP EthOAM 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 |
查看NE1上的邻居设备的LLDP信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | <DeviceA> display lldp neighbor interface gigabitethernet 1/0/1 Gigabitethernet 1/0/1 has 2 neighbor(s): Neighbor index :1 Chassis type :macAddress Chassis ID :00e0-fc11-1220 Port ID type :interfaceName Port ID :Gigabitethernet 1/0/1 Port description :-- System name :DeviceB System description :Huawei Versatile Routing Platform Software VRP (R) software, Version 8.200 (NE40E V800R012C10SPC300) Copyright (C) 2012-2015 Huawei Technologies Co., Ltd. HUAWEI NE40E 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) :0 Port And Protocol VLAN ID(PPVID) :unsupported VLAN name of VLAN :-- Protocol identity :-- 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 :2015-02-21 11:09:15 Neighbor index :2 Chassis type :macAddress Chassis ID :00e0-fc33-0013 Port ID type :interfaceName Port ID :Gigabitethernet 1/0/1 Port description :-- System name :DeviceC System description :Huawei Versatile Routing Platform Software VRP (R) software, Version 8.200 (NE40E V800R012C10SPC300) Copyright (C) 2012-2015 Huawei Technologies Co., Ltd. HUAWEI NE40E 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) :0 Port And Protocol VLAN ID(PPVID) :unsupported VLAN name of VLAN :-- Protocol identity :-- 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 :2015-02-21 11:09:15 |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)