1. 程式人生 > 其它 >DPDK-VPP 學習筆記-06 bond 鏈路聚合 LACP

DPDK-VPP 學習筆記-06 bond 鏈路聚合 LACP

技術標籤:DPDKVPPbondLACPEth-Trunk乙太網

DPDK-VPP 學習筆記-06 bond 鏈路聚合 LACP

本筆記主要測試VPP與交換機鏈路聚合配置&狀態:

  • Switch: HW CE6880
  • NIC: Mellanox CX5

鏈路聚合簡介

乙太網鏈路聚合(Eth-Trunk)簡稱鏈路聚合,它通過將多條乙太網物理鏈路捆綁在一起成為一條邏輯鏈路,從而實現增加鏈路頻寬的目的。同時,這些捆綁在一起的鏈路通過相互間的動態備份,可以有效地提高鏈路的可靠性。使用上因系統不同, PortChannel & Bond 等都是鏈路聚合的別名。
在這裡插入圖片描述
鏈路聚合工作模式分為手工負載分擔模式和LACP模式。

手工負載分擔模式

手工負載分擔模式下,鏈路聚合的建立、成員介面的加入由手工配置,沒有鏈路聚合控制協議的參與。該模式下所有活動鏈路都參與資料的轉發,平均分擔流量,因此稱為負載分擔模式。如果某條活動鏈路故障,鏈路聚合組自動在剩餘的活動鏈路中平均分擔流量。當需要在兩個直連裝置間提供一個較大的鏈路頻寬而裝置又不支援LACP協議時,可以使用手工負載分擔模式。

LACP模式

鏈路聚合協議LACP分為靜態LACP模式和動態LACP模式

靜態LACP模式

靜態LACP模式下,鏈路聚合介面的建立,成員介面的加入,都是由手工配置完成的。但與手工負載分擔模式鏈路聚合不同的是,該模式下活動介面的選擇由LACP協議報文負責。也就是說,當把一組介面加入鏈路聚合介面後,這些成員介面中哪些介面作為活動介面,哪些介面作為非活動介面還需要經過LACP協議報文的協商確定。

靜態LACP模式也稱為M∶N模式。這種方式同時可以實現負載分擔和冗餘備份的雙重功能。在鏈路聚合組中M條鏈路處於活動狀態,這些鏈路負責轉發資料並進行負載分擔,另外N條鏈路處於非活動狀態作為備份鏈路,不轉發資料。當M條鏈路中有鏈路出現故障時,系統會從N條備份鏈路中選擇優先順序最高的接替出現故障的鏈路,同時這條鏈路狀態變為活動狀態開始轉發資料。

動態LACP模式

靜態LACP模式和動態LACP模式在LACP協議互動方面沒有區別,區別在於兩種模式在LACP協商失敗後的處理不一致:
◾靜態LACP模式下,LACP協商失敗後鏈路聚合埠變為Down,不能轉發資料。
◾動態LACP模式,LACP協商失敗後鏈路聚合埠變為Down,但其成員口繼承鏈路聚合埠的VLAN屬性狀態變為Indep,可獨立進行二層資料轉發。

當部署動態LACP模式鏈路聚合介面的裝置能夠收到對端的LACP協議報文時,兩端裝置將通過LACP協議報文進行聚合引數協商。協商成功後的聚合鏈路功能與兩端都配置為靜態LACP模式鏈路聚合介面的鏈路一樣。

VPP bond LACP

VPP bond lacp 模式等同於HW交換機中 LACP模式 , 支援靜態mode lacp-static 與動態mode lacp-dynamic 兩種模式.

vpp# create bond mode lacp  load-balance l23 
BondEthernet0
vpp# bond add BondEthernet0 HundredGigabitEthernet5/0/0 
vpp# bond add BondEthernet0 HundredGigabitEthernet5/0/1 
vpp# set int state BondEthernet0 up 
vpp# set int ip address BondEthernet0  10.245.120.42/24 
vpp# show bond details
BondEthernet0
  mode: lacp
  load balance: l23
  number of active members: 0
  number of members: 2
    HundredGigabitEthernet5/0/0
    HundredGigabitEthernet5/0/1
  device instance: 0
  interface id: 0
  sw_if_index: 3
  hw_if_index: 3
vpp# 
vpp# show int
              Name               Idx    State  MTU (L3/IP4/IP6/MPLS)     Counter          Count     
BondEthernet0                     3      up          1500/0/0/0     rx packets                  2590
                                                                    rx bytes                  321102
                                                                    tx packets                     1
                                                                    tx bytes                      66
HundredGigabitEthernet5/0/0       1      up          1500/0/0/0     rx packets                  1310
                                                                    rx bytes                  161986
                                                                    tx packets                    78
                                                                    tx bytes                    8966
                                                                    drops                       1294
HundredGigabitEthernet5/0/1       2      up          1500/0/0/0     rx packets                  1306
                                                                    rx bytes                  161626
                                                                    tx packets                    54
                                                                    tx bytes                    6638
                                                                    drops                       1295
local0                            0     down          0/0/0/0       drops                          1
vpp# 

靜態LACP模式

HW CE8850 交換配置:

[~HUAWEI-Eth-Trunk20]disp this
#
interface Eth-Trunk20
 undo portswitch
 ip address 10.245.120.1 255.255.255.0
 mode lacp-static
#
return
[~HUAWEI-Eth-Trunk20]disp eth-trunk 20
Eth-Trunk20's state information is:
Local:
LAG ID: 20                      Working Mode: Static
Preempt Delay: Disabled         Hash Arithmetic: profile default
System Priority: 32768          System ID: 04bd-706e-b951
Least Active-linknumber: 1      Max Active-linknumber: 16 
Operating Status: up            Number Of Up Ports In Trunk: 2
Timeout Period: Slow          
--------------------------------------------------------------------------------
ActorPortName          Status   PortType PortPri PortNo PortKey PortState Weight
100GE1/0/3             Selected 100GE    32768   2      5201    10111100  1     
100GE1/0/27            Selected 100GE    32768   1      5201    10111100  1     

Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
100GE1/0/3             65535    9803-9b97-5076  255     1      3       11111100 
100GE1/0/27            65535    9803-9b97-5076  255     2      3       11111100 

VPP lacp 狀態:

vpp# show lacp        
                                                        actor state                      partner state                   
interface name            sw_if_index  bond interface   exp/def/dis/col/syn/agg/tim/act  exp/def/dis/col/syn/agg/tim/act
HundredGigabitEthernet5/0 2            BondEthernet0      0   0   1   1   1   1   1   1    0   0   1   1   1   1   0   1
  LAG ID: [(ffff,98-03-9b-97-50-76,0003,00ff,0002), (8000,04-bd-70-6e-b9-51,1451,8000,0001)]
  RX-state: CURRENT, TX-state: TRANSMIT, MUX-state: COLLECTING_DISTRIBUTING, PTX-state: PERIODIC_TX
HundredGigabitEthernet5/0 1            BondEthernet0      0   0   1   1   1   1   1   1    0   0   1   1   1   1   0   1
  LAG ID: [(ffff,98-03-9b-97-50-76,0003,00ff,0001), (8000,04-bd-70-6e-b9-51,1451,8000,0002)]
  RX-state: CURRENT, TX-state: TRANSMIT, MUX-state: COLLECTING_DISTRIBUTING, PTX-state: PERIODIC_TX

動態LACP模式

HW CE8850 交換配置:

[~HUAWEI-Eth-Trunk20]disp this
#
interface Eth-Trunk20
 undo portswitch
 ip address 10.245.120.1 255.255.255.0
 mode lacp-dynamic
#
return
[~HUAWEI-Eth-Trunk20]disp eth-trunk 20
Eth-Trunk20's state information is:
Local:
LAG ID: 20                      Working Mode: Dynamic
Preempt Delay: Disabled         Hash Arithmetic: profile default
System Priority: 32768          System ID: 04bd-706e-b951
Least Active-linknumber: 1      Max Active-linknumber: 16 
Operating Status: up            Number Of Up Ports In Trunk: 2
Timeout Period: Slow          
--------------------------------------------------------------------------------
ActorPortName          Status   PortType PortPri PortNo PortKey PortState Weight
100GE1/0/3             Selected 100GE    32768   2      5201    10111100  1     
100GE1/0/27            Selected 100GE    32768   1      5201    10111100  1     

Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
100GE1/0/3             65535    9803-9b97-5076  255     1      3       11111100 
100GE1/0/27            65535    9803-9b97-5076  255     2      3       11111100 

VPP lacp 狀態:

vpp# show lacp                            
                                                        actor state                      partner state                   
interface name            sw_if_index  bond interface   exp/def/dis/col/syn/agg/tim/act  exp/def/dis/col/syn/agg/tim/act
HundredGigabitEthernet5/0 2            BondEthernet0      0   0   1   1   1   1   1   1    0   0   1   1   1   1   0   1
  LAG ID: [(ffff,98-03-9b-97-50-76,0003,00ff,0002), (8000,04-bd-70-6e-b9-51,1451,8000,0001)]
  RX-state: CURRENT, TX-state: TRANSMIT, MUX-state: COLLECTING_DISTRIBUTING, PTX-state: PERIODIC_TX
HundredGigabitEthernet5/0 1            BondEthernet0      0   0   1   1   1   1   1   1    0   0   1   1   1   1   0   1
  LAG ID: [(ffff,98-03-9b-97-50-76,0003,00ff,0001), (8000,04-bd-70-6e-b9-51,1451,8000,0002)]
  RX-state: CURRENT, TX-state: TRANSMIT, MUX-state: COLLECTING_DISTRIBUTING, PTX-state: PERIODIC_TX

VPP bond XOR

VPP bond xor 模式等同於HW交換機中 手工負載分擔模式 & mode manual load-balance 也是鏈路聚合的預設模式.

HW CE8850交換機配置:

[~HUAWEI-Eth-Trunk20]disp this
#
interface Eth-Trunk20
 undo portswitch
 ip address 10.245.120.1 255.255.255.0
#
return
[~HUAWEI-Eth-Trunk20]disp eth-trunk 20
Eth-Trunk20's state information is:
Working Mode: Normal        Hash Arithmetic: profile default
Least Active-linknumber: 1  Max Bandwidth-affected-linknumber: 16
Operating Status: up        Number of Up Ports in Trunk: 2
--------------------------------------------------------------------------------
PortName                      Status      Weight
100GE1/0/3                    Up          1          
100GE1/0/27                   Up          1       

VPP 配置:

vpp# set int state  HundredGigabitEthernet5/0/0 up
vpp# set int state  HundredGigabitEthernet5/0/1 up
vpp# create bond mode xor  load-balance l23
vpp# bond add BondEthernet0 HundredGigabitEthernet5/0/0
vpp# bond add BondEthernet0 HundredGigabitEthernet5/0/1
vpp# set int state BondEthernet0 up
vpp# set int ip address  BondEthernet0 10.245.120.42/24
vpp# show bond details
BondEthernet0
  mode: xor
  load balance: l23
  number of active members: 2
    HundredGigabitEthernet5/0/0
    HundredGigabitEthernet5/0/1
  number of members: 2
    HundredGigabitEthernet5/0/0
    HundredGigabitEthernet5/0/1
  device instance: 0
  interface id: 0
  sw_if_index: 3
  hw_if_index: 3
vpp# show version 
vpp v21.01-rc1~3-gf097300c2 built by root on fc29 at 2021-01-21T06:11:27
vpp# show int
              Name               Idx    State  MTU (L3/IP4/IP6/MPLS)     Counter          Count     
BondEthernet0                     3      up          1500/0/0/0     rx packets                    26
                                                                    rx bytes                    2510
                                                                    tx packets                    25
                                                                    tx bytes                    2394
                                                                    drops                          1
                                                                    ip4                           25
HundredGigabitEthernet5/0/0       1      up          1500/0/0/0     rx packets                    16
                                                                    rx bytes                    1530
                                                                    tx packets                    25
                                                                    tx bytes                    2394
HundredGigabitEthernet5/0/1       2      up          1500/0/0/0     rx packets                    10
                                                                    rx bytes                     980
local0                            0     down          0/0/0/0       drops                          1
vpp# 

參考文件

VPP vnet bonding
CloudEngine 12800, 12800E V200R005C00 配置指南-乙太網鏈路聚合配置