配置 LLDP
可以通过在层次结构级别上[edit protocols]包含lldp语句和关联参数来配置 LLDP。完整的 LLDP 声明集如下:
lldp { advertisement-interval seconds; (disable | enable); hold-multiplier number; chassis-id { chassis-id-type (chassis-component | interface-alias | interface-name | locally-assigned | mac-address | network-address | port-component); chassis-id-value chassis-id-value; } interface (all | [interface-name]) { dest-mac-type; (disable | enable); power-negotiation <(disable | enable)>; tlv-filter; tlv-select; trap-notification (disable | enable); } dest-mac-type destination-mac-address; lldp-configuration-notification-interval seconds; lldp-tx-fast-init; management-address ip-management-address; | management-interface interface-name; mau-type; neighbour-port-info-display (port-description | port-id); port-description-type (interface-alias | interface-description); port-id-subtype (interface-name | locally-assigned); ptopo-configuration-maximum-hold-time seconds; ptopo-configuration-trap-interval seconds; tlv-filter; tlv-select; traceoptions { file filename <files number> <size maximum-file-size> <world-readable | no-world-readable>; flag flag <disable>; } transmit-delay seconds; vlan-name-tlv-option (name | vlan-id); }
以下语句具有默认值:
-
advertisement-interval- 默认值为 30 秒。允许范围为 5 到 32768 秒。 -
chassis-id-type— 默认值为 MAC 地址。 -
chassis-id-value- 默认值为 system-mac。 -
hold-multiplier- 默认值为 4。允许范围为 2 到 10。 -
ptopo-configuration-maximum-hold-time- 默认值为 300 秒。允许范围为 1 到 2147483647 秒。 -
transmit-delay- 默认值为 2 秒。允许范围为 1 到 8192 秒。
必须显式配置以下语句:
-
lldp-configuration-notification-interval- 允许的范围为 5 到 3600 秒。默认值为 5。 -
ptopo-configuration-trap-interval- 允许范围为 0 到 3600 秒。默认值为 0。
默认情况下,LLDP 处于禁用状态,用户必须使用 LLDP 服务对 [set protocols lldp interface (all | interface-name)] 其进行配置。如果为所有接口启用,则可以在特定接口上禁用 LLDP。
必须 interface-name 是物理接口(例如 ge-1/0/0),而不是逻辑接口(单元)。
从 Junos OS 19.4R2 版开始,您可以在冗余以太网 (reth) 接口上配置 LLDP。使用命令 set protocol lldp interface <reth-interface> 在 reth 接口上配置 LLDP。
从 Junos OS 22.1R1 版开始,您可以配置备用 LLDP 目标 MAC 地址。如果未提供任何配置,则数据包将发送到最近的网桥 MAC 地址,即 01:80:c2:00:00:0e。使用该 set protocols lldp dest-mac-type <mac-type> 语句配置从所有接口发送的数据包。并对从特定接口发送的数据包使用该 set protocols lldp interface <intf-name> dest-mac-type <mac-type> 语句。
-
要在所有接口上配置 LLDP:
[edit protocols lldp] user@switch# set interface all
-
要在特定接口上配置 LLDP:
[edit protocols lldp] user@switch# set interface interface-name
要禁用 LLDP,请添加以下 disable 选项:
-
要在所有接口上禁用 LLDP:
[edit protocols lldp] user@switch# set interface all disable
-
要在特定接口上禁用 LLDP:
[edit protocols lldp] user@switch# set interface interface-name disable
播发间隔确定 LLDP 接口发送 LLDP 播发帧的频率。默认值为 30 秒。允许范围为 5 到 32768 秒。可以通过在层次结构级别包含advertisement-interval[edit protocols lldp]语句来调整此参数。
保持乘数确定要应用于播发间隔的乘数。结果值(以秒为单位) 用于在丢弃之前缓存学习的 LLDP 信息。默认值为 4。当与默认播发间隔值 30 秒一起使用时,这将使默认缓存生存期为 120 秒。保持乘数的允许范围为 2 到 10。可以通过在层次结构级别包含hold-multiplier[edit protocols lldp]语句来调整此参数。
传输延迟决定了任意两个连续 LLDP 播发帧之间的延迟。默认值为 2 秒。允许范围为 1 到 8192 秒。可以通过在层次结构级别包含transmit-delay[edit protocols lldp]语句来调整此参数。
物理拓扑配置最大保持时间确定代理设备维护物理拓扑数据库条目的时间间隔。默认值为 300 秒。允许范围为 1 到 2147483647 秒。可以通过在层次结构级别包含ptopo-configuration-maximum-hold-time[edit protocols lldp]语句来调整此参数。
LLDP 配置通知间隔确定当 LLDP 信息数据库发生更改时,向 SNMP 主代理发送陷阱通知的时间段。允许范围为 5 到 3600 秒。可以通过在层次结构级别包含lldp-configuration-notification-interval[edit protocols lldp]语句来调整此参数。
物理拓扑配置陷阱间隔确定当全局物理拓扑统计信息发生变化时,向 SNMP 主代理发送陷阱通知的时间段。默认情况下,此功能处于禁用状态。允许的范围为 0(禁用)到 3600 秒。如果此间隔的值大于 0,并且在陷阱间隔期间发生lldp-configuration-notification-interval任何更改,则 LLDP 代理会向 SNMP 主代理发送陷阱。可以通过在层次结构级别包含ptopo-configuration-trap-interval[edit protocols lldp]语句来调整此参数。
您可以指定 LLDP 的目标 MAC 地址。选项包括 nearest-bridge、 nearest-customer-bridge和 nearest-non-tpmr-bridge。
默认情况下,设备的管理接口用于 LLDP PDU 的管理地址 TLV。您可以配置 LLDP 的管理地址或管理接口。
如果配置管理地址,则该地址将在管理地址 TLV 中发送。如果配置了管理接口,则管理接口的 IP 地址将在 TLV 中发送。如果管理接口没有 IP 地址,则设备管理接口的默认 IP 地址将在 TLV 中发送。如果设备的管理接口没有 IP 地址,则管理接口的 MAC 地址将在 TLV 中发送。
默认情况下,LLDP 为端口 ID 类型、长度和值 (TLV) 生成接口的 SNMP 索引。在远程 LLDP 邻接方上配置该语句时 interface-name , show lldp neighbors 命令输出将在字段中 Port ID 显示接口名称,而不是接口的 SNMP 索引(默认显示)。如果更改将接口的 SNMP 索引生成为端口 ID TLV 的默认行为,则可以通过在 locally-assigned ] 层次结构级别包含 [edit protocols lldp port-id-subtype该语句来重新启用默认行为。
变更历史表
是否支持某项功能取决于您使用的平台和版本。使用 功能资源管理器 确定您的平台是否支持某个功能。
set protocol lldp interface <reth-interface> 在 reth 接口上配置 LLDP。