Lab #11

Two VLANs connected by a router on a stick

The purpose of this lab is to show how two VLANs, created on a single switch, can be connected by means of a router.
The router-on-a-stick setup is shown, where a router with a single physical interface is assigned two different IP addresses associated to two different VLANs.

Preparation steps

Before this experiment is executed, it is required that you have previously configured GNS3 to make it able to instantiate a Docker container of a Linux-based router based on the FRR (Free Range Routing) software suite, as described in Lab #3.
In particular, the GNS3 VM in which Docker containers are activated should have:

Experiment steps

  1. Create the following topology in GNS3. Choose the "GNS3 VM" server to instantiate all the devices of this lab.
  2. lab7-topology
     
  3. When the devices are still inactive, right-click on the SW1 switch icon and configure it as follows:
  4. When the devices are still inactive, right-click on the router icon and select the Configure option.
  5. Press Edit to modify the router's network configuration.
    Modify the router's interfaces configuration as illustrated in the following picture.

  6. router-configuration
     

    The above configuration:
  7. Start all devices.
  8. Verify router's configuration by issuing the ifconfig command at the router's console.
    This command should produce the output as shown in the picture below.

    router-ifconfig
     
    The router forwards traffic between subnets 10.10.1.0/24 and 10.10.2.0/24 which are directly reachable from its interfaces eth0 and eth0.2 as shown by the netstat -nr command.

    router-netstat
     
  9. Start capture on link connecting SW1 to the router.
  10. Open PC1 terminal and execute the command:
    ip 10.10.1.2/24 10.10.1.1
  11. Open PC2 terminal and execute the command:
    ip 10.10.1.3/24 10.10.1.1
  12. Open PC3 terminal and execute the command:
    ip 10.10.2.2/24 10.10.2.1
  13. Open PC4 terminal and execute the command:
    ip 10.10.2.3/24 10.10.2.1
  14. In PC1 terminal execute the command:
    ping 10.10.2.2
    and verify that answers are received from PC3.

  15. PC1-ping-PC3
     

Traffic analysis

The following picture shows a sequence of packets captured by Wireshark on the trunk link connecting switch SW1 to the router.


packet-capture
 

Notice that the same ICMP echo request packet sent by PC1 towards PC3 is seen twice: once untagged on its travel from PC1 to the router (packet no. 3) and a second time tagged with VLAN ID 2 on its travel from the router to PC3 (packet no. 6).

Likewise, the same ICMP echo reply packet sent by PC3 back to PC1 is seen twice: once tagged with VLAN ID 2 on its travel from PC3 to the router (packet no. 7) and a second time untagged on its travel from the router to PC1 (packet no. 8).


Return to list of labs

Copyright (c) 2024 - Roberto Canonico

Last updated: 24/09/2024 by Roberto Canonico