Configure Inter-VLAN Routing in Cisco Packet Tracer: Step-by-Step Guide

Configure Inter-VLAN Routing in Cisco Packet Tracer: Step-by-Step Guide
Networking ATN Campus November 02, 2026 12 views

Configure Inter-VLAN Routing in Cisco Packet Tracer: Step-by-Step Guide

In a VLAN-based network, devices belonging to different VLANs are separated into different Layer 2 broadcast domains. However, companies often need departments such as HR, IT, and Finance to communicate with shared services and approved resources.

Inter-VLAN routing makes this communication possible by using a Layer 3 device, such as a router or Layer 3 switch.

In this practical Cisco Packet Tracer tutorial, you will build a VLAN network and configure Router-on-a-Stick to enable communication between different VLANs.


1. What Is Inter-VLAN Routing?

Inter-VLAN routing is the process of forwarding network traffic between different VLANs using a Layer 3 device.

A normal Layer 2 switch separates VLANs and does not route traffic between them. A router or Layer 3 switch is needed to provide communication between separate IP networks.

Example

Consider a company with these departments:

  • HR – VLAN 10
  • IT – VLAN 20
  • Finance – VLAN 30

Each department has its own IP subnet. Inter-VLAN routing allows authorized devices in one subnet to communicate with devices in another subnet.

2. What Is Router-on-a-Stick?

Router-on-a-Stick is a method of configuring one physical router interface with multiple logical subinterfaces. Each subinterface handles traffic for a particular VLAN.

The router connects to a switch through a trunk link that carries traffic for multiple VLANs.

How It Works

  1. The switch receives a frame from a device in a VLAN.
  2. The switch sends the frame across the trunk link with the appropriate VLAN tag.
  3. The router receives the frame on its physical interface.
  4. The appropriate router subinterface processes the VLAN traffic.
  5. The router routes packets between the source and destination IP networks.
  6. The traffic is sent back through the trunk with the destination VLAN tag.

IEEE 802.1Q tagging is commonly used to identify VLAN traffic across the trunk link.

3. Lab Requirements

Build the following network using Cisco Packet Tracer.

DeviceQuantityPurpose
Cisco 2960 Switch1Connects PCs and router
Cisco Router1Routes traffic between VLANs
PC6Represents company employees
Copper Straight-Through Cable7Connects devices

Network Topology

                 [ ROUTER R1 ]
                  G0/0
                    |
                 TRUNK LINK
                    |
                 [ SWITCH S1 ]
          +---------+---------+
          |         |         |
        VLAN 10   VLAN 20   VLAN 30
          |         |         |
        PC1 PC2   PC3 PC4   PC5 PC6

          HR        IT      FINANCE
    

Connect the router's GigabitEthernet0/0 interface to the switch's GigabitEthernet0/1 interface. Connect each PC to the access ports shown below.

Interface names vary by router model. If your router uses a different interface name, substitute the correct interface in the commands.

4. Step 1: Configure the IP Addressing Plan

Each VLAN requires a separate IP subnet. The router subinterface address will be the default gateway for devices in that VLAN.

VLANDepartmentNetworkDefault Gateway
10HR192.168.10.0/24192.168.10.1
20IT192.168.20.0/24192.168.20.1
30Finance192.168.30.0/24192.168.30.1

PC Addressing Table

PCSwitch PortIP AddressDefault Gateway
PC1Fa0/1192.168.10.10192.168.10.1
PC2Fa0/2192.168.10.11192.168.10.1
PC3Fa0/3192.168.20.10192.168.20.1
PC4Fa0/4192.168.20.11192.168.20.1
PC5Fa0/5192.168.30.10192.168.30.1
PC6Fa0/6192.168.30.11192.168.30.1

5. Step 2: Create VLANs on the Switch

Open the switch CLI and enter configuration mode.

Switch> enable
Switch# configure terminal
    

Create the three VLANs:

Switch(config)# vlan 10
Switch(config-vlan)# name HR
Switch(config-vlan)# exit

Switch(config)# vlan 20
Switch(config-vlan)# name IT
Switch(config-vlan)# exit

Switch(config)# vlan 30
Switch(config-vlan)# name FINANCE
Switch(config-vlan)# exit
    

These commands create the logical networks used by the company departments.

6. Step 3: Assign Switch Ports to VLANs

Configure the ports connected to the PCs as access ports.

VLAN 10 – HR

Switch(config)# interface range fa0/1 - 2
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 10
Switch(config-if-range)# exit
    

VLAN 20 – IT

Switch(config)# interface range fa0/3 - 4
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 20
Switch(config-if-range)# exit
    

VLAN 30 – Finance

Switch(config)# interface range fa0/5 - 6
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 30
Switch(config-if-range)# exit
    

7. Step 4: Configure the Switch Trunk Port

The link between the switch and router must carry traffic from all three VLANs. Configure the switch port connected to the router as a trunk.

In this example, the router connects to switch port GigabitEthernet0/1.

Switch(config)# interface gig0/1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20,30
Switch(config-if)# no shutdown
Switch(config-if)# exit
    

Some switch models or Packet Tracer versions may require a trunk encapsulation command before setting trunk mode. On a typical Cisco 2960 switch, 802.1Q is used and the encapsulation is fixed.

Verify the Trunk

Switch# show interfaces trunk
    

Check that the correct interface is trunking and that VLANs 10, 20, and 30 are allowed.

8. Step 5: Configure Router Subinterfaces

Now configure the router to route traffic between the VLANs.

Open the router CLI and enter global configuration mode:

Router> enable
Router# configure terminal
    

Enable the Physical Interface

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

Configure VLAN 10 Subinterface

Router(config)# interface gigabitEthernet 0/0.10
Router(config-subif)# encapsulation dot1Q 10
Router(config-subif)# ip address 192.168.10.1 255.255.255.0
Router(config-subif)# exit
    

Configure VLAN 20 Subinterface

Router(config)# interface gigabitEthernet 0/0.20
Router(config-subif)# encapsulation dot1Q 20
Router(config-subif)# ip address 192.168.20.1 255.255.255.0
Router(config-subif)# exit
    

Configure VLAN 30 Subinterface

Router(config)# interface gigabitEthernet 0/0.30
Router(config-subif)# encapsulation dot1Q 30
Router(config-subif)# ip address 192.168.30.1 255.255.255.0
Router(config-subif)# exit
    

Important: The physical router interface carries the VLAN traffic. The subinterfaces use 802.1Q tags to identify which VLAN each logical interface serves.

9. Step 6: Configure IP Addresses on PCs

Open each PC and select Desktop → IP Configuration.

For example, PC1 should be configured as follows:

IP Address:      192.168.10.10
Subnet Mask:     255.255.255.0
Default Gateway: 192.168.10.1
    

PC3 should use:

IP Address:      192.168.20.10
Subnet Mask:     255.255.255.0
Default Gateway: 192.168.20.1
    

PC5 should use:

IP Address:      192.168.30.10
Subnet Mask:     255.255.255.0
Default Gateway: 192.168.30.1
    

Configure the other PCs using the addressing table.

10. Step 7: Verify Router Configuration

Use the following commands on the router:

Check Interface Status

Router# show ip interface brief
    

Confirm that the physical interface and the three subinterfaces are operational. Their exact status depends on the physical link and device configuration.

Check Routing Table

Router# show ip route
    

You should see connected routes for:

  • 192.168.10.0/24
  • 192.168.20.0/24
  • 192.168.30.0/24

These networks are directly connected through the router's subinterfaces.

11. Step 8: Test Inter-VLAN Communication

Now test whether devices in different VLANs can communicate.

Test 1: PC1 to PC3

From PC1, open Command Prompt and enter:

ping 192.168.20.10
    

Expected result: Successful communication between VLAN 10 and VLAN 20.

Test 2: PC1 to PC5

ping 192.168.30.10
    

Expected result: Successful communication between VLAN 10 and VLAN 30.

Test 3: PC3 to PC5

ping 192.168.30.10
    

Expected result: Successful communication between VLAN 20 and VLAN 30.

The first ping may time out while ARP information is being learned. Repeat the test before diagnosing a failure.

12. Common Inter-VLAN Routing Problems

ProblemPossible causeWhat to check
PC cannot ping its gatewayWrong IP settings or interface issuePC IP, mask, gateway, router interface status
PCs in different VLANs cannot communicateIncorrect subinterface or VLAN configuration802.1Q VLAN IDs, router IP addresses, switch VLANs
Trunk not workingWrong switch interface or trunk configurationshow interfaces trunk
VLAN missingVLAN was not createdshow vlan brief
Router interface is downPhysical interface is shut down or link is disconnectedshow ip interface brief and cabling
Incorrect gatewayPC uses another VLAN's gatewayCompare the PC settings with the addressing table

13. Save Your Configuration

Save the switch and router configurations after completing the lab.

Switch# copy running-config startup-config

Router# copy running-config startup-config
    

Also save your Packet Tracer project using File → Save As so you can reopen and practice the topology later.

14. Router-on-a-Stick vs Layer 3 Switch

Router-on-a-Stick is useful for learning and smaller networks. Larger networks may use a Layer 3 switch with Switched Virtual Interfaces (SVIs) for inter-VLAN routing.

FeatureRouter-on-a-StickLayer 3 Switch
Routing deviceRouterLayer 3 switch
VLAN gatewaysRouter subinterfacesSVIs
Connection between VLANsVia router trunk linkWithin Layer 3 switch
Typical useSmall labs and networksCampus and larger LANs

Both methods provide Layer 3 communication between VLANs, but their hardware requirements and performance characteristics differ.

15. Frequently Asked Questions

Why is Inter-VLAN routing required?

Different VLANs are separate Layer 2 broadcast domains. A Layer 3 device is needed to route packets between their IP networks.

What is Router-on-a-Stick?

It is a routing method that uses multiple router subinterfaces on one physical interface to serve multiple VLANs over an 802.1Q trunk.

What does encapsulation dot1Q do?

It configures a router subinterface to identify traffic belonging to a specific VLAN using IEEE 802.1Q tagging.

Why does every PC need a default gateway?

The default gateway allows a PC to send traffic destined for other IP networks to a router for forwarding.

Can a Layer 3 switch perform Inter-VLAN routing?

Yes. A Layer 3 switch can use Switched Virtual Interfaces (SVIs) and routing features to route traffic between VLANs.

16. Quick Knowledge Check

Question 1: What is Inter-VLAN routing?

Answer: Routing traffic between different VLANs using a Layer 3 device.

Question 2: Which protocol is commonly used to tag VLAN traffic on a trunk?

Answer: IEEE 802.1Q.

Question 3: What is the purpose of a router subinterface?

Answer: It provides a logical Layer 3 interface for a particular VLAN.

Question 4: Which command displays the router's IP interface status?

Answer: show ip interface brief.

17. Key Takeaways

  • Inter-VLAN routing allows communication between different VLANs.
  • Router-on-a-Stick uses one physical router interface with multiple subinterfaces.
  • 802.1Q tagging identifies VLAN traffic across trunk links.
  • Each VLAN needs its own IP subnet and default gateway.
  • Router subinterfaces act as the default gateways in this lab.
  • Layer 3 switches can also provide Inter-VLAN routing using SVIs.
  • Packet Tracer helps students practice and troubleshoot real networking concepts.

Take Your Networking Skills Further with ATN Campus

Learn networking through practical labs, guided configuration exercises, and certification-focused training.

Explore courses and hands-on learning in:

  • CCNA and CCNP
  • Network Routing and Switching
  • Subnetting and IP Addressing
  • Network Security and CEH
  • Cisco CyberOps
  • Cloud Networking
  • Python for Network Automation
  • Practical Networking Labs

???? Want to learn networking? Visit ATN Campus.

???? Learn Networking.
???? Master Routing & Switching.
???? Practice with Real Labs.
???? Prepare for Certifications.
???? Build Your IT Career with ATN Campus.
Document ATN CAMPUS