Configuring VTP with Inter-VLAN Routing Using Cisco Packet Tracer

Niladri DasNiladri Das
8 min read

In this tutorial, we'll walk you through the process of configuring VLAN Trunking Protocol (VTP) with four VLANs and inter-VLAN routing using Cisco Packet Tracer version 8.2.2 on macOS. We'll cover the configuration of VTP Server, Client, and Transparent modes, as well as setting up a router for inter-VLAN routing. We'll also include the configuration of PCs connected to each switch.

Scenario Overview

  • Switch1: VTP Server

    • VLAN 10: 2 PCs (PC1, PC2)

    • VLAN 20: 2 PCs (PC3, PC4)

    • VLAN 30: 2 PCs (PC5, PC6)

    • VLAN 40: 2 PCs (PC7, PC8)

  • Switch2: VTP Client

    • VLAN 10: 1 PC (PC9)

    • VLAN 20: 1 PC (PC10)

    • VLAN 30: 1 PC (PC11)

    • VLAN 40: 1 PC (PC12)

  • Switch3: VTP Client

    • VLAN 10: 1 PC (PC13)

    • VLAN 20: 1 PC (PC14)

    • VLAN 30: 1 PC (PC15)

    • VLAN 40: 1 PC (PC16)

  • Switch4: VTP Transparent

    • VLAN 10: 1 PC (PC17)

    • VLAN 20: 1 PC (PC18)

    • VLAN 30: 1 PC (PC19)

    • VLAN 40: 1 PC (PC20)

  • Router: For inter-VLAN routing

  • Four VLANs:

    • VLAN 10 (Accounting)

    • VLAN 20 (Sales)

    • VLAN 30 (Engineering)

    • VLAN 40 (HR)

Step-by-Step Configuration

1. Configure Switch1 as the VTP Server

  1. Open Cisco Packet Tracer and add four switches.

  2. Connect the switches using cross-over cables (or straight-through cables if using modern switches that auto-sense).

Switch1 Configuration:

Switch> enable
Switch# configure terminal
Switch(config)# hostname Switch1
Switch1(config)# vtp domain SpaceX
Switch1(config)# vtp mode server
Switch1(config)# vtp password cisco123
Switch1(config)# vlan 10
Switch1(config-vlan)# name Accounting
Switch1(config-vlan)# vlan 20
Switch1(config-vlan)# name Sales
Switch1(config-vlan)# vlan 30
Switch1(config-vlan)# name Engineering
Switch1(config-vlan)# vlan 40
Switch1(config-vlan)# name HR
Switch1(config-vlan)# exit
Switch1(config)# interface range fa0/1 - 24
Switch1(config-if-range)# switchport mode trunk
Switch1(config-if-range)# exit
Switch1(config)# end
Switch1# write

2. Configure Switch2 as a VTP Client

Switch2 Configuration:

Switch> enable
Switch# configure terminal
Switch(config)# hostname Switch2
Switch2(config)# vtp domain SpaceX
Switch2(config)# vtp mode client
Switch2(config)# vtp password cisco123
Switch2(config)# interface range fa0/1 - 24
Switch2(config-if-range)# switchport mode trunk
Switch2(config-if-range)# exit
Switch2(config)# end
Switch2# write

3. Configure Switch3 as a VTP Client

Switch3 Configuration:

Switch> enable
Switch# configure terminal
Switch(config)# hostname Switch3
Switch3(config)# vtp domain SpaceX
Switch3(config)# vtp mode client
Switch3(config)# vtp password cisco123
Switch3(config)# interface range fa0/1 - 24
Switch3(config-if-range)# switchport mode trunk
Switch3(config-if-range)# exit
Switch3(config)# end
Switch3# write

4. Configure Switch4 as VTP Transparent Mode

Switch4 Configuration:

Switch> enable
Switch# configure terminal
Switch(config)# hostname Switch4
Switch4(config)# vtp domain SpaceX
Switch4(config)# vtp mode transparent
Switch4(config)# vtp password cisco123
Switch4(config)# interface range fa0/1 - 24
Switch4(config-if-range)# switchport mode trunk
Switch4(config-if-range)# exit
Switch4(config)# end
Switch4# write

5. Configure the Router for Inter-VLAN Routing

  1. Connect a router to Switch1.

  2. Configure subinterfaces for each VLAN on the router.

Router Configuration:

Router> enable
Router# configure terminal
Router(config)# interface fa0/0
Router(config-if)# no shutdown
Router(config-if)# exit
Router(config)# interface fa0/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
Router(config)# interface fa0/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
Router(config)# interface fa0/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
Router(config)# interface fa0/0.40
Router(config-subif)# encapsulation dot1Q 40
Router(config-subif)# ip address 192.168.40.1 255.255.255.0
Router(config-subif)# exit

Router(config)# end
Router# write

Configuring PCs with IP Addresses

Now, let's assign IP addresses to the PCs according to their respective VLANs.

PCs Configuration:

PC1 Configuration:

  • VLAN 10 (Accounting)

  • IP Address: 192.168.10.2

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.10.1

PC2 Configuration:

  • VLAN 10 (Accounting)

  • IP Address: 192.168.10.3

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.10.1

PC3 Configuration:

  • VLAN 20 (Sales)

  • IP Address: 192.168.20.2

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.20.1

PC4 Configuration:

  • VLAN 20 (Sales)

  • IP Address: 192.168.20.3

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.20.1

PC5 Configuration:

  • VLAN 30 (Engineering)

  • IP Address: 192.168.30.2

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.30.1

PC6 Configuration:

  • VLAN 30 (Engineering)

  • IP Address: 192.168.30.3

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.30.1

PC7 Configuration:

  • VLAN 40 (HR)

  • IP Address: 192.168.40.2

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.40.1

PC8 Configuration:

  • VLAN 40 (HR)

  • IP Address: 192.168.40.3

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.40.1

PC9 Configuration:

  • VLAN 10 (Accounting)

  • IP Address: 192.168.10.4

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.10.1

PC10 Configuration:

  • VLAN 20 (Sales)

  • IP Address: 192.168.20.4

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.20.1

PC11 Configuration:

  • VLAN 30 (Engineering)

  • IP Address: 192.168.30.4

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.30.1

PC12 Configuration:

  • VLAN 40 (HR)

  • IP Address: 192.168.40.4

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.40.1

PC13 Configuration:

  • VLAN 10 (Accounting)

  • IP Address: 192.168.10.5

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.10.1

PC14 Configuration:

  • VLAN 20 (Sales)

  • IP Address: 192.168.20.5

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.20.1

PC15 Configuration:

  • VLAN 30 (Engineering)

  • IP Address: 192.168.30.5

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.30.1

PC16 Configuration:

  • VLAN 40 (HR)

  • IP Address: 192.168.40.5

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.40.1

PC17 Configuration:

  • VLAN 10 (Accounting)

  • IP Address: 192.168.10.6

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.10.1

PC18 Configuration:

  • VLAN 20 (Sales)

  • IP Address: 192.168.20.6

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.20.1

PC19 Configuration:

  • VLAN 30 (Engineering)

  • IP Address: 192.168.30.6

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.30.1

PC20 Configuration:

  • VLAN 40 (HR)

  • IP Address: 192.168.40.6

  • Subnet Mask: 255.255.255.0

  • Default Gateway: 192.168.40.1

Testing Connectivity with Ping

To verify connectivity, use the ping command from each PC to test connectivity to other PCs within the same VLAN and across VLANs through the router.

Ping Test Setup:

  1. From PC1 (VLAN 10) to PC2 (VLAN 10):

    • Open Command Prompt (Windows) or Terminal (Linux/macOS) on PC1.

    • Ping PC2's IP address:

        ping 192.168.10.3
      
    • You should receive replies indicating successful connectivity.

  2. From PC3 (VLAN 20) to PC4 (VLAN 20):

    • Open Command Prompt (Windows) or Terminal (Linux/macOS) on PC3.

    • Ping PC4's IP address:

        ping 192.168.20.3
      
    • You should receive replies indicating successful connectivity.

  3. From PC5 (VLAN 30) to PC6 (VLAN 30):

    • Open Command Prompt (Windows) or Terminal (Linux/macOS) on PC5.

    • Ping PC6's IP address:

        ping 192.168.30.3
      
    • You should receive replies indicating successful connectivity.

  4. From PC7 (VLAN 40) to PC8 (VLAN 40):

    • Open Command Prompt (Windows) or Terminal (Linux/macOS) on PC7.

    • Ping PC8's IP address:

        ping 192.168.40.3
      
    • You should receive replies indicating successful connectivity.

  5. Testing Inter-VLAN Routing:

    • From PC1 (VLAN 10) to PC3 (VLAN 20):

      • Open Command Prompt (Windows) or Terminal (Linux/macOS) on PC1.

      • Ping PC3's IP address:

          ping 192.168.20.2
        
      • You should receive replies indicating successful connectivity. This confirms that inter-VLAN routing is working through the router.

    • From PC5 (VLAN 30) to PC7 (VLAN 40):

      • Open Command Prompt (Windows) or Terminal (Linux/macOS) on PC5.

      • Ping PC7's IP address:

          ping 192.168.40.2
        
      • You should receive replies indicating successful connectivity. This further confirms inter-VLAN routing is operational.

Troubleshooting Tips:

  • Check VLAN configurations: Ensure each PC is correctly assigned to its respective VLAN.

  • Verify router subinterface configurations: Double-check that each VLAN on the router has the correct IP address and subnet mask.

  • Check switch port configurations: Ensure switch ports are correctly configured as access ports in their respective VLANs.

Verification Commands

To verify VLAN configurations, trunk ports, and other settings, use the following commands:

Check VLAN Configuration:

Switch# show vlan brief

Check VTP Status:

Switch# show vtp status

Check Trunk Ports:

Switch# show interfaces trunk

Check Router Subinterfaces:

Router# show running-config

Check VLAN Membership for Specific Ports:

Switch# show interfaces fa0/1 switchport

By following this guide, you can configure VTP with four VLANs and inter-VLAN routing using Cisco Packet Tracer. This setup helps in managing VLANs efficiently across multiple switches and ensures seamless communication between different VLANs through inter-VLAN routing. If you encounter any issues or need further assistance, please feel free to email me at ndas1262000@gmail.com.

Network Diagram

Network Diagram for VTP with Four VLANs and Inter-VLAN Routing
-------------------------------------------------------------------------------
                                    Router
                               +-----------------+
                               |                 |
                               |   Router (R1)   |
                               |                 |
                               | Fa0/0.10: 192.168.10.1 |
                               | Fa0/0.20: 192.168.20.1 |
                               | Fa0/0.30: 192.168.30.1 |
                               | Fa0/0.40: 192.168.40.1 |
                               +--------+--------+
                                        |
                                        | Fa0/0
                               +--------+--------+
                               |                 |
                               |   Switch1 (S1)  |
                               |                 |
                               | VTP Server      |
                               +-----------------+
                    Fa0/2 |     Fa0/4 |     Fa0/6 |     Fa0/8 |
                         PC1         PC3         PC5         PC7
                      192.168.10.2 192.168.20.2 192.168.30.2 192.168.40.2
                    Fa0/3 |     Fa0/5 |     Fa0/7 |     Fa0/9 |
                         PC2         PC4         PC6         PC8
                      192.168.10.3 192.168.20.3 192.168.30.3 192.168.40.3
                                        |
                               +--------+--------+
                                        |
                                        |
                               +--------+--------+
                               |                 |
                               |   Switch2 (S2)  |
                               |                 |
                               | VTP Client      |
                               +-----------------+
                    Fa0/2 |     Fa0/3 |     Fa0/4 |     Fa0/5 |
                         PC9        PC10        PC11        PC12
                      192.168.10.4 192.168.20.4 192.168.30.4 192.168.40.4
                                        |
                               +--------+--------+
                                        |
                                        |
                               +--------+--------+
                               |                 |
                               |   Switch3 (S3)  |
                               |                 |
                               | VTP Client      |
                               +-----------------+
                    Fa0/2 |     Fa0/3 |     Fa0/4 |     Fa0/5 |
                         PC13       PC14       PC15       PC16
                      192.168.10.5 192.168.20.5 192.168.30.5 192.168.40.5
                                        |
                               +--------+--------+
                                        |
                                        |
                               +--------+--------+
                               |                 |
                               |   Switch4 (S4)  |
                               |                 |
                               | VTP Transparent |
                               +-----------------+
                    Fa0/2 |     Fa0/3 |     Fa0/4 |     Fa0/5 |
                         PC17       PC18       PC19       PC20
                      192.168.10.6 192.168.20.6 192.168.30.6 192.168.40.6
-------------------------------------------------------------------------------

[PC1] -- [VLAN 10]
[PC2] -- [VLAN 10]
[PC3] -- [VLAN 20]
[PC4] -- [VLAN 20]
[PC5] -- [VLAN 30]
[PC6] -- [VLAN 30]
[PC7] -- [VLAN 40]
[PC8] -- [VLAN 40]
[PC9] -- [VLAN 10]
[PC10] -- [VLAN 20]
[PC11] -- [VLAN 30]
[PC12] -- [VLAN 40]
[PC13] -- [VLAN 10]
[PC14] -- [VLAN 20]
[PC15] -- [VLAN 30]
[PC16] -- [VLAN 40]
[PC17] -- [VLAN 10]
[PC18] -- [VLAN 20]
[PC19] -- [VLAN 30]
[PC20] -- [VLAN 40]

[Switch1 (VTP Server)] -- [Switch2 (VTP Client)] -- [Switch3 (VTP Client)] -- [Switch4 (VTP Transparent)]

[Switch1] -- [Router]
[Switch2] -- [Router]
[Switch3] -- [Router]
[Switch4] -- [Router]

VLAN 10: Accounting
VLAN 20: Sales
VLAN 30: Engineering
VLAN 40: HR

Ensure you have the correct Cisco Packet Tracer version (8.2.2) installed on macOS for compatibility with this configuration guide. Happy networking!


0
Subscribe to my newsletter

Read articles from Niladri Das directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Niladri Das
Niladri Das