07-LLDP配置
本章節下載: 07-LLDP配置 (394.45 KB)
目 錄
1.15 配置LLDP Trap和LLDP-MED Trap功能
1.17.1 配置LLDP報文的源MAC地址為指定的MAC地址
1.17.2 配置設備支持通過LLDP生成對端管理地址的ARP或ND表項
LLDP(Link Layer Discovery Protocol,鏈路層發現協議)提供了一種標準的鏈路層發現方式,使不同廠商的設備能夠在網絡中相互發現並交互各自的係統及配置信息。LLDP將本端設備的信息(包括主要能力、管理地址、設備標識、接口標識等)封裝在LLDPDU(Link Layer Discovery Protocol Data Unit,鏈路層發現協議數據單元)中發布給與自己直連的鄰居,鄰居收到這些信息後將其以標準MIB的形式保存起來,以供網絡管理係統查詢及判斷鏈路的通信狀況。
LLDP代理是LLDP協議運行實體的一個抽象映射。一個接口下,可以運行多個LLDP代理。目前LLDP定義的代理類型包括:
Nearest Bridge:最近橋代理。
Nearest non-TPMR Bridge:最近非TPMR橋代理。其中TPMR(Two-Port MAC Relay,雙端口MAC中繼),是一種隻有兩個可供外部訪問橋端口的橋,支持MAC橋的功能子集。TPMR對於所有基於幀的介質無關協議都是透明的,但如下協議除外:以TPMR為目的地的協議、以保留MAC地址為目的地址但TPMR定義為不予轉發的協議。
Nearest Customer Bridge:最近客戶橋代理。
LLDP在相鄰的代理之間進行協議報文交互,並基於代理創建及維護鄰居信息。LLDP不同類型的代理鄰居關係如圖1-1所示。
圖1-1 LLDP鄰居關係示意圖
其中,CB(Customer Bridge,客戶橋)和SB(Service Bridge,服務橋)表示LLDP的兩種橋模式。
· LLDP工作於客戶橋模式時,設備可支持最近橋代理、最近非TPMR橋代理和最近客戶橋代理,即設備對報文目的MAC地址為上述代理的MAC地址的LLDP報文進行處理,對報文目的MAC地址為其他MAC地址的LLDP報文進行VLAN內透傳。
· LLDP工作於服務橋模式時,設備可支持最近橋代理和最近非TPMR橋代理,即設備對報文目的MAC地址為上述代理的MAC地址的LLDP報文進行處理,對報文目的MAC地址為其他MAC地址的LLDP報文進行VLAN內透傳。
封裝LLDPDU的報文稱為LLDP報文,其封裝格式有兩種:Ethernet II和SNAP(Subnetwork Access Protocol,子網訪問協議)。
圖1-2 Ethernet II格式封裝的LLDP報文
如圖1-2所示,Ethernet II格式封裝的LLDP報文包含如下字段:
· Destination MAC address:目的MAC地址。為區分同一接口下不同類型代理發送及接收的LLDP報文,LLDP協議規定了不同的組播MAC地址作為不同類型代理的LLDP報文的目的MAC地址。
¡ 最近橋代理類型的LLDP報文使用組播MAC地址0x0180-c200-000e。
¡ 最近客戶橋代理類型的LLDP報文使用組播MAC地址0x0180-c200-0000。
¡ 最近非TPMR橋代理類型的LLDP報文使用組播MAC地址0x0180-c200-0003。
· Source MAC address:源MAC地址,為端口MAC地址。
· Type:報文類型,為0x88CC。
· Data:數據內容,為LLDPDU。
· FCS:幀檢驗序列,用來對報文進行校驗。
圖1-3 SNAP格式封裝的LLDP報文
如圖1-3所示,SNAP格式封裝的LLDP報文包含如下字段:
· Destination MAC address:目的MAC地址,與Ethernet II格式封裝的LLDP報文目的MAC地址相同。
· Source MAC address:源MAC地址,為端口MAC地址。
· Type:報文類型,為0xAAAA-0300-0000-88CC。
· Data:數據內容,為LLDPDU。
· FCS:幀檢驗序列,用來對報文進行校驗。
LLDPDU是封裝在LLDP報文數據部分的數據單元。在組成LLDPDU之前,設備先將本地信息封裝成TLV格式,再由若幹個TLV組合成一個LLDPDU封裝在LLDP報文的數據部分進行傳送。
圖1-4 LLDPDU的封裝格式
如圖1-4所示,藍色的Chassis ID TLV、Port ID TLV、Time To Live TLV是每個LLDPDU都必須攜帶的,其餘的TLV則為可選攜帶。每個LLDPDU最多可攜帶32種TLV。
TLV是組成LLDPDU的單元,每個TLV都代表一個信息。LLDP可以封裝的TLV包括基本TLV、802.1組織定義TLV、802.3組織定義TLV和LLDP-MED(Link Layer Discovery Protocol Media Endpoint Discovery,鏈路層發現協議媒體終端發現) TLV。
基本TLV是網絡設備管理基礎的一組TLV,802.1組織定義TLV、802.3組織定義TLV和LLDP-MED TLV則是由標準組織或其他機構定義的TLV,用於增強對網絡設備的管理,可根據實際需要選擇是否在LLDPDU中發送。
在基本TLV中,有幾種TLV對於實現LLDP功能來說是必選的,即必須在LLDPDU中發布,如表1-1所示。
TLV名稱 |
說明 |
是否必須發布 |
Chassis ID |
發送設備的橋MAC地址 |
是 |
Port ID |
標識LLDPDU發送端的端口。如果LLDPDU中攜帶有LLDP-MED TLV,其內容為端口的MAC地址;否則,其內容為端口的名稱 |
是 |
Time To Live |
本設備信息在鄰居設備上的存活時間 |
是 |
End of LLDPDU |
LLDPDU的結束標識,是LLDPDU的最後一個TLV |
是 |
Port Description |
端口的描述 |
否 |
System Name |
設備的名稱 |
否 |
System Description |
係統的描述 |
否 |
System Capabilities |
係統的主要功能以及已開啟的功能項 |
否 |
Management Address |
管理地址,以及該地址所對應的接口號和OID(Object Identifier,對象標識符) |
否 |
IEEE 802.1組織定義TLV的內容如表1-2所示。
目前,H3C設備不支持發送Protocol Identity TLV和VID Usage Digest TLV,但可以接收這兩種類型的TLV。
三層以太網接口僅支持Link Aggregation TLV。
表1-2 IEEE 802.1組織定義的TLV
TLV名稱 |
說明 |
Port VLAN ID(PVID) |
端口VLAN ID |
Port and protocol VLAN ID(PPVID) |
端口協議VLAN ID |
VLAN Name |
端口所屬VLAN的名稱 |
Protocol Identity |
端口所支持的協議類型 |
Link Aggregation |
端口是否支持鏈路聚合以及是否已開啟鏈路聚合 |
Management VID |
管理VLAN |
VID Usage Digest |
包含VLAN ID使用摘要的數據 |
ETS Configuration |
(暫不支持)增強傳輸選擇(Enhanced Transmission Selection)配置 |
ETS Recommendation |
(暫不支持)增強傳輸選擇推薦 |
PFC |
(暫不支持)基於優先級的流量控製(Priority-based Flow Control) |
APP |
(暫不支持)應用協議(Application Protocol) |
IEEE 802.3組織定義TLV的內容如表1-3所示。
Power Stateful Control TLV是在IEEE P802.3at D1.0版本中被定義的,之後的版本不再支持該TLV。H3C設備隻有在收到Power Stateful Control TLV後才會發送該類型的TLV。
表1-3 IEEE 802.3組織定義的TLV
TLV名稱 |
說明 |
MAC/PHY Configuration/Status |
端口支持的速率和雙工狀態、是否支持端口速率自動協商、是否已開啟自動協商功能以及當前的速率和雙工狀態 |
Power Via MDI |
端口的供電能力,包括PoE(Power over Ethernet,以太網供電)的類型(包括PSE(Power Sourcing Equipment,供電設備)和PD(Powered Device,受電設備)兩種)、PoE端口的遠程供電模式、是否支持PSE供電、是否已開啟PSE供電、供電方式是否可控、供電類型、功率來源、功率優先級、PD請求功率值、PSE分配功率值 |
Maximum Frame Size |
端口支持的最大幀長度 |
Power Stateful Control |
端口的電源狀態控製,包括PSE/PD所采用的電源類型、供/受電的優先級以及供/受電的功率 |
Energy-Efficient Ethernet |
(暫不支持)節能以太網 |
LLDP-MED TLV為VoIP(Voice over IP,在IP網絡上傳送語音)提供了許多高級的應用,包括基本配置、網絡策略配置、地址信息以及目錄管理等,滿足了語音設備的不同生產廠商在投資收效、易部署、易管理等方麵的要求,並解決了在以太網中部署語音設備的問題,為語音設備的生產者、銷售者以及使用者提供了便利。LLDP-MED TLV的內容如表1-4所示。
如果禁止發布802.3的組織定義的MAC/PHY Configuration/Status TLV,則LLDP-MED TLV將不會被發布,不論其是否被允許發布;如果禁止發布LLDP-MED Capabilities TLV,則其他LLDP-MED TLV將不會被發布,不論其是否被允許發布。
TLV名稱 |
說明 |
LLDP-MED Capabilities |
網絡設備所支持的LLDP-MED TLV類型 |
Network Policy |
(暫不支持)網絡設備或終端設備上端口的VLAN類型、VLAN ID以及二三層與具體應用類型相關的優先級等 |
Extended Power-via-MDI |
網絡設備或終端設備的擴展供電能力,對Power Via MDI TLV進行了擴展 |
Hardware Revision |
終端設備的硬件版本 |
Firmware Revision |
終端設備的固件版本 |
Software Revision |
終端設備的軟件版本 |
Serial Number |
終端設備的序列號 |
Manufacturer Name |
終端設備的製造廠商名稱 |
Model Name |
終端設備的模塊名稱 |
Asset ID |
終端設備的資產標識符,以便目錄管理和資產跟蹤 |
Location Identification |
網絡設備的位置標識信息,以供終端設備在基於位置的應用中使用 |
管理地址是供網絡管理係統標識網絡設備並進行管理的地址。管理地址可以明確地標識一台設備,從而有利於網絡拓撲的繪製,便於網絡管理。管理地址被封裝在LLDP報文的Management Address TLV中向外發布。
在指定類型的LLDP代理下,LLDP有以下四種工作模式:
· TxRx:既發送也接收LLDP報文。
· Tx:隻發送不接收LLDP報文。
· Rx:隻接收不發送LLDP報文。
· Disable:既不發送也不接收LLDP報文。
當端口的LLDP工作模式發生變化時,端口將對協議狀態機進行初始化操作。為了避免端口工作模式頻繁改變而導致端口不斷執行初始化操作,可配置端口初始化延遲時間,當端口工作模式改變時延遲一段時間再執行初始化操作。
在指定類型LLDP代理下,當端口工作在TxRx或Tx模式時,設備會周期性地向鄰居設備發送LLDP報文。如果設備的本地配置發生變化則立即發送LLDP報文,以將本地信息的變化情況盡快通知給鄰居設備。但為了防止本地信息的頻繁變化而引起LLDP報文的大量發送,使用令牌桶機製對LLDP報文發送作限速處理。有關令牌桶的詳細介紹,請參見“ACL和QoS配置指導”中的“流量監管、流量整形和接口限速”。
當設備的工作模式由Disable/Rx切換為TxRx/Tx,或者發現了新的鄰居設備(即收到一個新的LLDP報文且本地尚未保存發送該報文設備的信息)時,該設備將自動啟用快速發送機製,即將LLDP報文的發送周期設置為快速發送周期,並連續發送指定數量的LLDP報文後再恢複為正常的發送周期。
當端口工作在TxRx或Rx模式時,設備會對收到的LLDP報文及其攜帶的TLV進行有效性檢查,通過檢查後再將鄰居信息保存到本地,並根據Time To Live TLV中TTL(Time to Live,生存時間)的值來設置鄰居信息在本地設備上的老化時間,若該值為零,則立刻老化該鄰居信息。
LLDP檢測鄰居是否存在,將檢測結果通知給Track模塊;Track模塊根據檢測結果,對Track項的狀態進行修改,以便通知應用模塊進行相應處理:
· 當LLDP鄰居存在時,Track項的狀態為Positive。
· 當LLDP鄰居不存在時,Track項的狀態為Negative。
關於LLDP與Track聯動的詳細介紹和相關配置,請參見“可靠性配置指導”中的“Track”。
與LLDP相關的協議規範有:
· IEEE 802.1AB-2005:Station and Media Access Control Connectivity Discovery
· IEEE 802.1AB 2009:Station and Media Access Control Connectivity Discovery
· ANSI/TIA-1057:Link Layer Discovery Protocol for Media Endpoint Devices
· IEEE Std 802.1Qaz-2011:Media Access Control (MAC) Bridges and Virtual Bridged Local Area Networks-Amendment 18: Enhanced Transmission Selection for Bandwidth Sharing Between Traffic Classes
如表1-5所示,LLDP以下配置任務支持在多個接口視圖配置。
缺省情況下,本設備的物理接口處於三層模式,請根據實際需要在對應接口視圖下使用port link-mode命令切換接口的工作模式。
表1-5 LLDP配置任務對應的接口視圖
配置任務 |
支持配置的接口視圖 |
開啟LLDP功能 |
支持配置的接口視圖: · 二層以太網接口視圖 · 三層以太網接口視圖 · 管理以太網接口視圖 · 二層聚合接口視圖 · 三層聚合接口視圖 |
配置LLDP工作模式 |
|
配置允許發布的TLV類型 |
|
配置管理地址及其封裝格式 |
|
配置LLDP報文的封裝格式 |
|
配置輪詢功能 |
|
配置LLDP Trap和LLDP-MED Trap功能 |
LLDP配置任務如下:
(1) 開啟LLDP功能
(2) 配置LLDP橋模式
(3) 配置LLDP工作模式
(4) (可選)配置接口初始化延遲時間
(5) (可選)配置LLDP報文相關參數
(6) (可選)配置輪詢功能
(7) (可選)關閉LLDP的PVID不一致檢查功能
(8) (可選)配置LLDP兼容CDP功能
(9) (可選)配置LLDP Trap和LLDP-MED Trap功能
(10) (可選)配置LLDP鄰居驗證與超時保護功能
隻有當全局和接口上都開啟了LLDP功能後,該功能才會生效。
(1) 進入係統視圖。
system-view
(2) 全局開啟LLDP功能。
lldp global enable
缺省情況下,LLDP功能全局處於關閉狀態。
(3) 進入接口視圖。
interface interface-type interface-number
(4) 在接口上開啟LLDP功能。
lldp enable
缺省情況下,LLDP功能在接口上處於開啟狀態。
(1) 進入係統視圖。
system-view
(2) 配置LLDP橋模式。
¡ 配置LLDP橋模式為服務橋模式。
lldp mode service-bridge
¡ 配置LLDP橋模式為客戶橋模式。
undo lldp mode
缺省情況下,LLDP橋模式為客戶橋模式。
(1) 進入係統視圖。
system-view
(2) 進入接口視圖。
interface interface-type interface-number
(3) 配置LLDP的工作模式。
¡ 在二/三層以太網接口視圖或管理以太網接口視圖下:
lldp [ agent { nearest-customer | nearest-nontpmr } ] admin-status { disable | rx | tx | txrx }
以太網接口視圖下,未指定agent參數時,表示配置最近橋代理的工作模式。
¡ 在二/三層聚合接口視圖下:
lldp agent { nearest-customer | nearest-nontpmr } admin-status { disable | rx | tx | txrx }
聚合接口視圖下,隻支持配置最近客戶橋代理和最近非TPMR代理的工作模式。
缺省情況下,最近橋代理類型的LLDP工作模式為TxRx,最近客戶橋代理和最近非TPMR橋代理類型的LLDP工作模式為Disable。
當接口上LLDP的工作模式發生變化時,接口將對協議狀態機進行初始化操作,通過配置接口初始化的延遲時間,可以避免由於工作模式頻繁改變而導致接口不斷地進行初始化。
(1) 進入係統視圖。
system-view
(2) 配置接口初始化的延遲時間。
lldp timer reinit-delay delay
缺省情況下,接口初始化的延遲時間為2秒。
(1) 進入係統視圖。
system-view
(2) 進入接口視圖。
interface interface-type interface-number
(3) 配置接口上允許發布的TLV類型。
¡ 在二層以太網接口視圖下:
lldp tlv-enable { basic-tlv { all | port-description | system-capability | system-description | system-name | management-address-tlv [ ipv6 ] [ ip-address | interface loopback interface-number ] } | dot1-tlv { all | port-vlan-id | link-aggregation | protocol-vlan-id [ vlan-id ] | vlan-name [ vlan-id ] | management-vid [ mvlan-id ] } | dot3-tlv { all | mac-physic | max-frame-size } | med-tlv { all | capability | inventory | power-over-ethernet | location-id { civic-address device-type country-code { ca-type ca-value }&<1-10> | elin-address tel-number } } }
缺省情況下,最近橋代理允許發布除Location-id TLV、Port And Protocol VLAN ID TLV、VLAN Name TLV、Management VLAN ID TLV之外所有類型的TLV。
lldp agent nearest-nontpmr tlv-enable { basic-tlv { all | port-description | system-capability | system-description | system-name | management-address-tlv [ ipv6 ] [ ip-address ] } | dot1-tlv { all | port-vlan-id | link-aggregation } }
lldp tlv-enable dot1-tlv { protocol-vlan-id [ vlan-id ] | vlan-name [ vlan-id ] | management-vid [ mvlan-id ] }
缺省情況下,最近非TPMR橋代理不發布任何TLV。
lldp agent nearest-customer tlv-enable { basic-tlv { all | port-description | system-capability | system-description | system-name | management-address-tlv [ ipv6 ] [ ip-address ] } | dot1-tlv { all | port-vlan-id | link-aggregation } }
lldp tlv-enable dot1-tlv { protocol-vlan-id [ vlan-id ] | vlan-name [ vlan-id ] | management-vid [ mvlan-id ] }
缺省情況下,最近客戶橋代理允許發布基本TLV和IEEE 802.1組織定義TLV。
¡ 在三層以太網接口視圖下:
lldp tlv-enable { basic-tlv { all | port-description | system-capability | system-description | system-name | management-address-tlv [ ipv6 ] [ ip-address | interface loopback interface-number ] } | dot1-tlv { all | link-aggregation } | dot3-tlv { all | mac-physic | max-frame-size } | med-tlv { all | capability | inventory | power-over-ethernet | location-id { civic-address device-type country-code { ca-type ca-value }&<1-10> | elin-address tel-number } } }
缺省情況下,最近橋代理允許發布除Network Policy TLV之外所有類型的TLV,其中IEEE 802.1組織定義的TLV隻支持Link Aggregation TLV。
lldp agent { nearest-nontpmr | nearest-customer } tlv-enable { basic-tlv { all | port-description | system-capability | system-description | system-name | management-address-tlv [ ipv6 ] [ ip-address ] } | dot1-tlv { all | link-aggregation } }
缺省情況下,最近非TPMR橋代理不發布任何TLV;最近客戶橋代理允許發布基本TLV和IEEE 802.1組織定義TLV,其中IEEE 802.1組織定義的TLV隻支持Link Aggregation TLV。
¡ 在管理以太網接口視圖下:
lldp tlv-enable { basic-tlv { all | port-description | system-capability | system-description | system-name | management-address-tlv [ ipv6 ] [ ip-address ] } | dot1-tlv { all | link-aggregation } | dot3-tlv { all | mac-physic | max-frame-size } | med-tlv { all | capability | inventory | power-over-ethernet | location-id { civic-address device-type country-code { ca-type ca-value }&<1-10> | elin-address tel-number } } }
缺省情況下,最近橋代理允許發布除Network Policy TLV之外所有類型的TLV,其中IEEE 802.1組織定義的TLV隻支持Link Aggregation TLV。
lldp agent { nearest-nontpmr | nearest-customer } tlv-enable { basic-tlv { all | port-description | system-capability | system-description | system-name | management-address-tlv [ ipv6 ] [ ip-address ] } | dot1-tlv { all | link-aggregation } }
缺省情況下,最近非TPMR橋代理不發布任何TLV;最近客戶橋代理允許發布基本TLV和IEEE 802.1組織定義TLV,其中IEEE 802.1組織定義的TLV隻支持Link Aggregation TLV。
¡ 在二層聚合接口視圖下:
lldp tlv-enable dot1-tlv { protocol-vlan-id [ vlan-id ] | vlan-name [ vlan-id ] | management-vid [ mvlan-id ]
lldp agent nearest-nontpmr tlv-enable { basic-tlv { all | management-address-tlv [ ipv6 ] [ ip-address ] | port-description | system-capability | system-description | system-name } | dot1-tlv { all | port-vlan-id } }
缺省情況下,最近非TPMR橋代理不發布任何TLV。
lldp agent nearest-customer tlv-enable { basic-tlv { all | management-address-tlv [ ipv6 ] [ ip-address ] | port-description | system-capability | system-description | system-name } | dot1-tlv { all | port-vlan-id } }
缺省情況下,最近客戶橋代理允許發布基本TLV和IEEE 802.1組織定義TLV,其中IEEE 802.1組織定義的TLV隻支持Port And Protocol VLAN ID TLV、VLAN Name TLV及Management VLAN ID TLV。
不存在最近橋代理。
¡ 在三層聚合接口視圖下:
lldp agent { nearest-customer | nearest-nontpmr } tlv-enable basic-tlv { all | management-address-tlv [ ipv6 ] [ ip-address ] | port-description | system-capability | system-description | system-name }
缺省情況下,最近非TPMR橋代理不發布任何TLV;最近客戶橋代理隻允許發布基本TLV。
不存在最近橋代理。
管理地址被封裝在Management Address TLV中向外發布,封裝格式可以是數字或字符串。如果鄰居將管理地址以字符串格式封裝在TLV中,用戶可在本地設備上也將封裝格式改為字符串,以保證與鄰居設備的正常通信。
可以在全局或接口上配置允許在LLDP報文中發布管理地址並配置所發布的管理地址:全局的配置對所有接口都有效,而接口上的配置隻對當接口有效。對於一個接口來說,優先采用該接口上的配置,隻有該接口上未進行配置時,才采用全局的配置。當全局和接口下都未配置時,會采用接口下的缺省配置。
(1) 進入係統視圖。
system-view
(2) 配置全局允許在LLDP報文中發布管理地址並配置所發布的管理地址。
lldp [ agent { nearest-customer | nearest-nontpmr } ] global tlv-enable basic-tlv management-address-tlv [ ipv6 ] { ip-address | interface loopback interface-number | interface vlan-interface interface-number }
缺省情況下,全局不允許在LLDP報文中發布管理地址TLV。
(3) 進入接口視圖。
interface interface-type interface-number
(4) 允許在LLDP報文中發布管理地址並配置所發布的管理地址。
¡ 在二層以太網接口視圖/管理以太網接口視圖下:
lldp tlv-enable basic-tlv management-address-tlv [ ipv6 ] [ ip-address | interface loopback interface-number ]
lldp agent { nearest-customer | nearest-nontpmr } tlv-enable basic-tlv management-address-tlv [ ipv6 ] [ ip-address ]
¡ 在三層以太網接口視圖下:
lldp [ agent { nearest-customer | nearest-nontpmr } ] tlv-enable basic-tlv management-address-tlv [ ipv6 ] [ ip-address ] | interface loopback interface-number ]
¡ 在二/三層聚合接口視圖下:
lldp agent { nearest-customer | nearest-nontpmr } tlv-enable basic-tlv management-address-tlv [ ipv6 ] [ ip-address ]
缺省情況下,最近橋代理和最近客戶橋代理類型的LLDP允許在LLDP報文中發布管理地址,最近非TPMR橋代理類型LLDP不允許在LLDP報文中發布管理地址。
對於LLDP報文中所要發布的IPv6格式的管理地址,僅支持數字格式的封裝格式。
(5) 配置管理地址在TLV中的封裝格式為字符串格式。
¡ 在二/三層以太網接口視圖或管理以太網接口視圖下:
lldp [ agent { nearest-customer | nearest-nontpmr } ] management-address-format string
¡ 在二/三層聚合接口視圖下:
lldp agent { nearest-customer | nearest-nontpmr } management-address-format string
缺省情況下,管理地址在TLV中的封裝格式為數字格式。
LLDP早期版本要求隻有配置為相同的封裝格式才能處理該格式的LLDP報文,因此為了確保與運行LLDP早期版本的設備成功通信,必須配置為與之相同的封裝格式。
(1) 進入係統視圖。
system-view
(2) 進入接口視圖。
interface interface-type interface-number
(3) 配置LLDP報文的封裝格式為SNAP格式。
¡ 在二/三層以太網接口視圖或管理以太網接口視圖下:
lldp [ agent { nearest-customer | nearest-nontpmr } ] encapsulation snap
¡ 在二/三層聚合接口視圖下:
lldp agent { nearest-customer | nearest-nontpmr } encapsulation snap
缺省情況下,LLDP報文的封裝格式為Ethernet II格式。
LLDP報文所攜Time To Live TLV中TTL的值用來設置鄰居信息在本地設備上的老化時間,由於TTL=Min(65535,(TTL乘數×LLDP報文的發送時間間隔+1)),即取65535與(TTL乘數×LLDP報文的發送時間間隔+1)中的最小值,因此通過調整TTL乘數可以控製本設備信息在鄰居設備上的老化時間。
(1) 進入係統視圖。
system-view
(2) 配置TTL乘數。
lldp hold-multiplier value
缺省情況下,TTL乘數為4。
(3) 配置LLDP報文的發送時間間隔。
lldp timer tx-interval interval
缺省情況下,LLDP報文的發送時間間隔為30秒。
(4) 配置LLDP報文發包限速的令牌桶大小。
lldp max-credit credit-value
缺省情況下,發包限速令牌桶大小為5。
(5) 配置快速發送LLDP報文的個數。
lldp fast-count count
缺省情況下,快速發送LLDP報文的個數為4個。
(6) 配置快速發送LLDP報文的時間間隔。
lldp timer fast-interval interval
缺省情況下,快速發送LLDP報文的發送時間間隔為1秒。
在開啟了輪詢功能後,LLDP將以輪詢間隔周期性地查詢本設備的相關配置是否發生改變,如果發生改變將觸發LLDP報文的發送,以將本設備的配置變化迅速通知給其他設備。
(1) 進入係統視圖。
system-view
(2) 進入接口視圖。
interface interface-type interface-number
(3) 開啟輪詢功能並配置輪詢間隔。
¡ 在二/三層以太網接口視圖或管理以太網接口視圖下:
lldp [ agent { nearest-customer | nearest-nontpmr } ] check-change-interval interval
¡ 在二/三層聚合接口視圖下:
lldp agent { nearest-customer | nearest-nontpmr } check-change-interval interval
缺省情況下,輪詢功能處於關閉狀態。
一般組網情況下,要求鏈路兩端的PVID保持一致。設備會對收到的LLDP報文中的PVID TLV進行檢查,如果發現報文中的PVID與本端PVID不一致,則認為網絡中可能存在錯誤配置,LLDP會打印日誌信息,提示用戶。
但在一些特殊情況下,可以允許鏈路兩端的PVID配置不一致。例如為了簡化接入設備的配置,各接入設備的上行口采用相同的PVID,而對端彙聚設備的各接口采用不同的PVID,從而使各接入設備的流量進入不同VLAN。此時,可以關閉LLDP的PVID不一致性檢查功能。
(1) 進入係統視圖。
system-view
(2) 關閉LLDP的PVID不一致檢查功能。
lldp ignore-pvid-inconsistency
缺省情況下, LLDP的PVID不一致檢查功能處於開啟狀態。
當設備與隻支持CDP(Cisco Discovery Protocol,思科發現協議)不支持LLDP的Cisco設備直連時,可以通過配置LLDP兼容CDP功能與直連設備交互信息。
設備上配置LLDP兼容CDP功能後,可以利用LLDP來接收、識別從直連設備接收的CDP報文,並向直連設備發送CDP報文。設備向CDP鄰居設備發送的報文中攜帶設備ID,與鄰居設備相連端口的ID、端口IP地址以及生存時間信息。其中,端口IP地址為該端口允許通過的、對應VLAN接口上配置有IP地址且處於up狀態的最小VLAN的主IP地址,如果該端口允許通過的所有VLAN所對應的VLAN接口上都未配置IP地址或均處於down狀態,則不發布端口IP地址。設備可以識別的CDP鄰居設備的信息請參見display lldp neighbor-information命令顯示信息中的CDP neighbor-information相關字段,有關該命令的詳細介紹請參見“二層技術-以太網交換命令參考”中的“LLDP”。
LLDP兼容CDP功能有以下幾種工作模式:
· TxRx:既發送也接收CDP報文。
· Rx:接收但不發送CDP報文。
· Disable:既不發送也不接收CDP報文。
配置LLDP兼容CDP功能時,需要注意:
· 要使LLDP兼容CDP功能生效,必須先在全局開啟LLDP兼容CDP功能,並將LLDP兼容CDP功能的工作模式配置為TxRx。
· 由於CDP報文所攜Time To Live TLV中TTL的最大值為255,而CDP報文的發送時間間隔由LLDP報文的發送時間間隔控製,因此為保證LLDP兼容CDP功能的正常運行,建議配置LLDP報文的發送時間間隔值不大於實際TTL的1/3。
在配置LLDP兼容CDP功能之前,需完成以下任務:
· 全局開啟LLDP功能。
· 在設備與支持CDP的設備相連接的接口上開啟LLDP功能,並配置接口的LLDP工作模式為TxRx。
(1) 進入係統視圖。
system-view
(2) 開啟LLDP兼容CDP功能。
lldp compliance cdp
缺省情況下,LLDP兼容CDP功能處於關閉狀態。
(3) 進入二/三層以太網接口視圖或管理以太網接口視圖。
interface interface-type interface-number
(4) 配置LLDP兼容CDP功能的工作模式為TxRx。
lldp compliance admin-status cdp txrx
缺省情況下,LLDP兼容CDP功能的工作模式為Disable。
開啟LLDP Trap或LLDP-MED Trap功能後,設備可以通過向網管係統發送Trap信息以通告如發現新的LLDP鄰居或LLDP-MED鄰居、與原來鄰居的通信鏈路發生故障等重要事件。
LLDP Trap和LLDP-MED Trap信息的發送時間間隔是指設備向網管係統發送Trap信息的最小時間間隔,通過調整該時間間隔,可以避免由於鄰居信息頻繁變化而導致Trap信息的頻繁發送。
(1) 進入係統視圖。
system-view
(2) 進入接口視圖。
interface interface-type interface-number
(3) 開啟LLDP Trap功能。
¡ 在二/三層以太網接口視圖或管理以太網接口視圖下:
lldp [ agent { nearest-customer | nearest-nontpmr } ] notification remote-change enable
¡ 在二/三層聚合接口視圖下:
lldp agent { nearest-customer | nearest-nontpmr } notification remote-change enable
缺省情況下,LLDP Trap功能處於關閉狀態。
(4) 在二/三層以太網接口視圖或管理以太網接口視圖下開啟LLDP-MED Trap功能。
lldp notification med-topology-change enable
缺省情況下,LLDP-MED Trap功能處於關閉狀態。
(5) 退回係統視圖。
quit
(6) (可選)配置LLDP Trap和LLDP-MED Trap信息的發送時間間隔。
lldp timer notification-interval interval
缺省情況下,LLDP Trap和LLDP-MED Trap信息的發送時間間隔均為30秒。
開啟鄰居驗證功能後,如果滿足表1-6所示的鄰居驗證通過條件,則接口可以繼續收發數據報文;否則阻塞接口,即接口的鏈路層狀態置為DOWN,且不允許該接口繼續收發數據報文。
配置的鄰居識別信息 |
鄰居驗證通過條件 |
配置鄰居Chassis ID TLV識別信息 |
接口從鄰居收到的LLDPDU中攜帶的Chassis ID TLV與配置相同 |
配置鄰居Port ID TLV識別信息 |
接口從鄰居收到的LLDPDU中攜帶的Port ID TLV與配置相同 |
配置鄰居Chassis ID TLV和Port ID TLV識別信息 |
接口從鄰居收到的LLDPDU中攜帶的Chassis ID TLV和Port ID TLV與配置全部相同 |
(1) 進入係統視圖。
system-view
(2) 進入二/三層以太網接口視圖。
interface interface-type interface-number
(3) 配置鄰居識別信息。請至少選擇其中一項進行配置。
¡ 配置鄰居Chassis ID TLV識別信息。
lldp neighbor-identity chassis-id chassis-id-subtype chassis-id
¡ 配置鄰居Port ID TLV識別信息。
lldp neighbor-identity port-id port-id-subtype port-id
缺省情況下,未配置鄰居Chassis ID TLV識別信息和Port ID TLV識別信息。
(4) 配置鄰居驗證保護功能。
lldp neighbor-protection validation
缺省情況下,鄰居驗證保護功能處於關閉狀態。
鄰居老化超時保護功能分為鄰居老化超時後阻塞接口和鄰居老化超時後關閉接口。
· 阻塞接口:在超過老化時間後,如果接口收不到LLDP報文,則阻塞該接口,即接口的鏈路層狀態置為DOWN,且不允許該接口繼續收發數據報文;如果接口收到LLDP報文,則該接口可以繼續收發數據報文。接口收發協議報文不受影響。
· 關閉接口:在超過老化時間後,會立刻關閉接口,即接口的狀態置為LLDP DOWN,且不允許該接口繼續收發數據報文和協議報文,被關閉的接口需要執行命令undo lldp neighbor-protection aging或者命令undo shutdown才能被重新開啟。
(1) 進入係統視圖。
system-view
(2) 進入二/三層以太網接口視圖。
interface interface-type interface-number
(3) 配置鄰居超時保護功能。
lldp neighbor-protection aging { block | shutdown }
缺省情況下,鄰居超時保護功能處於關閉狀態。
本功能用來配合設備支持通過LLDP生成對端管理地址的ARP或ND表項功能使用,以保證設備發送報文的源MAC地址為VLAN接口的MAC地址,而不是當前接口的MAC地址,確保對端學習到正確的ARP/ND表項。
在二層以太網接口下配置本功能後,當前接口發送的LLDP報文源MAC地址為本功能指定的VLAN ID對應的VLAN接口的MAC地址。以下情況時,LLDP報文源MAC地址為當前二層以太網接口的MAC地址:
· 指定的VLAN未創建或對應的VLAN接口未創建。
· 指定的VLAN ID對應的VLAN接口物理狀態為DOWN。
(1) 進入係統視圖。
system-view
(2) 進入二層以太網接口視圖。
interface interface-type interface-number
(3) 配置LLDP報文源MAC地址為VLAN接口的MAC地址。
lldp source-mac vlan vlan-id
缺省情況下,LLDP報文源MAC地址為當前接口的MAC地址。
配置本特性後,當接口收到攜帶IPv4格式Management Address TLV的LLDP報文後,會生成該報文攜帶的管理地址與報文源MAC地址組成的ARP表項;當接口收到攜帶IPv6格式Management Address TLV的LLDP報文後,會生成該報文攜帶的管理地址與報文源MAC地址組成的ND表項。
在二層以太網接口下配置本功能後,生成的表項中的出接口為當前二層以太網接口,表項所屬的VLAN為本命令指定的VLAN。以下情況時,無法生成ARP表項及ND表項:
· 指定的VLAN未創建或對應的VLAN接口未創建。
· 指定的VLAN ID對應的VLAN接口物理狀態為DOWN。
在三層以太網接口下配置本功能後,生成的表項中的出接口為當前三層以太網接口。
在二層以太網接口下配置本功能時,需要同時配置lldp source-mac vlan命令,以保證設備發送報文的MAC為VLAN接口的MAC地址,而不是端口的MAC地址,確保對端學習到正確的ARP/ND表項。
(1) 進入係統視圖。
system-view
(2) 進入二層以太網接口視圖/三層以太網接口視圖。
interface interface-type interface-number
(3) 配置接口收到攜帶Management Address TLV的LLDP報文後生成ARP表項或ND表項。
¡ 在二層以太網接口視圖下:
lldp management-address { arp-learning | nd-learning } [ vlan vlan-id ]
¡ 在三層以太網接口視圖下:
lldp management-address { arp-learning | nd-learning }
缺省情況下,接口收到攜帶Management Address TLV的LLDP報文後不生成ARP表項和ND表項。
ARP表項和ND表項的生成互不影響,可同時配置。
對於二層以太網接口,不允許多個端口關聯同一個VLAN,否則生成的ARP表項或ND表項會相互覆蓋。
可在任意視圖下執行以下命令:
display lldp local-information [ global | interface interface-type interface-number ]
· 顯示由鄰居設備發來的LLDP信息。
display lldp neighbor-information [ [ [ interface interface-type interface-number ] [ agent { nearest-bridge | nearest-customer | nearest-nontpmr } ] [ verbose ] ] | list [ system-name system-name ] ]
· 顯示接口上可發送的可選TLV信息。
display lldp tlv-config [ interface interface-type interface-number ] [ agent { nearest-bridge | nearest-customer | nearest-nontpmr } ]
· 顯示LLDP的狀態信息。
display lldp status [ interface interface-type interface-number ] [ agent { nearest-bridge | nearest-customer | nearest-nontpmr } ]
· 顯示LLDP的統計信息。
display lldp statistics [ global | [ interface interface-type interface-number ] [ agent { nearest-bridge | nearest-customer | nearest-nontpmr } ] ]
· NMS(Network Management System,網絡管理係統)與Device A相連,Device A通過接口HundredGigE1/0/1和HundredGigE1/0/2分別與MED設備和Device B相連。
· 通過在Device A和Device B上配置LLDP功能,使NMS可以對Device A與MED設備之間、以及Device A與Device B之間鏈路的通信情況進行判斷。
圖1-5 LLDP基本功能配置組網圖
缺省情況下,本設備的接口處於ADM(Administratively Down)狀態,請根據實際需要在對應接口視圖下使用undo shutdown命令開啟接口。
(1) 配置Device A
# 全局開啟LLDP功能。
<DeviceA> system-view
[DeviceA] lldp global enable
# 在接口HundredGigE1/0/1和HundredGigE1/0/2上分別開啟LLDP功能(此步驟可省略,LLDP功能在接口上缺省開啟),並配置LLDP工作模式為Rx。
[DeviceA] interface hundredgige 1/0/1
[DeviceA-HundredGigE1/0/1] lldp enable
[DeviceA-HundredGigE1/0/1] lldp admin-status rx
[DeviceA-HundredGigE1/0/1] quit
[DeviceA] interface hundredgige 1/0/2
[DeviceA-HundredGigE1/0/2] lldp enable
[DeviceA-HundredGigE1/0/2] lldp admin-status rx
[DeviceA-HundredGigE1/0/2] quit
(2) 配置Device B
# 全局開啟LLDP功能。
<DeviceB> system-view
[DeviceB] lldp global enable
# 在接口HundredGigE1/0/1上開啟LLDP功能(此步驟可省略,LLDP功能在接口上缺省開啟),並配置LLDP工作模式為Tx。
[DeviceB] interface hundredgige 1/0/1
[DeviceB-HundredGigE1/0/1] lldp enable
[DeviceB-HundredGigE1/0/1] lldp admin-status tx
[DeviceB-HundredGigE1/0/1] quit
# 顯示Device A上全局和所有接口的LLDP狀態信息。
[DeviceA] display lldp status
Global status of LLDP: Enable
Bridge mode of LLDP: customer-bridge
The current number of LLDP neighbors: 2
The current number of CDP neighbors: 0
LLDP neighbor information last changed time: 0 days, 0 hours, 4 minutes, 40 seconds
Transmit interval : 30s
Fast transmit interval : 1s
Transmit credit max : 5
Hold multiplier : 4
Reinit delay : 2s
Trap interval : 30s
Fast start times : 4
LLDP status information of port 1 [HundredGigE1/0/1]:
LLDP agent nearest-bridge:
Port status of LLDP : Enable
Admin status : Rx_Only
Trap flag : No
MED trap flag : No
Polling interval : 0s
Number of LLDP neighbors : 1
Number of MED neighbors : 1
Number of CDP neighbors : 0
Number of sent optional TLV : 21
Number of received unknown TLV : 0
LLDP agent nearest-nontpmr:
Port status of LLDP : Enable
Admin status : Disable
Trap flag : No
MED trap flag : No
Polling interval : 0s
Number of LLDP neighbors : 0
Number of MED neighbors : 0
Number of CDP neighbors : 0
Number of sent optional TLV : 1
Number of received unknown TLV : 0
LLDP agent nearest-customer:
Port status of LLDP : Enable
Admin status : Disable
Trap flag : No
MED trap flag : No
Polling interval : 0s
Number of LLDP neighbors : 0
Number of MED neighbors : 0
Number of CDP neighbors : 0
Number of sent optional TLV : 16
Number of received unknown TLV : 0
LLDP status information of port 2 [HundredGigE1/0/2]:
LLDP agent nearest-bridge:
Port status of LLDP : Enable
Admin status : Rx_Only
Trap flag : No
MED trap flag : No
Polling interval : 0s
Number of LLDP neighbors : 1
Number of MED neighbors : 0
Number of CDP neighbors : 0
Number of sent optional TLV : 21
Number of received unknown TLV : 3
LLDP agent nearest-nontpmr:
Port status of LLDP : Enable
Admin status : Disable
Trap flag : No
MED trap flag : No
Polling interval : 0s
Number of LLDP neighbors : 0
Number of MED neighbors : 0
Number of CDP neighbors : 0
Number of sent optional TLV : 1
Number of received unknown TLV : 0
LLDP agent nearest-customer:
Port status of LLDP : Enable
Admin status : Disable
Trap flag : No
MED trap flag : No
Polling interval : 0s
Number of LLDP neighbors : 0
Number of MED neighbors : 0
Number of CDP neighbors : 0
Number of sent optional TLV : 16
Number of received unknown TLV : 0
由此可見,Device A的接口HundredGigE1/0/1上連接了一個MED鄰居設備,HundredGigE1/0/2上則連接了一個非MED鄰居設備,且這兩個接口的LLDP工作模式都為Rx,即隻接收而不發送LLDP報文。
# 將Device A和Device B間的鏈路斷掉後,再顯示Device A上所有接口的LLDP狀態信息。
[DeviceA] display lldp status
Global status of LLDP: Enable
The current number of LLDP neighbors: 1
The current number of CDP neighbors: 0
LLDP neighbor information last changed time: 0 days, 0 hours, 5 minutes, 20 seconds
Transmit interval : 30s
Fast transmit interval : 1s
Transmit credit max : 5
Hold multiplier : 4
Reinit delay : 2s
Trap interval : 30s
Fast start times : 4
LLDP status information of port 1 [HundredGigE1/0/1]:
LLDP agent nearest-bridge:
Port status of LLDP : Enable
Admin status : Rx_Only
Trap flag : No
MED trap flag : No
Polling interval : 0s
Number of LLDP neighbors : 1
Number of MED neighbors : 1
Number of CDP neighbors : 0
Number of sent optional TLV : 0
Number of received unknown TLV : 5
LLDP agent nearest-nontpmr:
Port status of LLDP : Enable
Admin status : Disabl
Trap flag : No
MED trap flag : No
Polling interval : 0s
Number of LLDP neighbors : 0
Number of MED neighbors : 0
Number of CDP neighbors : 0
Number of sent optional TLV : 1
Number of received unknown TLV : 0
LLDP status information of port 2 [HundredGigE1/0/2]:
LLDP agent nearest-bridge:
Port status of LLDP : Enable
Admin status : Rx_Only
Trap flag : No
MED trap flag : No
Polling interval : 0s
Number of LLDP neighbors : 0
Number of MED neighbors : 0
Number of CDP neighbors : 0
Number of sent optional TLV : 0
Number of received unknown TLV : 0
LLDP agent nearest-nontpmr:
Port status of LLDP : Enable
Admin status : Disable
Trap flag : No
MED trap flag : No
Polling interval : 0s
Number of LLDP neighbors : 0
Number of MED neighbors : 0
Number of CDP neighbors : 0
Number of sent optional TLV : 1
Number of received unknown TLV : 0
LLDP agent nearest-customer:
Port status of LLDP : Enable
Admin status : Disable
Trap flag : No
MED trap flag : No
Polling interval : 0s
Number of LLDP neighbors : 0
Number of MED neighbors : 0
Number of CDP neighbors : 0
Number of sent optional TLV : 16
Number of received unknown TLV : 0
由此可見,Device A的接口HundredGigE1/0/2上已經沒有任何鄰居設備了。
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!