71 Connecting Two GNS3 Environments Together (Linux)

Mathew J. Heath Van Horn, PhD

In order for learners to gain more experience in cyber security, they must learn to adjust to changing situations.  In order to accomplish this, they must face a human opponent. In this lab, we are using two physical machines running Ubuntu, each running its own instance of GNS3, to practice being an attacker and defender in a safe GNS3 environment.

LEARNING OBJECTIVES

Connect two GNS3 environments together to form one complete network environment.

PREREQUISITES

The material in Mastering Enterprise Networks 

DELIVERABLES

  • None – this is a preparatory lab that supports other labs in this book

RESOURCES

Contributers and Testers

  • TBD

Phase I – Physical Setup

These instructions are for those PCs running Ubuntu Linux.  This phase involves setting up the physical machines for the connection process.

  1. You will need a wireless router and 2 PCs with WiFi capability
  2. The two PCs are going to be called BLUE and RED
  3. We are using Ubuntu 26.04.1 LTS for this example
  4. Set up the Wifi for DHCP – in our example, the physical router’s IP is 10.0.0.10/24 hosting “Purple_2026_2.4G” offering DHCP from 10.0.0.11 to 10.0.0.250
    Figure 1 - connect the physical machine wireless connection
    Figure 1 – connect the physical machine wireless connection
  5. Join your PC to the WiFi network. Don’t worry if it says “no internet”; we aren’t trying to perform any internet-related functions
  6. Open a terminal and type ip a to see if you have an IP address assigned over the wireless connection. In our example, we received an address of 10.0.0.13
    Figure 2 - verify an IP address is received
    Figure 2 – verify an IP address is received
  7. Record your wireless IP address. You will need it later
  8.  Repeat these steps for the second PC.

PHASE II – PC BLUE (DEFENDER)

Configure GNS3 on the physical PC identified as PC BLUE to connect to another GNS3 environment.

NOTE: If you were in a hurry and already started GNS3, you will have to restart it so it can detect the physical wireless connection.

  1. Start GNS3 and start a new project or use an existing one
  2. Select All Devices on the left, then drag a cloud into the environment. Remember, the cloud is representing a physical connection to the hardware on the system.  To remember this, it is a good idea to draw a box and place the cloud on the edge so it looks as if it is bridging the physical and virtual space
    Figure 3 - add a cloud and use a square to define the environment
    Figure 3 – add a cloud and use a square to define the environment
  3.  Create a very basic network using a server, a switch, and a VPCS
    1. Configure the server to offer DHCP.  We will use the 192.168.20.0/24 address space
    2. We threw a couple of VPCs and an unmanaged switch to serve as a basic network
    3. DO NOT CONNECT the devices to the cloud
    4. Test to make sure DHCP is working
      Figure 4 - add devices of a simple network
      Figure 4 – add devices of a simple network
  4. Right-Click on the cloud and click on configure
    Figure 5 - configure the cloud
    Figure 5 – configure the cloud
  5. Open the UDP Tunnels tab and make the following settings
    1. Name: To RED Network
    2. Local Port: 30000 (other PC will be 20000)
    3. Remote Host: <the physical wireless IP of the OTHER PC) 10.0.0.12
    4. Remote Port: 20000 (other PC will be 30000)
    5. Click Add to create the UDP tunnel
    6. Click on Apply, then OK
      Figure 6 - Create UDP connection
      Figure 6 – Create UDP connection

Connect the switch to the Cloud and select the port “To RED Network” that we created earlier. This is what connects GNS3 to the physical world

Figure 7 - Connect to cloud
Figure 7 – Connect to cloud

PHASE III – PC RED (Attacker)

Configure GNS3 on the physical PC identified as PC RED to connect to another GNS3 environment. Repeat the process we performed for the BLUE PC, but MIRROR the settings

  1. Name: To RED Network
  2. Local Port: 20000 (other PC is already 30000)
  3. Remote Host: <the physical wireless IP of the OTHER PC> 10.0.0.13
  4. Remote Port: 30000 (other PC is already 20000)
  5. Click Add to create the UDP tunnel
  6. Click on Apply, then OK
  7. On the BLUE physical PC, navigate to GNS3, start a VPCS, and set its IP address to 192.168.1.1/24

    ip 192.168.1.1/24

  8. On the RED  physical PC, navigate to GNS3, start a VPCS, and set its IP address to 192.168.1.2/24

    ip 192.168.1.2/24

  9. Try to ping each other and verify they can communicate over the UDP tunnel

Phase IV – Offer DHCP service to both environments

You can now eliminate the static IP addresses and use a DHCP relay to offer IP addresses to the different GNS3 environments
  1. We added a DHCP server and MikroTik router relay to our GNS3 environment running on our physical BLUE PC. The DHCP offers DORA responses depending on where the responses come from
    1. 192.168.20.254 is the DHCP server IP address
    2. 192.168.30.0/24 is the GNS3 Blue network running on the physical BLUE PC
    3. 192.168.40.0/24 is the GNS3 Red network running on the physical RED PC
      Figure 8 - DHCP enabled
      Figure 8 – DHCP enabled
    4. We can see that our GNS3 environment on the physical RED PC is receiving DHCP DORA messages from the DHCP server in the GNS3 network running on the physical BLUE PC
      Figure 9 - Red PC
      Figure 9 – Red PC

End of Lab

Feedback email
Figure 00 – Contact us via prmaster@erau.edu

License

Icon for the Creative Commons Attribution-NonCommercial 4.0 International License

Mastering Enterprise Networks (3rd Ed) Copyright © 2026 by Mathew J. Heath Van Horn is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License, except where otherwise noted.