Huawei VLAN configuration and communication example between VLANs
Networking requirements: The aggregation layer switch is used as the gateway of the PC.
PC3 directly connected to SW2 belongs to vlan 2, and the gateway is vlanif 2 interface address 192.168.2.1/24;
PC4 directly connected to SW2 belongs to vlan 3, and the gateway is vlanif 3 interface address 192.168.3.1/24;
PC5 directly connected to SW3 belongs to vlan 4, and the gateway is vlanif 4 interface address 192.168.4.1/24;
To achieve mutual access communication between PCs through configuration:
SW3 can be configured without configuration
create vlan
<SW1> system-view //Enter system mode
[SW1] vlan batch 2 to 5 //Create vlan 2 to 5 in batches
Huawei Layer 3 switch configuration is based on interface division vlan, adding interfaces to corresponding vlans, and configuring port attributes.
# SW1----SW2---PC, configure the interface between switches to trunk mode to realize intercommunication
[SW1] interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2] port link-type trunk //The link type is trunk mode
[SW1-GigabitEthernet0/0/2] port trunk allow-pass vlan 2 to 3 /set the VLAN that the link is allowed to pass through, vlan2 vlan, can set vlan 2 to 4096 that is all/
[SW1-GigabitEthernet0/0/2] quit#
SW1---SW3---PC, configure the interface to access mode, and add int 3 to vlan4
[SW1] interface GigabitEthernet0/0/3
[SW1-GigabitEthernet0/0/3] port link-type access //The link type is access
[SW1-GigabitEthernet0/0/3] port default vlan 4
[SW1-GigabitEthernet0/0/3] quit
Configure the vlan IP address of the vlanif based on the interface as the gateway of the PC
[SW1] interface Vlanif 2 //Enter the Layer 3 vlanif2 interface
[SW1-Vlanif2] ip address 192.168.2.1 255.255.255.0 //Configure the ip address
[SW1-Vlanif2] quit //Exit the vlanif2 interface
[SW1] interface Vlanif 3
[SW1 -Vlanif3] ip address 192.168.3.1 255.255.255.0
[SW1-Vlanif3] quit
[SW1] interface Vlanif 4
[SW1-Vlanif4] ip address 192.168.4.1 255.255.255.0
[SW1-Vlanif4] quit
[SW1] interface Vlanif 5
[SW1-Vlanif5] ip address 192.168.5.1 24 //Save the configuration after the interconnection IP address of the R router is configured
<SW1> save
Create vlan<Huawei> system-view //Enter the system mode
[Huawei] sysname SW2 //Modify the system name from
[SW2] vlan batch 2 3 //Create a new vlan 2 3 interface, and batch create VLAN
transparent transmission vlan# SW2--- -SW1, the interface is configured in trunk mode
[SW2] interface GigabitEthernet0/0/1
[SW2-GigabitEthernet0/0/1] port link-type trunk //Configure the link type to trunk
[SW2-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 3//Allow VLAN2 and VLAN3 to pass
[SW2-GigabitEthernet0/0/1] quit
Huawei Layer 3 switch configuration is based on the interface division of vlan SW2---PC, the interface needs to be configured in access mode
[SW2] interface GigabitEthernet0/0/23 //Connect to PC1
[SW2-GigabitEthernet0/0/23] port link-type access //链路类型为 access
[SW2-GigabitEthernet0/0/23] port default vlan 2
[SW2-GigabitEthernet0/0/23] quit
[SW2] interface GigabitEthernet0/0/24 //对接 PC2
[SW2-GigabitEthernet0/0/24] port link-type access
[SW2-GigabitEthernet0/0/24] port default vlan 3
[SW2-GigabitEthernet0/0/24] quit
<SW2> save
Huawei Layer 3 switch configuration is based on interface division vlan. At this time, PC3 and PC4 can communicate with each other, but cannot communicate with PC5. Verify