Example for Implementing Inter-VLAN Communication Using VLAN Switch
Networking Requirements
On the network shown in Figure 6-2, GE1/0/1 and GE1/0/2 of the Switch are connected to the uplink interfaces of SwitchA and SwitchB, respectively.
The downlink interfaces of SwitchA and SwitchB are added to VLAN 10 and VLAN 20 respectively.
PCs in VLAN 10 and VLAN 20 need to communicate with each other.
Configuration Roadmap
The configuration roadmap is as follows:
Add the uplink and downlink interfaces of Switch A and Switch B to the VLANs.
Configure the VLAN Switch function on the Switch.
Procedure
- Create VLAN 10 on SwitchA, add GE1/0/1 to VLAN 10 in tagged mode,
and add GE1/0/2 and GE1/0/3 to VLAN 10 in access mode.
Configuration of SwitchB is the same as that of SwitchA.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan 10 [SwitchA-vlan10] quit [SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port link-type hybrid [SwitchA-GigabitEthernet1/0/1] port hybrid tagged vlan 10 [SwitchA-GigabitEthernet1/0/1] quit [SwitchA] interface gigabitethernet 1/0/2 [SwitchA-GigabitEthernet1/0/2] port link-type access [SwitchA-GigabitEthernet1/0/2] port default vlan 10 [SwitchA-GigabitEthernet1/0/2] quit [SwitchA] interface gigabitethernet 1/0/3 [SwitchA-GigabitEthernet1/0/3] port link-type access [SwitchA-GigabitEthernet1/0/3] port default vlan 10 [SwitchA-GigabitEthernet1/0/3] quit
- Configure the Switch.
# Configure the VLAN Switch function.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] port link-type hybrid [Switch-GigabitEthernet1/0/1] quit [Switch] interface gigabitethernet 1/0/2 [Switch-GigabitEthernet1/0/2] port link-type hybrid [Switch-GigabitEthernet1/0/2] quit [Switch] vlan-switch name1 interface gigabitethernet 1/0/1 vlan 10 interface gigabitethernet 1/0/2 switch-vlan 20
- Verify the configuration.
When the configuration is complete, PCs in VLAN 10 and VLAN 20 can communicate with each other.
Configuration Files
SwitchA configuration file
# sysname SwitchA # vlan batch 10 # interface GigabitEthernet1/0/1 port link-type hybrid port hybrid tagged vlan 10 # interface GigabitEthernet1/0/2 port link-type access port default vlan 10 # interface GigabitEthernet1/0/3 port link-type access port default vlan 10 # return
SwitchB configuration file
# sysname SwitchB # vlan batch 20 # interface GigabitEthernet1/0/1 port link-type hybrid port hybrid tagged vlan 20 # interface GigabitEthernet1/0/2 port link-type access port default vlan 20 # interface GigabitEthernet1/0/3 port link-type access port default vlan 20 # return
Switch configuration file
# sysname Switch # vlan-switch name1 interface GigabitEthernet1/0/1 vlan 10 interface GigabitEthernet1/0/2 switch-vlan 20 # interface GigabitEthernet1/0/1 port link-type hybrid # interface GigabitEthernet1/0/2 port link-type hybrid # return