LLDP (Link Layer Discovery Protocol)链路层发现协议,可以获取网络拓扑结构

LLDP 是链路层发现协议,非常实用,如果不清楚网络的拓扑结构,通过 LLDP 协议可以获取网络的拓扑结构。一个简单的示例。

查看邻居关系需要开启

lldp 协议默认是关闭,需要开启。

[Huawei]lldp enable 
Info: Global LLDP is enabled successfully.

分别在 LSW1 、LSW2 和 AR1 上开启 lldp ,查看邻居关系

在 LSW1 上执行

[Huawei]display lldp neighbor brief 
Local Intf   Neighbor Dev             Neighbor Intf             Exptime
GE0/0/1      Huawei                   GE0/0/0                   108    
GE0/0/2      Huawei                   GE0/0/1                   107    

可以看到每个端口的连接信息,因为模拟器中 pc 不处理 lldp 协议。所以看不到 g0/0/3 的对端设备(pc)。

  1. local Intf 本地的接口
  2. Neighbor Dev : 对端的设备名字。(因为没有修改名字,所以显示的默认的名字 huawei)
  3. Neighbor Intf:对端设备的端口
  4. Exptime: 过期时间,默认 lldp 协议 30秒发送一个信息,4被的时间没有收到确认,认为链路断开。所有,这个数在正常连接的时候应该是大于90小于120。如果发现小于了 90 说明可能出问题了。

进行优化配置

第一点: 不考虑连接pc的链路可以在LSW1上g0/0/3端口关闭 LLDP

[Huawei]int g0/0/3	
[Huawei-GigabitEthernet0/0/3]undo lldp enable 
Info: The LLDP is disabled on the port successfully.

第二点: 修改设备的名字,再次执行,可以到设备名字

[S1]display lldp neighbor brief
Local Intf   Neighbor Dev             Neighbor Intf             Exptime
GE0/0/1      AR1                      GE0/0/0                   114    
GE0/0/2      S2                       GE0/0/1                   118  

抓包看数据

调整时间参数

[S1]lldp message-transmission ?
  delay            The delay indicates the time between two successive LLDP
                   frames
  hold-multiplier  A multiplier on the msgTxInterval that determines the actual
                   TTL value use in a LLDPDU
  interval         The interval at which LLDP frames are transmitted on behalf
                   of this LLDP agent

interval 默认是 30; hold-multiplier 默认是 4