1.简单二层架构
1.1 拓扑图
1.2 配置
1.2.1 Leaf1配置
system-mac必须配置,否则会有一个node处于unknown状态,即使配置主节点的mac,主节点也需要配置system-mac为自己的mac
## M-LAG配置[Leaf1] m-lag system-mac 0001-0001-0001 # 手动设置MAC,通常建议使用主设备的系统MAC,另一台设备配置需相同
[Leaf1] m-lag system-number 1 # 数字小的成为主设备,
[Leaf1] m-lag system-priority 130 # 两台的优先级需要一样
[Leaf1] m-lag mad exclude interface GigabitEthernet1/0/13 # 配置保留接口,这个接口会在脑裂后不会被关闭
[Leaf1] m-lag consistency-check disable # 模拟器中配置完成后,会报一致性检测失败的错,导致接口起不来,使用这条命令能解决,但生产环境中慎用## keepalive链路配置[Leaf1] interface g1/0/13
[Leaf1-GigabitEthernet1/0/13]ip address 10.1.1.1 255.255.255.252
[Leaf1] m-lag keepalive ip destination 10.1.1.2 source 10.1.1.1 # 配置DAD检测接口## peer-link接口配置[Leaf1] interface Bridge-Aggregation10
[Leaf1-Bridge-Aggregation10] link-aggregation mode dynamic
[Leaf1]interface GigabitEthernet 1/0/11
[Leaf1-GigabitEthernet1/0/11] port link-aggregation group 10
[Leaf1]interface GigabitEthernet 1/0/12
[Leaf1-GigabitEthernet1/0/12] port link-aggregation group 10
[Leaf1] interface Bridge-Aggregation10
[Leaf1-Bridge-Aggregation10] port m-lag peer-link 1## M-LAG接口配置[Leaf1]int Bridge-Aggregation 5
[Leaf1-Bridge-Aggregation5] port link-type trunk
[Leaf1-Bridge-Aggregation5] port trunk permit vlan all
[Leaf1-Bridge-Aggregation5] link-aggregation mode dynamic
[Leaf1]interface GigabitEthernet 1/0/1
[Leaf1-GigabitEthernet1/0/1] port link-aggregation group 5
[Leaf1]int Bridge-Aggregation 5
[Leaf1-Bridge-Aggregation5] port m-lag group 5
华为的做法中,peer-link需要关闭STP
1.2.2 Leaf2配置
Leaf2和Leaf1的配置只有细微的差异
## M-LAG配置[Leaf2] m-lag system-mac 0001-0001-0001
[Leaf2] m-lag system-number 2
[Leaf2] m-lag system-priority 130
[Leaf2] m-lag mad exclude interface GigabitEthernet1/0/13
[Leaf2] m-lag consistency-check disable ## keepalive链路配置[Leaf2] interface g1/0/13
[Leaf1-GigabitEthernet1/0/13]ip address 10.1.1.2 255.255.255.252
[Leaf2] m-lag keepalive ip destination 10.1.1.1 source 10.1.1.2 ## peer-link接口配置[Leaf2] interface Bridge-Aggregation10
[Leaf1-Bridge-Aggregation10] link-aggregation mode dynamic
[Leaf2]interface GigabitEthernet 1/0/11
[Leaf1-GigabitEthernet1/0/11] port link-aggregation group 10
[Leaf2]interface GigabitEthernet 1/0/12
[Leaf1-GigabitEthernet1/0/12] port link-aggregation group 10
[Leaf2] interface Bridge-Aggregation10
[Leaf1-Bridge-Aggregation10] port m-lag peer-link 1## M-LAG接口配置[Leaf2]int Bridge-Aggregation 5
[Leaf1-Bridge-Aggregation5] port link-type trunk
[Leaf1-Bridge-Aggregation5] port trunk permit vlan all
[Leaf1-Bridge-Aggregation5] link-aggregation mode dynamic
[Leaf2]interface GigabitEthernet 1/0/1
[Leaf1-GigabitEthernet1/0/1] port link-aggregation group 5
[Leaf2]int Bridge-Aggregation 5
[Leaf1-Bridge-Aggregation5] port m-lag group 5
1.2.3 SW配置
下行交换机上只需要配置链路聚合即可
[H3C]interface Bridge-Aggregation 5
[H3C-Bridge-Aggregation5] port link-type trunk
[H3C-Bridge-Aggregation5] port trunk permit vlan all
[H3C-Bridge-Aggregation5] link-aggregation mode dynamic[H3C] interface range GigabitEthernet 1/0/1 to GigabitEthernet 1/0/2
[H3C-if-range] port link-aggregation group 5
1.3 配置验证
这里只验证基本的通信即可,因此在三台交换机上都起了一个VLAN100,并测试连通性,主要查看的内容是m-lag配置是否生效,已经生成树是否达到的预期的效果
1.3.1 M-LAG
[Leaf1]dis m-lag system System information
Local system number: 1 Peer system number: 2
Local system MAC: 0001-0001-0001 Peer system MAC: 0001-0001-0001
Local system priority: 130 Peer system priority: 130
Local bridge MAC: a6ca-1833-0100 Peer bridge MAC: a6ca-3325-0200
Local effective role: Primary Peer effective role: Secondary
Health level: 0
Standalone mode on split: Disabled
In standalone mode: NoSystem timer information
Timer State Value (s) Remaining time (s)
Auto recovery Disabled - -
Restore delay Disabled 300 -
Consistency-check delay Disabled 150 -
Standalone delay Disabled - -
Role to None delay Disabled 60 -
交换机上看到的对端设备为逻辑上的一台设备
[H3C]dis link-aggregation verbose
Loadsharing Type: Shar -- Loadsharing, NonS -- Non-Loadsharing
Port Status: S -- Selected, U -- Unselected, I -- Individual
Port: A -- Auto port, M -- Management port, R -- Reference port
Flags: A -- LACP_Activity, B -- LACP_Timeout, C -- Aggregation, D -- Synchronization, E -- Collecting, F -- Distributing, G -- Defaulted, H -- Expired Aggregate Interface: Bridge-Aggregation5
Creation Mode: Manual
Aggregation Mode: Dynamic
Loadsharing Type: Shar
Management VLANs: None
System ID: 0x8000, a6a7-cb71-0300
Local: Port Status Priority Index Oper-Key FlagGE1/0/1 S 32768 1 1 {ACDEF}GE1/0/2 S 32768 2 1 {ACDEF}
Remote: Actor Priority Index Oper-Key SystemID Flag GE1/0/1(R) 32768 16387 40005 0x82 , 0001-0001-0001 {ACDEF}GE1/0/2 32768 32771 40005 0x82 , 0001-0001-0001 {ACDEF}
1.3.2 生成树
下面是Leaf1和Leaf2上关于VLAN100的生成树信息
[Leaf1-Bridge-Aggregation5]dis stp ins 0 int b5
-------[CIST Global Info][Mode MSTP]-------Bridge ID : 32768.0001-0001-0001Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20Root ID/ERPC : 32768.0001-0001-0001, 0RegRoot ID/IRPC : 32768.0001-0001-0001, 0RootPort ID : 0.0BPDU-Protection : DisabledBPDU Filter : DisabledBridge Config-Digest-Snooping : DisabledTC or TCN received : 15Time since last TC : 0 days 0h:6m:52s----[Port5125(Bridge-Aggregation5)][FORWARDING][M-LAG]----Port protocol : EnabledPort role : Designated Port (Boundary)Port ID : 128.5125Port cost(Legacy) : Config=auto, Active=18Desg.bridge/port : 32768.0001-0001-0001, 128.1029Port edged : Config=disabled, Active=disabledPort filter : Config=default, Active=disabledPoint-to-Point : Config=auto, Active=trueTransmit limit : 10 packets/hello-timeTC-Restriction : DisabledRole-Restriction : DisabledProtection type : Config=none, Active=noneMST BPDU format : Config=auto, Active=802.1sPort Config-Digest-Snooping : DisabledRapid transition : TrueNum of VLANs mapped : 2Port times : Hello 2s MaxAge 20s FwdDelay 15s MsgAge 0s RemHops 20BPDU sent : 208TCN: 0, Config: 0, RST: 0, MST: 208BPDU received : 2TCN: 0, Config: 0, RST: 0, MST: 2
[Leaf2-Bridge-Aggregation5]dis stp ins 0 interface b5
-------[CIST Global Info][Mode MSTP]-------Bridge ID : 32768.0001-0001-0001Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20Root ID/ERPC : 32768.0001-0001-0001, 0RegRoot ID/IRPC : 32768.0001-0001-0001, 0RootPort ID : 0.0BPDU-Protection : DisabledBPDU Filter : DisabledBridge Config-Digest-Snooping : DisabledTC or TCN received : 20Time since last TC : 0 days 0h:9m:39s----[Port5125(Bridge-Aggregation5)][FORWARDING][M-LAG]----Port protocol : EnabledPort role : Designated Port (Boundary)Port ID : 128.5125Port cost(Legacy) : Config=auto, Active=18Desg.bridge/port : 32768.0001-0001-0001, 128.1029Port edged : Config=disabled, Active=disabledPort filter : Config=default, Active=disabledPoint-to-Point : Config=auto, Active=trueTransmit limit : 10 packets/hello-timeTC-Restriction : DisabledRole-Restriction : DisabledProtection type : Config=none, Active=noneMST BPDU format : Config=auto, Active=802.1sPort Config-Digest-Snooping : DisabledRapid transition : TrueNum of VLANs mapped : 2Port times : Hello 2s MaxAge 20s FwdDelay 15s MsgAge 0s RemHops 20BPDU sent : 0TCN: 0, Config: 0, RST: 0, MST: 0BPDU received : 0TCN: 0, Config: 0, RST: 0, MST: 0
可以看到,两边的桥ID都是一模一样的,说明对于VLAN100,两台leaf交换机都充当了根桥的角色,实现了逻辑上的一台设备
华为交换机的M-lag组中,主设备会把ID信息自动同步到备设备中,让下游的交换机看到的对端设备是逻辑上的一台,这才能够让LAG建立起来,对于STP,需要手工将两台设备的ID配置成一直,来保证两台交换机都是根桥。
在H3C的交换机上正好相反,需要在M-lag中手工配置MAC,STP会直接使用这个MAC作为ID的一部分。