實驗說明:
PE兩臺交換機要三層可達,兩臺交換機使用E-trunk連接,都劃分到VLAN1裏面
設備CE:Eth-reunk 10
設備PE1:Eth-trunk 20
設備PE3:Eth-trunk 30
配置PE1和PE2三層IP可達
PE1配置接口和VLANIF
<Huawei>system-view //進入全局配置模式
[Huawei]undo info-center enable //關閉信息告警提示
[Huawei]sysname PE1 //改名
[PE1]interface g0/0/1 //進入接口
[PE1-GigabitEthernet0/0/1]port link-type access //配置爲access鏈路,VLAN1默認爲本徵VLAN
[PE1-GigabitEthernet0/0/1]quit //退出
[PE1]interface vlanif1 //配置VLANIF1
[PE1-Vlanif1]ip address 10.1.1.1 255.255.255.0 //設置IP地址
[PE1-Vlanif1]quit //退出
[PE1]
PE2配置接口和VLANIF
<Huawei>system-view //進入全局配置模式
[Huawei]undo info-center enable //關閉信息告警提示
[Huawei]sysname PE2 //改名
[PE2]interface g0/0/1 //進入接口
[PE2-GigabitEthernet0/0/1]port link-type access //配置爲access鏈路,VLAN1默認爲本徵VLAN
[PE2-GigabitEthernet0/0/1]quit //退出
[PE2]interface vlanif1
[PE2-Vlanif1]ip address 10.1.1.2 255.255.255.0 //設置IP地址
[PE2-Vlanif1]quit //退出
[PE2]
PE1測試是否可以ping通PE 2設備
[PE1]ping 10.1.1.2 //測試ping PE2設備
PING 10.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.2: bytes=56 Sequence=1 ttl=255 time=80 ms
Reply from 10.1.1.2: bytes=56 Sequence=2 ttl=255 time=90 ms
Reply from 10.1.1.2: bytes=56 Sequence=3 ttl=255 time=80 ms
Reply from 10.1.1.2: bytes=56 Sequence=4 ttl=255 time=60 ms
Reply from 10.1.1.2: bytes=56 Sequence=5 ttl=255 time=30 ms //ping 通
--- 10.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/68/90 ms
[PE1]
DE配置Eth-trunk
<Huawei>system-view //進入全局配置模式
[Huawei]undo info-center enable //關閉信息告警提示
[Huawei]sysname CE //改名
[CE]interface Eth-Trunk 10 //配置Eth-trunk10
[CE-Eth-Trunk10]mode lacp-static //必須配置靜態
[CE-Eth-Trunk10]trunkport GigabitEthernet 0/0/2 to 0/0/5 //將上面兩個設備當成一個設備,配置4條鏈路的捆綁
[CE-Eth-Trunk10]quit //退出
[CE]
PE1和PE2同時配置:虛擬一個ID和優先級,讓下面設備(CE)認爲是一個設備
PE1配置MAC地址和優先級
[PE1]lacp e-trunk system-id 0000-0102-0304 //配置MAC地址
[PE1]lacp e-trunk priority 32768 //配置優先級
PE2配置MAC地址和優先級
[PE2]lacp e-trunk system-id 0000-0102-0304 //配置MAC地址
[PE2]lacp e-trunk priority 32768 //配置優先級
注:兩臺設備的MAC地址和優先級要一致
配置兩臺設備的主備
PE1配置E-trunk爲主設備
[PE1]e-trunk 1 //配置E-trunk 1
[PE1-e-trunk-1]priority 99 //越小越優先,默認100,用來在PE1和PE2之間競爭主備,備設備要down接口
[PE1-e-trunk-1]peer-address 10.1.1.2 source-address 10.1.1.1 //指定對端IP地址和自己的IP地址
[PE1-e-trunk-1]quit //退出
[PE1]
PE2配置E-trunk爲備設備
[PE2]e-trunk 1 //配置E-trunk 1
[PE2-e-trunk-1]peer-address 10.1.1.1 source-address 10.1.1.2 //指定對端IP地址和自己的IP地址
[PE2-e-trunk-1]quit //退出
[PE2]
配置兩臺設備的E-trunk連接
PE1配置連接對端PE2設備
[PE1]interface Eth-Trunk 20 //本端20,對端30,也可以都一樣
[PE1-Eth-Trunk20]mode lacp-static //必須配置靜態
[PE1-Eth-Trunk20]trunkport g0/0/2 //捆綁G0/0/2鏈路
[PE1-Eth-Trunk20]trunkport g0/0/3 //捆綁G0/0/3鏈路
[PE1-Eth-Trunk20]e-trunk 1 remote-eth-trunk 30 //關聯E-trunk 1,remote-eth-trunk 30是對端Eth-trunk30
[PE1-Eth-Trunk20]quit //退出
[PE1]
PE2配置連接對端PE1設備
[PE2]interface Eth-Trunk 30 //本端30,對端20,也可以都一樣
[PE2-Eth-Trunk30]mode lacp-static //必須配置靜態
[PE2-Eth-Trunk30]trunkport g0/0/4 //捆綁G0/0/4鏈路
[PE2-Eth-Trunk30]trunkport g0/0/5 //捆綁G0/0/5鏈路
[PE2-Eth-Trunk30]e-trunk 1 remote-eth-trunk 20 //關聯E-trunk 1,remote-eth-trunk 30是對端Eth-trunk20
[PE2-Eth-Trunk30]quit //退出
[PE2]
注:如果對端的Eth-trunk一樣的話,不用配置trmote-eth-trunk X
調試命令
CE查看Eth-trunk信息
[CE]dis eth-trunk 10 //查看Eth-trunk 10
Eth-Trunk10's state information is:
Local:
LAG ID: 10 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 32768 System ID: 4c1f-cc3f-504d
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/2 Selected 1GE 32768 3 2609 10111100 1 //數據正常通信
GigabitEthernet0/0/3 Selected 1GE 32768 4 2609 10111100 1 //數據正常通信
GigabitEthernet0/0/4 Unselect 1GE 32768 5 2609 10100000 1 //數據不能通過
GigabitEthernet0/0/5 Unselect 1GE 32768 6 2609 10100000 1 //數據不能通過
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
GigabitEthernet0/0/2 32768 0000-0102-0304 32768 3 5169 10111100 //對端設備的優先級和MAC地址都是一樣的
GigabitEthernet0/0/3 32768 0000-0102-0304 32768 4 5169 10111100
GigabitEthernet0/0/4 32768 0000-0102-0304 32768 32773 33073 10100000
GigabitEthernet0/0/5 32768 0000-0102-0304 32768 32774 33073 10100000
[CE]
PE1查看E-trunk
[PE1]dis e-trunk 1 //查看E-trunk
The E-Trunk information
E-TRUNK-ID : 1 Revert-Delay-Time (s) : 120
Priority : 99 System-ID : 4c1f-cc58-622b
Peer-IP : 10.1.1.2 Source-IP : 10.1.1.1
State : Master Causation : PRI
Send-Period (100ms) : 10 Fail-Time (100ms) : 200
Receive : 2293 Send : 2336
RecDrop : 0 SndDrop : 1
Peer-Priority : 100 Peer-System-ID : 4c1f-ccf8-354f
Peer-Fail-Time (100ms) : 200 BFD-Session : -
Description : -
--------------------------------------------------------------------------------
The Member information
Type ID LocalPhyState Work-Mode State Causation Remote-ID
Eth-Trunk 20 Up auto Master ETRUNK_MASTER 20 //主設備
[PE1]
PE2查看E-trunk
[PE2]dis e-trunk 1
The E-Trunk information
E-TRUNK-ID : 1 Revert-Delay-Time (s) : 120
Priority : 100 System-ID : 4c1f-ccf8-354f
Peer-IP : 10.1.1.1 Source-IP : 10.1.1.2
State : Backup Causation : PRI
Send-Period (100ms) : 10 Fail-Time (100ms) : 200
Receive : 3639 Send : 3631
RecDrop : 8 SndDrop : 0
Peer-Priority : 99 Peer-System-ID : 4c1f-cc58-622b
Peer-Fail-Time (100ms) : 200 BFD-Session : -
Description : -
--------------------------------------------------------------------------------
The Member information
Type ID LocalPhyState Work-Mode State Causation Remote-ID
Eth-Trunk 30 Down auto Backup ETRUNK_BACKUP 20 //備設備
[PE2]
模擬主設備故障(關機)
CE查看Eth-trunk
[CE]dis eth-trunk 10 //查看Eth-trunk10
Eth-Trunk10's state information is:
Local:
LAG ID: 10 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 32768 System ID: 4c1f-cc3f-504d
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/2 Unselect 1GE 32768 3 2609 10100010 1 //之前可以通信,由於PE1設備關機,現在不能通信
GigabitEthernet0/0/3 Unselect 1GE 32768 4 2609 10100010 1 //之前可以通信,由於PE1設備關機,現在不能通信
GigabitEthernet0/0/4 Selected 1GE 32768 5 2609 10111100 1 //數據切換過來,可以通信了
GigabitEthernet0/0/5 Selected 1GE 32768 6 2609 10111100 1 //數據切換過來,可以通信了
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
GigabitEthernet0/0/2 0 0000-0000-0000 0 0 0 10100011
GigabitEthernet0/0/3 0 0000-0000-0000 0 0 0 10100011
GigabitEthernet0/0/4 32768 0000-0102-0304 32768 32773 33073 10111100
GigabitEthernet0/0/5 32768 0000-0102-0304 32768 32774 33073 10111100
[CE]
PE2查看E-trunk
[PE2]dis e-trunk 1 //查看E-trunk 1
The E-Trunk information
E-TRUNK-ID : 1 Revert-Delay-Time (s) : 120
Priority : 100 System-ID : 4c1f-ccf8-354f
Peer-IP : 10.1.1.1 Source-IP : 10.1.1.2
State : Master Causation : TIMEOUT
Send-Period (100ms) : 10 Fail-Time (100ms) : 200
Receive : 3703 Send : 3732
RecDrop : 8 SndDrop : 19
Peer-Priority : - Peer-System-ID : -
Peer-Fail-Time (100ms) : - BFD-Session : -
Description : -
--------------------------------------------------------------------------------
The Member information
Type ID LocalPhyState Work-Mode State Causation Remote-ID
Eth-Trunk 30 Up auto Master ETRUNK_MASTER 20 //切換爲主設備
[PE2]