What is Inter-VLAN Routing? Router-on-a-Stick and Layer 3 Switches Explained

What is Inter-VLAN Routing? Router-on-a-Stick and Layer 3 Switches Explained
Networking ATN Campus September 08, 2026 19 views

What is Inter-VLAN Routing? Router-on-a-Stick and Layer 3 Switches Explained

VLANs are used to logically separate devices within a network. However, devices in different VLANs cannot communicate directly at Layer 2. To allow communication between different VLANs, we need Inter-VLAN Routing.

In this article, we will learn what Inter-VLAN Routing is, why it is required, and how it can be implemented using Router-on-a-Stick and Layer 3 switches.


What is Inter-VLAN Routing?

Inter-VLAN Routing is the process of forwarding traffic between different VLANs using a Layer 3 device such as a router or Layer 3 switch.

For example, imagine a network with:

  • VLAN 10 – Administration
  • VLAN 20 – Sales
  • VLAN 30 – IT

A PC in VLAN 10 cannot communicate directly with a PC in VLAN 20 because they are separate Layer 2 broadcast domains.

    VLAN 10                         VLAN 20

   PC - Admin                     PC - Sales
      |                              |
      |                              |
 +----------+                  +----------+
 |  Switch  |                  |  Switch  |
 +----------+                  +----------+
      \                            /
       \                          /
        +------------------------+
                 X
          No direct Layer 2
             communication
    

A Layer 3 routing device is required to move traffic between these VLANs.

Why is Inter-VLAN Routing Needed?

VLANs provide segmentation and help separate departments, users, servers, and other devices. But sometimes devices in different VLANs need to communicate.

For example:

  • Sales users need to access a server in the Server VLAN.
  • Administration users need to access an internal application.
  • IT administrators need to access network management systems.
  • Employees need to access shared services located in another VLAN.

Inter-VLAN routing provides this communication while maintaining logical VLAN separation.

How Inter-VLAN Routing Works

          VLAN 10
         192.168.10.0/24
               |
              PC1
               |
               |
          +---------+
          | Switch  |
          +---------+
               |
               | VLAN 10
               |
          +-----------+
          | Layer 3   |
          | Router    |
          +-----------+
               |
               | VLAN 20
               |
          +---------+
          | Switch  |
          +---------+
               |
              PC2
          VLAN 20
      192.168.20.0/24
    

When PC1 in VLAN 10 wants to communicate with PC2 in VLAN 20, the traffic is sent to its default gateway.

The Layer 3 device routes the packet from the VLAN 10 network to the VLAN 20 network.

Method 1: Router-on-a-Stick

Router-on-a-Stick is a method of performing Inter-VLAN Routing using a single physical router interface divided into multiple logical subinterfaces.

             PC1
          VLAN 10
             |
             |
      +-------------+
      |   Switch    |
      +-------------+
             |
             | 802.1Q Trunk
             |
      +-------------+
      |   Router    |
      |             |
      | Gi0/0       |
      +-------------+
         |    |
      Gi0/0.10 Gi0/0.20
         |    |
      VLAN 10 VLAN 20
    

The physical router interface connects to the switch using a trunk. The router then creates multiple subinterfaces, with each subinterface representing a VLAN.

Router-on-a-Stick Example

Suppose we have:

  • VLAN 10 = 192.168.10.0/24
  • VLAN 20 = 192.168.20.0/24

The router could use:

  • 192.168.10.1 as the gateway for VLAN 10
  • 192.168.20.1 as the gateway for VLAN 20

Router configuration:

```

Router(config)# interface GigabitEthernet0/0
Router(config-if)# no shutdown

Router(config)# 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)# interface GigabitEthernet0/0.20
Router(config-subif)# encapsulation dot1Q 20
Router(config-subif)# ip address 192.168.20.1 255.255.255.0 
```

Each subinterface becomes the default gateway for its corresponding VLAN.

Switch Configuration for Router-on-a-Stick

The switch interface connected to the router must operate as a trunk.

```

Switch(config)# interface GigabitEthernet0/24
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20 
```

The trunk allows VLAN 10 and VLAN 20 traffic to travel between the switch and router.

Method 2: Layer 3 Switch

A Layer 3 switch can perform routing directly. This is a common solution in enterprise networks because it combines high-speed switching and Layer 3 routing capabilities.

   VLAN 10 PC
       |
       |
   +-----------+
   | Layer 3   |
   |  Switch   |
   +-----------+
       |
   VLAN 20 PC
    

Instead of sending traffic to an external router, the Layer 3 switch can create an SVI, or Switched Virtual Interface, for each VLAN.

SVI Example

Suppose VLAN 10 uses the 192.168.10.0/24 network and VLAN 20 uses 192.168.20.0/24.

```

Switch(config)# ip routing

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 vlan 20
Switch(config-if)# ip address 192.168.20.1 255.255.255.0
Switch(config-if)# no shutdown 
```

The Layer 3 switch now has a Layer 3 interface for each VLAN.

The PCs use these SVI addresses as their default gateways.

Router-on-a-Stick vs Layer 3 Switch

Feature Router-on-a-Stick Layer 3 Switch
Routing device Router Layer 3 switch
Physical interface One interface with subinterfaces SVIs
VLAN trunk required Yes Not necessarily for routing between local VLANs
Common use Small networks and labs Medium and large enterprise networks
Routing performance Depends on router interface Generally high for LAN routing

Default Gateway and Inter-VLAN Routing

The default gateway plays an important role in Inter-VLAN Routing.

```

PC1
IP:      192.168.10.10
Mask:    255.255.255.0
Gateway: 192.168.10.1

```
         |
         v

   Layer 3 Device
   VLAN 10 Gateway
   192.168.10.1

         |
         | Routing
         v

   VLAN 20 Gateway
   192.168.20.1

         |
         v
```

PC2
IP:      192.168.20.10
Mask:    255.255.255.0
Gateway: 192.168.20.1 
```

Useful Cisco Verification Commands

```

Switch# show vlan brief

Switch# show ip interface brief

Switch# show ip route

Switch# show interfaces trunk

Switch# show interfaces vlan 10 
```

These commands help verify VLANs, interfaces, routing information, trunk connections, and SVI status.

Practical Packet Tracer Lab

  1. Create VLAN 10 and VLAN 20.
  2. Assign PCs to the appropriate VLANs.
  3. Configure Router-on-a-Stick or a Layer 3 switch.
  4. Configure the correct default gateways.
  5. Configure the required trunk connection.
  6. Test connectivity using the ping command.
  7. Verify routing using show ip route.

Quiz

Question: Can two different VLANs communicate directly at Layer 2?

Show Answer

No. Traffic between different VLANs requires Layer 3 routing.

Bonus Question: What are two common methods of Inter-VLAN Routing?

Show Answer

Router-on-a-Stick and Layer 3 switch routing using SVIs.

Key Takeaways

  • Inter-VLAN Routing allows communication between different VLANs.
  • Different VLANs represent different Layer 2 broadcast domains.
  • Router-on-a-Stick uses router subinterfaces and an 802.1Q trunk.
  • Layer 3 switches can route between VLANs using SVIs.
  • Each VLAN normally requires a Layer 3 gateway for routed communication.
  • Layer 3 switches are widely used for high-speed internal enterprise routing.

Start Your Networking Journey with ATN Campus

Want to master VLANs, Inter-VLAN Routing, switching, routing, subnetting, network security, and other essential networking concepts?

ATN Campus provides industry-focused networking and cybersecurity training that combines theory with practical hands-on experience.

Courses Available

  • CCNA – Cisco Certified Network Associate
  • CCNP – Cisco Certified Network Professional
  • CEH – Certified Ethical Hacker
  • Cisco CyberOps
  • Network Security
  • Cloud Networking
  • Python for Network Automation
  • Practical Networking Labs
  • Cybersecurity Fundamentals
  • Career Guidance & Certification Preparation

Whether you're starting from zero or preparing for a professional networking or cybersecurity certification, ATN Campus can help you build the practical knowledge and hands-on skills needed for today's IT industry.

???? Learn networking. ???? Master switching & routing. ???? Practice with real-world labs. ???? Prepare for certifications. ???? Build your IT career with ATN Campus.
Document ATN CAMPUS