This section describes how to configure Layer-3 subinterfaces to enable VLANs to communicate.
The most direct method for inter-VLAN communication is connecting VLANs to different Layer-3 interfaces to route the packets between VLANs. However, this method requires physical interfaces. In contrast, creating Ethernet subinterfaces can avoid the use of more physical interfaces.
Ethernet and Eth-Trunk interfaces support subinterfaces.
You can configure multiple subinterfaces on a single physical interface and ensure that each subinterface is assigned to a specific VLAN. VLANs can communicate after being connected to only as single physical interface.
Inter-VLAN communication through Layer-3 subinterfaces applies only when the hosts in each VLAN are located in different network segments. If the hosts of VLANs are located in the same network segment, inter-VLAN communication can be implemented through Layer-2 interfaces. For details, see Configuring Inter-VLAN Communication Using Layer-2 Subinterfaces.
interface interface-type interface-number.subinterface-number
vlan-type dot1q vlan-id
ip address ip-address { mask | mask-length } [ sub ]
The subinterface and its main interface can be on the same primary network segment but must use different subnet masks.