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.
- You will need a wireless router and 2 PCs with WiFi capability
- The two PCs are going to be called BLUE and RED
- We are using Ubuntu 26.04.1 LTS for this example
- 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 - 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
- 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 - Record your wireless IP address. You will need it later
- 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.
- Start GNS3 and start a new project or use an existing one
- 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 - Create a very basic network using a server, a switch, and a VPCS
- Configure the server to offer DHCP. We will use the 192.168.20.0/24 address space
- We threw a couple of VPCs and an unmanaged switch to serve as a basic network
- DO NOT CONNECT the devices to the cloud
- Test to make sure DHCP is working

Figure 4 – add devices of a simple network
- Right-Click on the cloud and click on configure

Figure 5 – configure the cloud - Open the UDP Tunnels tab and make the following settings
- Name: To RED Network
- Local Port: 30000 (other PC will be 20000)
- Remote Host: <the physical wireless IP of the OTHER PC) 10.0.0.12
- Remote Port: 20000 (other PC will be 30000)
- Click Add to create the UDP tunnel
- Click on Apply, then OK

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

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
- Name: To RED Network
- Local Port: 20000 (other PC is already 30000)
- Remote Host: <the physical wireless IP of the OTHER PC> 10.0.0.13
- Remote Port: 30000 (other PC is already 20000)
- Click Add to create the UDP tunnel
- Click on Apply, then OK
- 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
- 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
- Try to ping each other and verify they can communicate over the UDP tunnel
Phase IV – Offer DHCP service to both environments
- 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
- 192.168.20.254 is the DHCP server IP address
- 192.168.30.0/24 is the GNS3 Blue network running on the physical BLUE PC
- 192.168.40.0/24 is the GNS3 Red network running on the physical RED PC

Figure 8 – DHCP enabled - 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
End of Lab
