E-trunk实验配置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了E-trunk实验配置相关的知识,希望对你有一定的参考价值。

实验说明:

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]

以上是关于E-trunk实验配置的主要内容,如果未能解决你的问题,请参考以下文章

E-trunk和Eth-trunk 区别

网络基础补充之链路聚合与实验

201555332盛照宗—网络对抗实验1—逆向与bof基础

20155201 李卓雯 《网络对抗技术》实验一 逆向及Bof基础

ensp直连二层组网遇到的问题

VSCode自定义代码片段11——vue路由的配置