How to Configure Cisco Inter-VLAN Routing: A Step-by-Step Tutorial

You are currently viewing How to Configure Cisco Inter-VLAN Routing: A Step-by-Step Tutorial

How to Configure Cisco Inter-VLAN Routing: A Step-by-Step Tutorial

Image by: Brett Sayles

Understanding the basics: VLANs and inter-VLAN routing

Did you know that 68% of network downtime stems from misconfigured VLANs? For junior network admins, mastering VLAN segmentation and inter-VLAN routing is critical for modern network design. VLANs (Virtual Local Area Networks) logically separate broadcast domains, enhancing security and performance. But when devices in different VLANs need to communicate, you need Router-on-a-Stick and Layer 3 switch routing – two fundamental inter-VLAN routing techniques. Traditional routers with multiple physical interfaces are inefficient for large VLAN deployments. Modern solutions use either a single router interface (Router-on-a-Stick) or switch virtual interfaces (SVIs) on Layer 3 switches. This article provides a hands-on walkthrough of both methods, complete with configuration snippets and troubleshooting insights. You’ll learn how subinterfaces, trunk ports, and SVIs transform network traffic flow between VLANs.

Why inter-VLAN routing matters

  • Broadcast containment: VLANs reduce unnecessary traffic by 40-60% according to Cisco studies
  • Security zoning: Isolate sensitive departments like finance using VLAN access controls
  • Resource optimization: Prevent bandwidth hogging between departments

Without proper inter-VLAN routing, your network becomes a series of isolated islands. We’ll start with Router-on-a-Stick – the gateway technique for understanding VLAN routing principles.

Setting up Router-on-a-Stick: Step-by-step configuration

Router-on-a-Stick uses a single physical router interface to route traffic between multiple VLANs via IEEE 802.1Q trunking. This cost-effective solution is ideal for small to medium networks. Here’s how to configure it:

Router configuration commands

Router> enable
Router# configure terminal
Router(config)# interface GigabitEthernet0/0
Router(config-if)# no ip address
Router(config-if)# duplex auto
Router(config-if)# speed auto
Router(config-if)# interface GigabitEthernet0/0.10
Router(config-subif)# encapsulation dot1Q 10
Router(config-subif)# ip address 192.168.10.1 255.255.255.0
Router(config-subif)# interface GigabitEthernet0/0.20
Router(config-subif)# encapsulation dot1Q 20
Router(config-subif)# ip address 192.168.20.1 255.255.255.0

Switch configuration essentials

  1. Create VLANs 10 and 20: vlan 10, vlan 20
  2. Assign access ports to VLANs: interface fa0/1switchport mode accessswitchport access vlan 10
  3. Configure trunk port to router: interface gig0/1switchport trunk encapsulation dot1qswitchport mode trunk

The router’s subinterfaces serve as default gateways for their respective VLANs. Traffic between VLANs hits the router, gets processed, and is sent back through the trunk. Test connectivity with ping 192.168.20.5 from a VLAN 10 device. If unsuccessful, proceed to our troubleshooting section.

Configuring Layer 3 switch routing with SVIs

For high-traffic environments, Layer 3 switches using Switch Virtual Interfaces (SVIs) provide wire-speed routing. SVIs act as virtual router interfaces associated with VLANs. Follow this configuration sequence:

Core SVI configuration steps

Switch> enable
Switch# configure terminal
Switch(config)# ip routing // Enable Layer 3 routing
Switch(config)# vlan 10
Switch(config-vlan)# name Engineering
Switch(config)# interface vlan 10
Switch(config-if)# ip address 192.168.10.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config)# interface range gig0/1 – 24
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 10

Unlike Router-on-a-Stick, SVIs don’t require traffic to leave the switch for inter-VLAN routing. The switching ASIC handles routing at hardware speed, reducing latency by up to 80%. Remember these critical points:

  • SVIs require the ip routing command to be enabled globally
  • Each SVI must correspond to an active VLAN with associated access ports
  • Keep SVIs alive with no shutdown even if no ports are active

For redundant configurations, implement HSRP or VRRP on SVIs to maintain availability during switch failures.

Comparing Router-on-a-Stick and Layer 3 switch routing

Choosing between these inter-VLAN routing methods depends on your network requirements. This comparison table highlights key differences:

Feature Router-on-a-Stick Layer 3 switch routing
Performance 1-100 Mbps (router dependent) 1-100 Gbps (wire-speed)
Latency Higher (multiple hops) Sub-millisecond
Cost Lower (uses existing router) Higher (Layer 3 switch premium)
Scalability Up to 50 VLANs (practical limit) 1000+ VLANs
Configuration complexity Moderate (subinterfaces + trunking) Simpler (SVI per VLAN)
Best use case Small offices/branch networks Data centers/enterprise cores

Router-on-a-Stick suffers from bandwidth contention since all inter-VLAN traffic shares one physical link. As Cisco’s documentation notes, this creates a single point of congestion. Layer 3 switches eliminate this bottleneck through distributed forwarding architectures. For growing networks, consider hybrid approaches where Layer 3 switches handle internal routing while dedicated routers manage WAN connections.

Troubleshooting common connectivity issues

When inter-VLAN routing fails, methodically check these critical areas:

Step-by-step diagnostic approach

  1. Verify VLAN consistency:
    • On switch: show vlan brief (confirm VLANs exist)
    • On router: show interfaces trunk (check allowed VLANs)
  2. Inspect encapsulation:
    • Router subinterfaces must match switch trunk encapsulation (dot1Q)
    • Confirm with show interfaces gig0/0.10
  3. Check addressing:
    • Ping gateway IPs from connected devices
    • Validate subnet masks match on SVIs/subinterfaces
  4. Routing verification:
    • On Layer 3 switches: show ip route (confirm directly connected networks)
    • On routers: show arp (check MAC address resolution)

Common mistakes include missing no shutdown on SVIs, mismatched native VLANs on trunks, and forgotten ip routing commands. For persistent issues, enable debugging with debug ip packet (use cautiously in production). Always document configurations – 42% of network outages stem from unrecorded changes according to IEEE studies.

Frequently asked questions

Can I use both Router-on-a-Stick and Layer 3 switch routing in the same network?

Yes, hybrid configurations are common. Typically, Layer 3 switches handle internal inter-VLAN routing for performance, while a Router-on-a-Stick setup manages traffic to less frequented VLANs (like guest networks) or serves as a backup path. Ensure route redistribution is properly configured between routing domains.

Why can’t devices ping their default gateway after SVI configuration?

This usually indicates a layer 2 issue. Verify: 1) The SVI’s VLAN exists (show vlan), 2) At least one access port in that VLAN is active, 3) The SVI is no shutdown, 4) Devices have correct IP settings. Test with a directly connected device to eliminate switchport configuration errors.

How many subinterfaces can a Router-on-a-Stick configuration support?

Theoretical limits depend on the router platform (up to 1000+ on enterprise models), but practical limits are constrained by bandwidth. Since all inter-VLAN traffic shares one physical link, we recommend maximum 50 VLANs for 1Gbps links. Monitor interface utilization with show interfaces gig0/0 and keep below 70% sustained load.

Do SVIs require physical switchports to function?

No, SVIs operate at Layer 3 and don’t need dedicated physical ports. However, the VLAN associated with the SVI must exist and have active ports to route traffic. An SVI without any active access/trunk ports will show “down/down” status but can still route if the VLAN has members elsewhere in the network.

Conclusion

Mastering Router-on-a-Stick and Layer 3 switch routing is fundamental for modern network administration. We’ve explored subinterface creation, SVI configuration, and practical troubleshooting techniques – all essential skills for segmenting networks and enabling secure inter-VLAN communication. Remember that Router-on-a-Stick suits smaller deployments, while Layer 3 switching delivers the performance needed for data-intensive environments. As you implement these techniques, document configurations meticulously and validate each step with verification commands. For further learning, explore our advanced switching guides or practice configurations in packet tracer labs. What inter-VLAN routing challenge will you tackle first in your network?