VLAN配置

发布时间 2023-09-22 21:58:44作者: geyashi

基于端口划分 VLAN,使用单臂路由实现不同 VLAN 间访问。

拓扑结构

配置交换机 LW1

划分 VLAN

<Huawei>undo terminal monitor 
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname LW
[LW1]vlan batch 10 20 100
Info: This operation may take a few seconds. Please wait for a moment...done.
[LW1]interface e0/0/2
[LW1-Ethernet0/0/2]port link-type access 
[LW1-Ethernet0/0/2]port default vlan 10
[LW1-Ethernet0/0/2]quit
[LW1]interface e0/0/3	
[LW1-Ethernet0/0/3]port link-type access 
[LW1-Ethernet0/0/3]port default vlan 20
[LW1-Ethernet0/0/3]quit
[LW1]interface e0/0/4
[LW1-Ethernet0/0/4]port link-type access
[LW1-Ethernet0/0/4]port default vlan 100
[LW1-Ethernet0/0/4]quit
[LW1]interface e0/0/1
[LW1-Ethernet0/0/1]port link-type trunk 
[LW1-Ethernet0/0/1]port trunk allow-pass vlan all
[LW1-Ethernet0/0/1]quit

路由器配置 AR1

<Huawei>undo terminal monitor 
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname AR1
[AR1]interface g0/0/0.1
[AR1-GigabitEthernet0/0/0.1]dot1q termination vid 10
[AR1-GigabitEthernet0/0/0.1]arp broadcast enable 
[AR1-GigabitEthernet0/0/0.1]ip address 192.168.0.1 255.255.255.0
[AR1-GigabitEthernet0/0/0.1]quit
[AR1]int g0/0/0.2	
[AR1-GigabitEthernet0/0/0.2]dot1q termination vid 20
[AR1-GigabitEthernet0/0/0.2]arp broadcast enable 
Info: This interface has already been configured with ARP broadcast.
[AR1-GigabitEthernet0/0/0.2]ip address 10.10.0.1 24
[AR1-GigabitEthernet0/0/0.2]quit
[AR1]int g0/0/0.3
[AR1-GigabitEthernet0/0/0.3]dot1q termination vid 100
[AR1-GigabitEthernet0/0/0.3]arp broadcast enable 
[AR1-GigabitEthernet0/0/0.3]ip address 172.16.0.1 24
[AR1-GigabitEthernet0/0/0.3]quit