以太网与VLAN

以太网与VLAN

手动模式配置链路聚合

实验拓扑

  • 掌握接口速率配置
  • 掌握手动模式配置链路聚合
  • 掌握使用静态LACP模式的配置链路聚合
  • 掌握静态LACP的模式下的接口优先级

 

配置S1和S2

修改接口速率之前应该关闭自动协商功能,然后将S1上的G0/0/1和G0/0/2的接口速率配置成100Mbit/s

<Huawei>system-view 
[S1]interface Eth0/0/1 	
[S1-Ethernet0/0/1]undo negotiation auto 	
[S1-Ethernet0/0/1]speed 100
[S1]interface Eth0/0/2 	
[S1-Ethernet0/0/2]undo negotiation auto 	
[S1-Ethernet0/0/2]speed 100

 

手动配置聚合

手动模式配置链路聚合,S1和S2配置相同的命令

[S1]interface Eth-Trunk 1
[S1-Eth-Trunk1]quit 
[S1]interface Eth0/0/1 	
[S1-Ethernet0/0/1]eth-trunk 1
[S1]interface Eth0/0/2	
[S1-Ethernet0/0/2]eth-trunk 1 

 

检查结果

[S2]display eth-trunk 
Eth-Trunk1's state information is:
WorkingMode: NORMAL         Hash arithmetic: According to SIP-XOR-DIP         
Least Active-linknumber: 1  Max Bandwidth-affected-linknumber: 8              
Operate status: up          Number Of Up Port In Trunk: 2                     
--------------------------------------------------------------------------------
PortName                      Status      Weight 
Ethernet0/0/1                 Up          1      
Ethernet0/0/2                 Up          1   

 

配置静态的LACP模式的链路聚合

S1配置

[S1]interface Eth-Trunk 1
[S1-Eth-Trunk1]mode lacp
[S1-Eth-Trunk1]quit 
[S1]interface Ethernet0/0/1 
[S1-Ethernet0/0/1 ]eth-trunk 1
[S1-Ethernet0/0/1 ]lacp priority 100     "设置接口的优先级为100 使其成为LACP主动端"
[S1]interface Ethernet0/0/2
[S1-Ethernet0/0/2]eth-trunk 1
[S1-Ethernet0/0/2]lacp priority 100

S2配置

[S2]interface Eth-Trunk 1
[S2-Eth-Trunk1]mode lacp
[S2-Eth-Trunk1]quit 
[S2]interface Ethernet0/0/1 
[S2-Ethernet0/0/1 ]eth-trunk 1
[S2]interface Ethernet0/0/2
[S2-Ethernet0/0/2]eth-trunk 1

检查是否成功

[S2]display eth-trunk 
Eth-Trunk1's state information is:
Local:
LAG ID: 1                   WorkingMode: STATIC                               
Preempt Delay: Disabled     Hash arithmetic: According to SIP-XOR-DIP         
System Priority: 32768      System ID: 4c1f-cc70-4866                         
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
Ethernet0/0/1          Selected 100M     32768   2      289     10111100  1     
Ethernet0/0/2          Selected 100M     32768   3      289     10111100  1     

Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
Ethernet0/0/1          32768    4c1f-cc4d-5045  32768   2      289     10111100
Ethernet0/0/2          32768    4c1f-cc4d-5045  32768   3      289     10111100

 

VLAN配置

实验拓扑

  • 掌握VLAN的创建和管理
  • 掌握Access和Trunk链路
  • 掌握Hybird接口的配置方法

 

创建VLAN 1 2

分别在S1和S2上面创建vlan配置IP地址

S1配置

<S1>system-view 
[S1]vlan batch 1 2
[S1]interface Vlanif 1 	
[S1-Vlanif1]ip address 1.1.1.1 24 
[S1]interface Vlanif 2 
[S1-Vlanif2]ip address 2.2.2.1  24

S2配置

<Huawei>system-view 
[S2]vlan batch  1 2 
[S2]interface Vlanif  1 	
[S2-Vlanif1]ip address 1.1.1.2 24 	
[S2]interface  Vlanif 2 
[S2-Vlanif2]ip address 2.2.2.2 24 

S1和S2配置Trunk

[S1]interface Eth0/0/3
[S1-Ethernet0/0/3]port link-type trunk 
[S1-Ethernet0/0/3]port trunk allow-pass vlan  1 2

[S2]interface Eth0/0/3
[S2-Ethernet0/0/3]port link-type trunk 
[S2-Ethernet0/0/3]port trunk allow-pass vlan  1 2

S1和S2配置路由器Access

[S1]interface Eth0/0/1 	
[S1-Ethernet0/0/1]port link-type access 
[S1-Ethernet0/0/1]port default vlan 1 
[S1]interface Eth0/0/2 
[S1-Ethernet0/0/2]port link-type access 
[S1-Ethernet0/0/2]port default vlan 2 

[S2]interface Eth0/0/1 	
[S2-Ethernet0/0/1]port link-type access 
[S2-Ethernet0/0/1]port default vlan 1 
[S2]interface Eth0/0/2 
[S2-Ethernet0/0/2]port link-type access 
[S2-Ethernet0/0/2]port default vlan 2 

配置IP地址

[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 1.1.1.3 24 

[R2]interface  GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 2.2.2.3

[R3]interface GigabitEthernet 0/0/0 
[R3-GigabitEthernet0/0/0]ip address  1.1.1.5 24 

[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip address 2.2.2.5 24 

测试连通性

使用R1测试R4的连通性发现成功了,但是测试R2发现不成功

[R1]ping -c 1 1.1.1.5
  PING 1.1.1.5: 56  data bytes, press CTRL_C to break
    Reply from 1.1.1.5: bytes=56 Sequence=1 ttl=255 time=150 ms

  --- 1.1.1.5 ping statistics ---
    1 packet(s) transmitted
    1 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 150/150/150 ms

[R1]ping -c 1 2.2.2.1
  PING 2.2.2.1: 56  data bytes, press CTRL_C to break
    Request time out

  --- 2.2.2.1 ping statistics ---
    1 packet(s) transmitted
    0 packet(s) received
    100.00% packet loss

 

配置Hybrid端口

"在所属的哪个Vlan就配置Hyvrid链路"

[S1-Ethernet0/0/2]port link-type hybrid 
[S1-Ethernet0/0/2]port hybrid untagged vlan 1 2 
[S1-Ethernet0/0/2]port hybrid pvid vlan  2

 

单臂路由 (重点)

实验拓扑

 

  • 掌握VLAN间的路由的Trunk接口的配置
  • 掌握单个物理接口上配置多个子接口
  • VLAN间实现ARP通信的配置方法

配置S3交换机

[S1]vlan batch 10 20
[S1]interface E	
[S1]interface Eth0/0/2	
[S1-Ethernet0/0/2]port link-type access 	
[S1-Ethernet0/0/2]port default vlan 10
[S1]interface Eth0/0/3
[S1-Ethernet0/0/3]port link-type access 
[S1-Ethernet0/0/3]port default vlan 20
[S1]interface Eth0/0/1
[S1-Ethernet0/0/1]port link-type trunk 
[S1-Ethernet0/0/1]port trunk allow-pass vlan all 

配置R1路由器

[R1]interface Eth0/0/0.1
[R1-Ethernet0/0/0.1]ip address 1.1.1.254 24 
[R1-Ethernet0/0/0.1]dot1q termination vid 10 
[R1-Ethernet0/0/0.1]arp broadcast enable 
[R1]interface Eth0/0/0.2 
[R1-Ethernet0/0/0.2]ip address 1.1.2.254 24 
[R1-Ethernet0/0/0.2]dot1q termination vid 20 
[R1-Ethernet0/0/0.2]arp broadcast enable 

配置PC1

配置PC2

测试连通性

posted @ 2021-08-03 20:17  isicman  阅读(597)  评论(0)    收藏  举报