实验说明:

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]