CCNA 200-301

CCNP Enterprise

CCNP Security

CCIE Enterprise Lab

CCIE Security Lab

CCNP Service Provider

CCNP Data Center

CCNP Collaboration

CCIE DC Lab

Virtual Local Area Networks (VLANs) partition a physical Layer 2 switch into multiple isolated broadcast domains, keeping workstations, servers, VoIP phones, IoT devices, and guest Wi-Fi separated on distinct IP subnets. By design, Layer 2 switches forward Ethernet frames strictly within the same VLAN and cannot pass traffic directly from one VLAN to another. Communications between VLANs are therefore facilitated exclusively at Layer 3 (the Network Layer) through a process called inter-VLAN routing, performed by either an external router or a multilayer (Layer 3) switch.

Enabling cross-VLAN connectivity reliably requires choosing the right Layer 3 forwarding architecture, configuring logical gateways and trunk links accurately, enforcing security policies so segmentation isn’t undone, and selecting hardware capable of handling your East-West traffic load.

How Inter-VLAN Routing Works: Core Layer 3 Mechanisms

Because every VLAN typically maps to a unique IPv4 or IPv6 subnet, moving traffic from one VLAN to another follows standard IP routing rules combined with Layer 2 VLAN tagging. Understanding both the packet lifecycle and the three mechanisms used to implement it clarifies how isolated broadcast domains exchange data.

  1. The Cross-VLAN Packet Walk (Default Gateway Resolution)
    When Host A in VLAN 10 (192.168.10.10/24) sends traffic to Host B in VLAN 20 (192.168.20.20/24), Host A compares the destination IP against its own subnet mask and recognizes that Host B sits on a remote network. Rather than broadcasting an ARP request for Host B directly, Host A sends an Ethernet frame addressed to the MAC address of its configured default gateway—an IP interface belonging to a Layer 3 device inside VLAN 10. Upon receiving the frame, the Layer 3 device strips the incoming Layer 2 Ethernet header (and any VLAN tag), inspects the destination IP against its routing table, decrements the IP Time-to-Live (TTL), encapsulates the packet in a new Ethernet header targeting Host B’s MAC address in VLAN 20, and forwards it into the destination broadcast domain.

  2. Mechanism 1: Legacy Inter-VLAN Routing (Dedicated Physical Interfaces)
    In early VLAN deployments, administrators connected a separate physical Ethernet cable between the Layer 2 switch and an external router for every single VLAN. Each switch port was configured as an untagged access port in its respective VLAN, and each corresponding router port held that subnet’s default gateway IP. While conceptually simple, this approach rapidly exhausts physical router interfaces and switch ports.

  3. Mechanism 2: Router-on-a-Stick (802.1Q Trunking with Subinterfaces)
    To eliminate multi-cable sprawl, Router-on-a-Stick (ROAS) consolidates cross-VLAN traffic onto a single physical Ethernet link configured as an IEEE 802.1Q trunk between a Layer 2 switch and an external router. On the router, that single physical interface is divided into multiple logical subinterfaces (such as GigabitEthernet0/0.10 and GigabitEthernet0/0.20), each bound to a specific 802.1Q VLAN tag and assigned that VLAN’s gateway IP. Frames leave the switch tagged with their source VLAN ID, travel “up the stick” to the router, get routed to the target subinterface, receive the destination VLAN’s 802.1Q tag, and travel back down the same physical cable to the switch.

  4. Mechanism 3: Layer 3 Switch with Switched Virtual Interfaces (SVIs)
    Modern networks largely replace external hairpin routing with a Layer 3 (multilayer) switch, which integrates Layer 2 switching and hardware-accelerated Layer 3 IP routing inside one device. Administrators configure logical internal Layer 3 interfaces called Switched Virtual Interfaces (SVIs)—such as interface Vlan10 and interface Vlan20—directly on the switch backplane to serve as each VLAN’s default gateway. (Layer 3 switches also support physical routed ports for point-to-point uplinks to edge routers.) Instead of relying on a general-purpose CPU for every packet, the switch uses dedicated ASICs (Application-Specific Integrated Circuits): once the first flow is resolved against the routing and ARP tables, hardware forwarding tables switch subsequent cross-VLAN packets internally at wire speed (“route once, switch thereafter”).

Key Takeaway: Inter-VLAN communication always requires a Layer 3 default gateway in each subnet, whether that gateway lives on a physical router port, an 802.1Q router subinterface, or an internal switch SVI.

Comparing Inter-VLAN Architectures: Legacy vs. Router-on-a-Stick vs. Layer 3 Switch

While all three mechanisms discussed above achieve Layer 3 reachability across VLANs, their performance, port consumption, and failure characteristics differ sharply under real-world traffic loads. Evaluating these architectural trade-offs determines whether an external router is sufficient or dedicated multilayer switching is required.

Evaluation CriteriaLegacy Physical Router InterfacesRouter-on-a-Stick (802.1Q Subinterfaces)Layer 3 Switch (SVIs)
Forwarding EngineSoftware / router NPUSoftware / router NPUDedicated hardware ASICs
Throughput & BandwidthCapped by router CPU and per-port link speedBottlenecked by a single shared trunk link (traffic hairpins up and down the same cable)Non-blocking wire speed across backplane (tens of Gbps to multi-Tbps)
Forwarding LatencySub-millisecond to low millisecondHigher under load due to trunk queuing and double serializationMicrosecond / sub-microsecond hardware switching
Port UtilizationVery poor (1 switch port + 1 router port per VLAN)Efficient (1 switch trunk port + 1 router port total, or 2+ in LACP)Optimal (0 external ports used for internal routing; virtual backplane)
VLAN Scalability2–4 VLANs (limited by physical router slots)~10–50 VLANs before trunk congestion degrades East-West flowsHundreds to 1,000+ VLANs depending on switch model
Redundancy OptionsCostly multi-interface cablingDual-router HSRP/VRRP with redundant trunksSwitch stacking plus active/standby HSRP or VRRP across distribution cores
Upfront Hardware CostHigh per-port router expansion costLow (reuses existing Layer 2 switch and edge router/firewall)Moderate to high compared to Layer 2-only switches
Best Deployment FitObsolete (basic educational labs only)Small branch offices or home networks with light East-West trafficSMB cores, enterprise campuses, Wi-Fi 7 deployments, and server/NAS networks

Even in Layer 3 switch designs, routers and firewalls do not disappear: enterprise networks routinely pair Layer 3 switches at the core/distribution layer for fast internal East-West VLAN traffic with an edge router or firewall dedicated to NAT, VPNs, and WAN connectivity.

Key Takeaway: Choose Router-on-a-Stick only for small sites where inter-VLAN traffic rarely saturates a single uplink, and deploy a Layer 3 switch with SVIs anywhere storage, voice/video, or multi-gigabit wireless generates heavy East-West bandwidth.

Step-by-Step CLI Configuration Templates for Inter-VLAN Routing

Once you have selected either a Layer 3 switch SVI design or a Router-on-a-Stick topology, you can adapt the following Cisco IOS / IOS-XE configuration templates. Both templates provision VLAN 10 (192.168.10.0/24, Engineering) and VLAN 20 (192.168.20.0/24, Sales) using .1 as each subnet’s default gateway.

Template 1: Layer 3 Switch with SVIs

configure terminal

! 1. Create Layer 2 VLANs in the switch VLAN database
vlan 10
 name ENGINEERING
 exit
vlan 20
 name SALES
 exit

! 2. Assign access ports to their respective VLANs
interface GigabitEthernet1/0/1
 description ENG-HOST-PORT
 switchport mode access
 switchport access vlan 10
 spanning-tree portfast
 no shutdown
 exit

interface GigabitEthernet1/0/2
 description SALES-HOST-PORT
 switchport mode access
 switchport access vlan 20
 spanning-tree portfast
 no shutdown
 exit

! 3. Enable global IPv4 routing on the multilayer switch
ip routing

! 4. Configure Switched Virtual Interfaces (SVIs) as default gateways
interface Vlan10
 description ENGINEERING-GATEWAY
 ip address 192.168.10.1 255.255.255.0
 ! Optional: Forward DHCP broadcasts to a central DHCP server
 ! ip helper-address 192.168.10.50
 no shutdown
 exit

interface Vlan20
 description SALES-GATEWAY
 ip address 192.168.20.1 255.255.255.0
 ! ip helper-address 192.168.10.50
 no shutdown
 exit

end
write memory

Template 2: Router-on-a-Stick (Layer 2 Switch + External Router)

Apply the Layer 2 trunk and access port configuration on the switch first, then configure the 802.1Q subinterfaces on the connected router:

! === PART A: LAYER 2 SWITCH CONFIGURATION ===
configure terminal

vlan 10
 name ENGINEERING
 exit
vlan 20
 name SALES
 exit

interface GigabitEthernet0/1
 switchport mode access
 switchport access vlan 10
 no shutdown
 exit

interface GigabitEthernet0/2
 switchport mode access
 switchport access vlan 20
 no shutdown
 exit

! Configure 802.1Q trunk uplink toward the router
interface GigabitEthernet0/24
 description TRUNK-TO-ROUTER-GI0/0
 ! On older IOS platforms, run: switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport trunk allowed vlan 10,20
 no shutdown
 exit

end
write memory
! === PART B: EXTERNAL ROUTER CONFIGURATION ===
configure terminal

! Bring up the physical parent interface (no IP address assigned here)
interface GigabitEthernet0/0
 description TRUNK-FROM-L2-SWITCH
 no ip address
 no shutdown
 exit

! Create subinterface for VLAN 10
interface GigabitEthernet0/0.10
 description ENGINEERING-SUBINTERFACE
 encapsulation dot1Q 10
 ip address 192.168.10.1 255.255.255.0
 exit

! Create subinterface for VLAN 20
interface GigabitEthernet0/0.20
 description SALES-SUBINTERFACE
 encapsulation dot1Q 20
 ip address 192.168.20.1 255.255.255.0
 exit

end
write memory

Quick Verification Commands

show ip interface brief
show ip route connected
show interfaces trunk

Key Takeaway: Always create the Layer 2 VLANs alongside your Layer 3 interfaces and enable the physical parent router interface or global ip routing command so connected routes populate the routing table.

Securing Inter-VLAN Communication with ACLs and Firewalls

Immediately after you apply the SVI or subinterface configurations above, a critical security caveat takes effect: by default, a Layer 3 device routes packets freely between all directly connected subnets. Without explicit filtering, a compromised smart camera on an IoT VLAN or a visitor on Guest Wi-Fi can reach production servers on your corporate VLAN, negating the security value of segmentation. Locking down inter-VLAN traffic follows a three-stage progression.

  1. Define an Explicit Inter-VLAN Trust Matrix
    Before writing rules, document which subnets may initiate connections to others and on what ports. Typically, User VLANs need specific TCP/UDP access to Server/Printer VLANs (e.g., HTTPS 443, SMB 445, DNS 53), while Guest and IoT VLANs should be blocked from all internal RFC 1918 private address space (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) while retaining access to a DHCP/DNS server and the internet.

  2. Enforce Wire-Speed Stateless Filtering with SVI Access Control Lists (ACLs)
    Layer 3 switches compile Extended IPv4/IPv6 ACLs into hardware TCAM memory, allowing them to permit or drop packets based on source/destination IP and Layer 4 port numbers with zero throughput penalty.

  3. Placement Direction: Apply extended ACLs inbound (in) on the source VLAN’s SVI. From the switch routing engine’s perspective, in on interface Vlan30 inspects packets originating from VLAN 30 hosts before the switch routes them toward other VLANs.
  4. Handling Stateless Return Traffic: Because standard switch ACLs are stateless (they do not maintain a dynamic session table), blocking VLAN 20 inbound from reaching VLAN 10 will also drop VLAN 20’s reply packets when VLAN 10 initiates a legitimate connection. For TCP flows, permit return packets carrying the ACK or RST flags using the established keyword before your deny statements, and always finish with an explicit permit ip any any if internet-bound traffic is allowed (overriding the implicit deny ip any any at the end of every ACL):
    ios
    ip access-list extended ISOLATE-SALES-FROM-ENG
    permit tcp 192.168.20.0 0.0.0.255 192.168.10.0 0.0.0.255 established
    permit udp 192.168.20.0 0.0.0.255 host 192.168.10.50 eq domain
    deny ip 192.168.20.0 0.0.0.255 192.168.10.0 0.0.0.255
    permit ip any any
    !
    interface Vlan20
    ip access-group ISOLATE-SALES-FROM-ENG in

  5. Route High-Risk Zones Through a Stateful Firewall
    Stateless switch ACLs cannot track connectionless UDP sessions reliably, inspect encrypted application payloads, or run Intrusion Detection and Prevention (IDS/IPS) signatures. In security-sensitive networks, adopt a hybrid segmentation architecture:

  6. Keep trusted, high-throughput East-West VLANs (such as Workstations and Storage/Backup VLANs) on the Layer 3 switch SVIs for wire-speed performance.
  7. Terminate untrusted or compliance-scoped VLANs (Guest Wi-Fi, IoT/OT, DMZ, PCI-DSS) as Layer 2 trunks directly onto a stateful Next-Generation Firewall (NGFW)—or place them inside isolated VRF-Lite routing tables on the switch whose sole next hop is the firewall—so every cross-zone session undergoes stateful tracking and Layer 7 inspection.

Key Takeaway: Combine inbound SVI ACLs for fast, coarse-grained internal subnet restrictions with a stateful firewall for untrusted zones that require session-aware policies and deep packet inspection.

Troubleshooting Inter-VLAN Routing Failures: A Diagnostic Guide

When hosts in different VLANs fail to communicate—either right after initial setup or following a network change—working systematically from Layer 2 state up to Layer 3 routing and endpoint settings prevents guesswork.

  1. Confirm Global IP Routing Is Enabled on the Switch
    Symptom: Hosts can ping their own SVI IP address, yet cross-VLAN pings time out and show ip route displays an empty routing table.
    Cause & Fix: Many multilayer switches ship with Layer 3 forwarding disabled by default so they behave as standard Layer 2 switches out of the box. Verify routing status and issue ip routing in global configuration mode (or check the global IPv4/IPv6 Routing box in web-managed switch GUIs).

  2. Check Layer 2 VLAN Existence and SVI up/down Autostate
    Symptom: Running show ip interface brief shows Vlan10 as administratively up, but its line protocol remains down (up/down) even after issuing no shutdown.
    Cause & Fix: Creating interface Vlan10 does not automatically create VLAN 10 in the Layer 2 VLAN database. Furthermore, due to switch SVI autostate rules, an SVI only transitions to up/up when the Layer 2 VLAN exists (show vlan brief) and at least one physical access or trunk port is actively forwarding in that VLAN (not shut down or blocked by Spanning Tree).

  3. Inspect 802.1Q Trunk Allowed Lists and Native VLAN Alignment
    Symptom: SVIs or router subinterfaces show up/up, yet endpoints on downstream access switches cannot ping their default gateway.
    Cause & Fix: Run show interfaces trunk on both ends of every inter-switch or switch-to-router link. Verify that the link actually negotiated trunking, that the target VLAN IDs were not pruned (watch out for running switchport trunk allowed vlan 30 without the add keyword, which wipes out existing VLANs!), and that both ends share an identical native VLAN so untagged frames are not dropped or misdirected.

  4. Audit Router Parent Interfaces and dot1Q Tag Mismatches (ROAS)
    Symptom: On Router-on-a-Stick setups, subinterfaces show administratively down or fail to complete ARP resolution with hosts.
    Cause & Fix: Confirm the physical parent interface (e.g., GigabitEthernet0/0) has no shutdown configured, and inspect show running-config interface to verify the encapsulation dot1Q <vlan-id> number on each subinterface matches the switch’s VLAN ID and subnet assignment.

  5. Verify Endpoint Default Gateways, Subnet Masks, and Local Host Firewalls
    Symptom: Host A (192.168.10.10) can ping both its own gateway (192.168.10.1) and VLAN 20’s gateway (192.168.20.1), yet pings directly to Host B (192.168.20.20) fail.
    Cause & Fix: Because Host A reaches VLAN 20’s SVI, the switch is routing properly—pointing directly to an endpoint or ACL issue:

  6. Check Host B’s IP settings (ipconfig /all or ip route): a missing or mistyped default gateway prevents Host B from sending echo replies back to VLAN 10, while an overly broad subnet mask (such as /16 instead of /24) tricks a host into ARPing locally instead of using its gateway.
  7. If hosts rely on a centralized DHCP server in another subnet, ensure ip helper-address <DHCP-IP> is configured on each client SVI/subinterface so endpoints aren’t stuck with 169.254.x.x APIPA addresses.
  8. Check OS-level firewalls (such as Windows Defender Firewall), which frequently allow ICMP/SMB from the local subnet by default while silently dropping requests arriving from remote VLAN subnets, and inspect show access-lists hit counters on the switch for unintended ACL drops.

Key Takeaway: If an endpoint can ping a remote VLAN’s gateway IP but cannot reach hosts inside that VLAN, stop troubleshooting switch trunks and immediately inspect the destination host’s default gateway, local OS firewall, and return-path ACLs.

Best Layer 3 Switches for Wire-Speed Inter-VLAN Routing

When network diagnostics or capacity planning show that software routing on an external gateway is throttling cross-subnet throughput, upgrading to dedicated Layer 3 switching hardware unlocks wire-speed performance. Before buying, distinguish between Layer 3 Lite switches (which support hardware SVIs and static routes—plenty for most single-site networks) and Full Layer 3 switches (which add dynamic routing protocols like OSPF and BGP, VRF-Lite, and redundant stacking):

  1. Cisco Catalyst 9300 / 9300X Series — Best for Enterprise Campus Cores
    Built on Cisco’s custom UADP ASIC architecture, the Catalyst 9300 family is the enterprise benchmark for high-density multilayer switching. It delivers full wire-speed IPv4/IPv6 SVIs, OSPF, EIGRP, BGP, VRF segmentation, HSRP/VRRP high availability, high-capacity StackWise backplane stacking, and deep TCAM tables for granular inter-VLAN ACLs alongside multigigabit PoE++ port options.

  2. HPE Aruba Networking CX 6200 / 6300 Series — Best Enterprise Alternative with Streamlined Licensing
    Running the modern AOS-CX operating system, the CX 6200 (fixed) and CX 6300 (modular power/fans) deliver non-blocking hardware SVIs, OSPF routing, VRRP, Virtual Switching Framework (VSF) stacking, and built-in REST APIs for network automation without requiring recurring subscription tiers to unlock core Layer 3 features.

  3. Cisco Catalyst 1300 Series — Best All-Around SMB Multilayer Switch
    Serving as the direct successor to Cisco’s popular Business CBS350 line, the Catalyst 1300 brings reliable wire-speed static IPv4/IPv6 inter-VLAN routing, SVIs, DHCP relay, and hardware ACLs to small and midsize offices. Administrators can configure it via an approachable web GUI or a standard Cisco-style CLI with zero recurring licensing costs.

  4. HPE Aruba Instant On 1960 Series — Best Cloud-Managed SMB Static Routing Switch
    Designed for growing businesses that want simplicity without giving up multi-gigabit uplinks (2.5GbE and 10G SFP+), the Instant On 1960 supports hardware-accelerated static IPv4/IPv6 inter-VLAN routing across up to 32 static routes on access models (and up to 512 static routes / 32 VLAN routing interfaces on the 12XGT aggregation model). Routing can be managed locally via web UI or stacked in the free Instant On cloud portal.

  5. Ubiquiti UniFi Pro Max & Enterprise Series — Best for Prosumer & Multi-Gigabit UniFi Stacks
    Ubiquiti’s Professional, Pro Max, and Enterprise switch families pair 2.5GbE/10GbE access ports and 10G/25G SFP+/SFP28 uplinks with hardware-offloaded inter-VLAN routing, static routes, and DHCP server/relay. Assigning aUniFi L3 switch as a VLAN’s router in the UniFi controller automatically builds a dedicated transit network (VLAN 4040) up to your gateway. Keep in mind that switch-routed UniFi VLANs bypass gateway IDS/IPS inspection, so sensitive subnets should remain terminated on the gateway firewall.

  6. MikroTik CRS3xx Series (e.g., CRS317-1G-16S+RM / CRS328) — Best Budget 10GbE Homelab Pick
    Powered by Marvell Prestera switch chips, MikroTik’s CRS3xx switches support Layer 3 Hardware Offloading (l3-hw-offloading=yes) in RouterOS 7, moving connected inter-VLAN routes out of the modest management CPU and directly onto silicon for near-wire-speed 10GbE routing at a fraction of enterprise hardware costs. They are unbeatable for homelabs and NAS backbones, provided you stay within hardware-offloaded feature limits so packets do not fall back to the CPU.

Key Takeaway: Match your switch tier to your routing complexity—Layer 3 Lite static switches cover single-site SMB VLANs cost-effectively, while OSPF/BGP-capable enterprise switches or L3HW-offloaded 10GbE switches shine in multi-switch cores and storage-heavy labs.

Conclusion

Facilitating communication between VLANs always comes down to bridging isolated Layer 2 broadcast domains through a properly configured Layer 3 gateway. While Router-on-a-Stick subinterfaces remain a practical, low-cost option for small branch networks, hardware-accelerated Switched Virtual Interfaces (SVIs) on Layer 3 switches have become the standard for delivering microsecond, wire-speed connectivity across modern multi-subnet LANs. Pairing clean SVI or trunk configurations with inbound hardware ACLs, stateful edge firewall inspection for untrusted zones, and methodical Layer 2-to-Layer 3 diagnostics ensures your segmented network stays both fast and secure.

Please follow and like us:
Last modified: November 27, 2026

Author

Comments

Write a Reply or Comment

Your email address will not be published.