OBJECTIVE
The purpose of this post is to present an introduction to Example for Implementing Inter-VLAN Communication Using VLANIF Interfaces.
Networking Requirements
Users in an enterprise use different services and locate at different network segments. Users who use the same service belong to different VLANs and they want to communicate with each other.
As shown in Figure 1, User 1 and User 2 use the same service but belong to different VLANs and locate at different network segments. User 1 wants to communicate with User 2.

Figure 1 - Networking diagram for implementing inter-VLAN communication using VLANIF interfaces
Configuration Roadmap
The configuration roadmap is as follows:
1. Create VLANs on the switches for different users.
2. Add interfaces to VLANs so that packets of the VLANs can pass through the interfaces.
3. Create VLANIF interfaces and configure IP addresses for the VLANIF interfaces to implement Layer 3 communication.
To implement communication between VLANs, hosts in each VLAN must use the IP address of the corresponding VLANIF interface as the gateway address.
Procedure
1. Create VLANs.
# Create VLANs.
<Huawei> system-view
[Huawei] vlan batch 10 20
# Add interfaces to VLANs.
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] port link-type access
[HUAWEI-GigabitEthernet0/0/1] port default vlan 10
[HUAWEI-GigabitEthernet0/0/1] quit
[HUAWEI] interface gigabitethernet 0/0/2
[HUAWEI-GigabitEthernet0/0/2] port link-type access
[HUAWEI-GigabitEthernet0/0/2] port default vlan 20
[HUAWEI-GigabitEthernet0/0/2] quit
# Assign IP addresses to the VLANIF interfaces.
[HUAWEI] interface vlanif 10
[HUAWEI-Vlanif10] ip address 10.10.10.2 24
[HUAWEI-Vlanif10] quit
[HUAWEI] interface vlanif 20
[HUAWEI-Vlanif20] ip address 20.20.20.2 24
[HUAWEI-Vlanif20] quit
2. Verify the configuration.
Configure the IP address 10.10.10.3/24 on user 1's host, configure the VLANIF 10 interface IP address 10.10.10.2/24 as the gateway address.
Configure the IP address 20.20.20.3/24 on user 1's host, configure the VLANIF 10 interface IP address 20.20.20.2/24 as the gateway address.
After the preceding configurations are complete, User 1 in VLAN 10 and User 2 in VLAN 20 can communicate.
Configuration Files
Configuration file of the Switch
#
sysname HUAWEI
#
vlan batch 10 20
#
interface Vlanif10
ip address 10.10.10.2 255.255.255.0
#
interface Vlanif20
ip address 20.20.20.2 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
#
return
--- End


