1、Eth-Trunk背景
隨着網絡中部署的業務量不斷增長,對於全雙工點對點鏈路,單條物理鏈路的帶寬已不能滿足正常的業務流量需求。如果將當前接口板替換爲具備更高帶寬的接口板,則會浪費現有的設備資源,而且升級代價較大。如果增加設備間的鏈路數量,則在作爲三層口使用時需要在每個接口上配置IP地址,從而導致浪費IP地址資源
1.1、Eth-Trunk的優點
Eth-Trunk( 鏈路聚合技術 )作爲一種捆綁技術,可以把多個獨立的物理接口綁定在一起作爲一個大帶寬的邏輯接口使用,這樣既不用替換接口板也不會浪費IP地址資源
根據不同的鏈路聚合模式,Eth-Trunk接口可以實現增加帶寬、負載分擔等,幫助提高網絡的可靠性
2、Eth-Trunk原理
Eth-Trunk可以用於二層的鏈路聚合,也可以用於三層的鏈路聚合。
缺省情況下,以太網接口工作在二層模式。
如果需要配置二層Eth-Trunk接口,可以通過portswitch命令將該接口切換成二層接口;
如果需要配置三層Eth-Trunk接口,可以通過undo portswitch命令將該接口切換成三層接口。
Eth-Trunk是一種將多個以太網接口捆綁成一個邏輯接口的捆綁技術。
Eth-Trunk鏈路聚合模式
手工負載分擔模式
LACP模式
2.1、手工負載分擔模式
當兩臺設備中至少有一臺不支持LACP協議時,可使用手工負載分擔模式的Eth-Trunk來增加設備間的帶寬及可靠性。
注意:在手工負載分擔模式下,加入Eth-Trunk的鏈路都進行數據的轉發。
2.2、LACP模式
LACP模式也稱爲M:N模式,其中M條鏈路處於活動狀態轉發數據,N條鏈路處於非活動狀態作爲備份鏈路。
圖中設置的活躍鏈路數爲2,即2條鏈路處於轉發狀態,1條鏈路處於備份狀態,不轉發數據,只有當活躍的鏈路出現故障時,備份鏈路才進行轉發。
LACP模式活動鏈路的選取
LACP模式的搶佔機制
2.3、Eth-Trunk接口負載分擔
Eth-Trunk接口進行負載分擔時,可以選擇IP地址或者包作爲負載分擔的散列依據;同時還可以設置成員接口的負載分擔權重。成員接口的權重值佔所有成員接口負載分擔權重之和的比例越大,該成員接口承擔的負載就越大。
執行命令system-view,進入系統視圖。
執行命令interface eth-trunk trunk-id,進入Eth-Trunk接口視圖。
執行命令load-balance { ip | packet-all },配置Eth-Trunk接口的散列依據。
缺省情況下,當Eth-Trunk接口根據IP進行散列。
說明:
基於IP的散列算法能保證包順序,但不能保證帶寬利用率。
基於包的散列算法能保證帶寬利用率,但不能保證包的順序。
配置負載分擔權重
執行命令system-view,進入系統視圖。
執行命令interface interface-type interface-number,進入以太網接口視圖。
執行命令distribute-weight weight-value,配置Eth-Trunk成員接口的負載分擔權重。
缺省情況下,成員接口的負載分擔權重爲1
3、Eth-Trunk配置
3.1、Eth-Trunk接口配置流程
Eth-trunk在同一個接口下的注意事項
在一個聚合口中,聚合鏈路兩端的物理口(即成員口)的所有參數必須一致,包括物理口的數量,傳輸速率,雙工模式和流量控制模式。成員口可以是二層接口或三層接口
3.2、配置手工負載分擔模式
配置手工負載分擔模式的步驟
創建Eth-Trunk
配置Eth-Trunk的工作模式
Eth-Trunk中加入成員接口
3.3、配置LACP模式
配置LACP模式的步驟:
創建Eth-Trunk;
配置Eth-Trunk的工作模式;
Eth-Trunk中加入成員接口;
(可選)配置系統LACP優先級;
(可選)配置活動接口數上限閾值;
(可選)配置接口LACP優先級;
(可選)使能LACP搶佔並配置搶佔延時時間。
3.4、舉例如下
手工負載分擔模式(默認)
SW1的配置文件
#
sysname SW1
#
vlan batch 5
#
interface Eth-Trunk12
port link-type trunk
port trunk allow-pass vlan 5
trunkport GigabitEthernet 0/0/1 to 0/0/3 第一種方式:把接口加入到eth-trunk12
怎麼將接口加入到Eth-Trunk當中
第一種方式:把接口加入到eth-trunk12
第二種方式:在接口下面直接敲eth-trunk12
interface GigabitEthernet0/0/1
eth-trunk 12 第二種方式:在接口下面直接敲eth-trunk12
#
interface GigabitEthernet0/0/2
eth-trunk 12 第二種方式:在接口下面直接敲eth-trunk12
#
interface GigabitEthernet0/0/3
eth-trunk 12 第二種方式:在接口下面直接敲eth-trunk12
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 5
#
SW2的配置文件
#
sysname SW2
#
vlan batch 5
#
interface Eth-Trunk12
port link-type trunk
port trunk allow-pass vlan 5
#
interface GigabitEthernet0/0/1
eth-trunk 12
#
interface GigabitEthernet0/0/2
eth-trunk 12
#
interface GigabitEthernet0/0/3
eth-trunk 12
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 5
#
LACP負載分擔模式
SW1的配置文件
#
sysname SW1
#
vlan batch 5
#
interface Eth-Trunk12
port link-type trunk
port trunk allow-pass vlan 5
mode lacp-static 修改我們的模式
lacp preempt enable 開啓我們接口的搶佔功能
max active-linknumber 2 活動鏈路的條數
#
lacp priority 4096 確定SW1爲我們主動端
#
interface GigabitEthernet0/0/2
eth-trunk 12
lacp priority 4096 把我們G0/0/2的接口優先級設置爲4096
#
interface GigabitEthernet0/0/3
eth-trunk 12
lacp priority 8192 把我們G0/0/3的接口優先級設置爲8192
#
檢查
[SW1]display eth-trunk 12
Eth-Trunk12's state information is:
Local:
LAG ID: 12 WorkingMode: STATIC
Preempt Delay Time: 30 Hash arithmetic: According to SIP-XOR-DIP
System Priority: 4096 System ID: 4c1f-ccb3-41d0
Least Active-linknumber: 1 Max Active-linknumber: 2
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/1 Unselect 1GE 32768 2 3121 10100000 1
GigabitEthernet0/0/2 Selected 1GE 4096 3 3121 10111100 1
GigabitEthernet0/0/3 Selected 1GE 8192 4 3121 10111100 1
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
GigabitEthernet0/0/1 32768 4c1f-cc77-6efe 32768 2 3121 10110000
GigabitEthernet0/0/2 32768 4c1f-cc77-6efe 32768 3 3121 10111100
GigabitEthernet0/0/3 32768 4c1f-cc77-6efe 32768 4 3121 10111100
把SW1的G0/0/2接口手動shutdown
[SW1-GigabitEthernet0/0/2]shutdown
[SW1]display eth-trunk 12
Eth-Trunk12's state information is:
Local:
LAG ID: 12 WorkingMode: STATIC
Preempt Delay Time: 30 Hash arithmetic: According to SIP-XOR-DIP
System Priority: 4096 System ID: 4c1f-ccb3-41d0
Least Active-linknumber: 1 Max Active-linknumber: 2
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/1 Selected 1GE 32768 2 3121 10111100 1
GigabitEthernet0/0/2 Unselect 1GE 4096 3 3121 10100010 1
GigabitEthernet0/0/3 Selected 1GE 8192 4 3121 10111100 1
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
GigabitEthernet0/0/1 32768 4c1f-cc77-6efe 32768 2 3121 10111100
GigabitEthernet0/0/2 0 0000-0000-0000 0 0 0 10100011
GigabitEthernet0/0/3 32768 4c1f-cc77-6efe 32768 4 3121 10111100
[SW1]
思考如下
實戰如下
在路由器AR1上面的配置
#
sysname AR1
#
vlan batch 10 30
#
lacp priority 1
#
interface Eth-Trunk1
undo portswitch
mode lacp-static
lacp preempt enable
max active-linknumber 2
lacp preempt delay 10
#
interface Eth-Trunk1.10
dot1q termination vid 10
ip address 192.168.1.254 255.255.255.0
arp broadcast enable
#
interface Eth-Trunk1.30
dot1q termination vid 30
ip address 192.168.3.254 255.255.255.0
arp broadcast enable
#
interface GigabitEthernet0/0/0
eth-trunk 1
lacp priority 1
#
interface GigabitEthernet0/0/1
ip address 192.168.2.254 255.255.255.0
#
interface GigabitEthernet0/0/2
eth-trunk 1
lacp priority 2
#
interface GigabitEthernet1/0/0
eth-trunk 1
#
在交換機上面的配置
#
sysname SW1
#
vlan batch 10 30
#
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 10 30
mode lacp-static
#
interface GigabitEthernet0/0/1
eth-trunk 1
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/3
eth-trunk 1
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 30
#
interface GigabitEthernet0/0/5
eth-trunk 1
#
檢查如下
<AR1>display eth-trunk 1
Eth-Trunk1's state information is:
Local:
LAG ID: 1 WorkingMode: STATIC
Preempt Delay Time: 10 Hash arithmetic: According to SIP-XOR-DIP
System Priority: 1 System ID: 00e0-fc97-0676
Least Active-linknumber: 1 Max Active-linknumber: 2
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/0 Selected 1GE 1 1 305 10111100 1
GigabitEthernet0/0/2 Selected 1GE 2 2 305 10111100 1
GigabitEthernet1/0/0 Unselect 1GE 32768 3 305 10100000 1
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
GigabitEthernet0/0/0 32768 4c1f-cca8-21b9 32768 2 305 10111100
GigabitEthernet0/0/2 32768 4c1f-cca8-21b9 32768 4 305 10111100
GigabitEthernet1/0/0 32768 4c1f-cca8-21b9 32768 6 305 10110000
<AR1>display trunkmembership eth-trunk 1
Trunk ID: 1
Used status: VALID
TYPE: ethernet
Working Mode : Static
Number Of Ports in Trunk = 3
Number Of Up Ports in Trunk = 2
Operate status: up
Interface GigabitEthernet0/0/0, valid, operate up, weight=1
Interface GigabitEthernet0/0/2, valid, operate up, weight=1
Interface GigabitEthernet1/0/0, valid, operate down, weight=1
<SW1>display eth-trunk 1
Eth-Trunk1's state information is:
Local:
LAG ID: 1 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 32768 System ID: 4c1f-cca8-21b9
Least Active-linknumber: 1 Max Active-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/1 Selected 1GE 32768 2 305 10111100 1
GigabitEthernet0/0/3 Selected 1GE 32768 4 305 10111100 1
GigabitEthernet0/0/5 Unselect 1GE 32768 6 305 10110000 1
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
GigabitEthernet0/0/1 1 00e0-fc97-0676 1 1 305 10111100
GigabitEthernet0/0/3 1 00e0-fc97-0676 2 2 305 10111100
GigabitEthernet0/0/5 1 00e0-fc97-0676 32768 3 305 10100000
<SW1>display trunkmembership eth-trunk 1
Trunk ID: 1
Used status: VALID
TYPE: ethernet
Working Mode : Static
Number Of Ports in Trunk = 3
Number Of Up Ports in Trunk = 2
Operate status: up
Interface GigabitEthernet0/0/1, valid, operate up, weight=1
Interface GigabitEthernet0/0/3, valid, operate up, weight=1
Interface GigabitEthernet0/0/5, valid, operate down, weight=1