
Network simulation with GNS3
Sand Castles
Building an IT infrastructure can seem as precarious as a sand castle on the beach: The desired design is already on the drawing board, and the required components, wiring, and so forth are defined; however, can the plans be implemented with the available means and options, or will unforeseeable problems still lurking in the background, a sudden virtual wave, threaten to take out the beautiful structure in an instant?
Network simulators can help you design the desired network on the virtual drawing board and develop network infrastructures, offering several advantages:
- You can design the environment to match your ideas.
- The design can be tested virtually at no great expense before implementation; also, you don't have to implement and maintain a real test network, and no risk is involved.
- Routers can be rolled out with just a few mouse clicks. You can even build a complex network topology with manageable overhead.
- Modeling traffic patterns is easy.
GNS3 Emulator
Although the GNS3 network emulator [1] focuses on Cisco devices, it supports devices from 20 manufacturers. From the graphical user interface (GUI), you simply point and click to put together the desired network architecture and establish and configure connections. From the integrated console, you can adjust all the critical device parameters. GNS3 also integrates analysis tools such as Wireshark, which makes it easy to put a connection through its paces.
Administrators are typically familiar with the virtualization techniques GNS3 uses to emulate the Cisco Internetwork Operating System (IOS), which you can run on macOS, Linux, and Windows systems. GNS3 is a graphical front end for the DynaGen controller, which in turn is a text-based front end designed to reduce the complexity of operating the Dynamips emulator computer program. Thus, GNS3 acts as a graphical front end for a text-based front end.
Dynamips running in the background emulates the Cisco hardware; it does not simulate the whole router, only the hardware. In practical terms, this means you need a suitable IOS for Dynamips. If you do not have Cisco images, you can purchase them from Cisco for approximately $200 under the Virtual Internet Routing Lab (VIRL) license and work with those images.
In principle, GNS3 comprises two software components: GNS3 All in One is the client and GUI you use to create network topologies. During this process, you need to create network devices and host them on the server process. In principle, the server component can be executed as a local virtual machine (VM) and as a remote VM. The GNS3 VM, which is based on either VirtualBox or VMware, is recommended. In principle, it is also possible to proceed without a VM, but at the expense of the GUI: The topology is limited in terms of size and supported devices.
GNS3 supports both emulated and simulated devices. In practice, this means you could run a copy of a physical Cisco IOS router on a virtual, emulated Cisco router. GNS3 simulates router functions such as switch functionality. In practice, you do not run two operating systems in parallel; instead, IOS runs on a GNS3 switch.
Because the boundaries between emulation and simulation are becoming increasingly blurred, it is useful to know where they run when using GNS3. For example, if you are working with Cisco's VIRLs, GNS3 emulates the hardware running the VIRL image. Dynamips is responsible for emulating the Cisco hardware. The GNS3 developers recommend the use of VIRL images for better scalability and user experience.
GNS3 can look back on a considerable history: It has been under development for more than 10 years (see the "Alternative Network Simulators" box). The developers have also eliminated one criticism that was frequently voiced in the past: the lack of documentation, which now actually deserves that appellation.
Putting GNS3 into Operation
The GNS3 team provides macOS, Linux, and Windows installation packages for download on the project website. Installing them takes just a few mouse clicks. In particular, you can define the tools to be installed, such as Wireshark, Qemu, the TightVNC viewer, and so on. The workstation must have an existing Internet connection, because various tools (e.g., Wireshark) are only downloaded at setup time.
If you use GNS3 on macOS or Windows, the developers advise you to use the GNS3 VM; you have the choice between a VMware or VirtualBox VM. For performance reasons, the GNS3 developers recommend VMware. Before you can use the VM in the simulation environment, open it within the respective VM environment, and then start GNS3. The program comes up with the setup wizard. If you decide to use a different setup after the GUI installation, start the wizard with the GNS3 Help | Setup Wizard menu command.
In the wizard, select the Local GNS3 VM option in the first dialog. Press Next to move on, and select the server type; again, you will want the Local GNS3 VM option. The next step is to select the virtualization environment. Define the VM, the number of virtual CPU cores, and the available memory for the VM type you want. GNS3 requires at least one virtual CPU and 2GB of RAM. If the GNS3 VM does not appear in the VM Name selection menu, press the Refresh button. If the VM still does not appear, it might not have been imported correctly. Pressing Next starts the VM. To set up the first virtual router, select the Add an IOS Router using a real IOS Image option. As the option says, you need a corresponding original image. Click Finish to complete the first configuration step.
The setup wizard opens the virtual router configuration. In the first step, you decide whether to run the router on the VM or on the local system. The next dialog lets you select the IOS image. GNS3 also can decompress the image to allow fast booting – confirm this. You can upload either the compressed or decompressed image to the GNS3 VM. After the upload, assign a name and a router platform to the image. The setup wizard gets this information directly from the image, so no adjustments are needed, in most cases. In the next step, 128MB of RAM are provided by default for the Cisco operating system. The wizard opens the Cisco Image Navigator in the standard browser to keep you from leaving out the settings here. The corresponding web form offers the option of retrieving the manufacturer's minimum and recommended settings. A sensible choice is to accept the recommended values.
The subsequent dialog lets you configure the network adapters and the WAN interface card (WIC) modules. These settings are device dependent and determined by GNS3 according to the image selected. The Idle PC dialog follows in the next step. This setting is important to specify to keep IOS from consuming all the virtual processor power. The input field must be highlighted in green. If this is not the case, leave the search for the desired value to the wizard by clicking Idle PC Finder. Once GNS3 has finished this step, press Finish to complete the configuration. The simulation program automatically opens the program settings with the router settings. Press OK to confirm and complete the initial configuration. One last step is waiting for you: GNS3 automatically opens the New Project dialog, in which you can then create your first project.
Simulating an Initial Topology
Once you have created your first project, you can start creating a topology. A simple example connecting two virtual end devices shows the typical work approach. In the left sidebar, you will find the Devices toolbar, which you can use to create the network architecture: Just drag and drop to deposit the desired components on the workspace. Click on the monitor icon to display the VPCS nodes – this category includes Cloud, Host, and VPCS elements – then place the two VPCS components on the workspace.
The connection between the two systems can be established by clicking Add a Link. Select an available interface, such as an Ethernet connection. To activate the interfaces, switch on the virtual power supply by clicking the Start/Resume button. The Ethernet nodes are now highlighted in green instead of red (deactivated mode). In the right GNS3 dialog area, you will find the components you created below Topology Summary.
Next, you can start configuring the interfaces. To do this, open the console by clicking on the corresponding icon. GNS3 opens a console connection to all components in a separate console window. Now you can configure the interface in the usual way, such as:
PC1> ip 10.1.1.1 255.255.255.0 10.1.1.254 PC2> ip 10.1.1.2 255.255.255.0 10.1.1.254
You will then want to determine whether the PC2 system can be pinged successfully from PC1. If you receive a success message, you can save the configuration with the PC1 | Save command. You need to complete the configuration on each individual device (i.e., separately on each console). Unfortunately, GNS3 does not offer the option of saving all devices at once.
Connecting to the Outside World
Dynamips lets you connect virtual routers to physical network interfaces, so GNS3 can also connect virtual networks to physical hosts. The procedure differs fundamentally depending on whether you are working with a GNS3 VM or with a local server installation; it is far easier with the VM.
For the GNS3 VM, you need the Internet appliance from the Appliance category of the GNS3 Marketplace. The exact name is Internet for GNS3 VM, and it comes from the GNS3 development team. If the associated template is not available from the Marketplace, you can alternatively get it online [6].
A good idea is to create your own project for this module and then import the module into GNS3 with the File | Import Appliance menu command. After selecting the import file, GNS3 presents the Add Appliance dialog, which lists important appliance-specific data, such as the category (Router), the name (Internet), the manufacturer (GNS3), and the architecture (i386).
In the following steps, you will again be accompanied by a wizard, which now wants to know whether you want to use the VM or another server type. After selecting VM, determine the image file available on the VM. You have to agree explicitly to its installation. After the installation, the Internet router is available from the toolbar in the Devices category. In the next step, drag the Internet device into the workspace. You will also need two routers, which are automatically labeled R1 and R2 by GNS3 (Figure 1). Use the Link function to establish a connection between the two routers and one between the Internet device and R1 (Figure 2).


Log into the Internet appliance at the console by entering gns3 as the username and password. You can now use ping
to check the accessibility of an external system from the console. If the configuration is correct, ping can query the desired system. In principle, you can also configure the virtual routers to use an IP address from your provider's DHCP server.
Individual Adaptations
GNS3 provides various customization options. For example, you can completely dispense with the GUI for configuration and administration by editing the configuration files gns3_server.conf
(macOS and Linux) or gns3_server.ini
(Windows). For example, in the text-based configuration file, you can change the server's IP address and port, the paths to the images, the project files, and the console access port. You can also adjust the paths to VMware and VirtualBox.
In practice, you can work with different server and VM configurations because of the classic separation between the GNS3 client and server. The simulation environment provides the profile function for this, which you first need to activate. Open the program settings with Edit | Preferences and switch to the Miscellaneous tab. When you get there, enable the Request for Profile Settings at Application Startup option, and then restart the system. The next time you start the program, GNS3 will show you the Profile Selection dialog. In addition to the standard profile, you can create a new profile by selecting New.
The scalability of GNS3 also speaks in favor of its use. By design, GNS3 is not subject to any restrictions regarding the number of nodes that the program can execute. The limit is set solely by the hardware used. If the locally available system does not have sufficient resources, you can simply run GNS3 in a cloud. This is especially easy if you set up GNS3 on a remote server with Ubuntu 16.04 LTS. In this case, you execute the following commands as root:
# cd /tmp # curl https://raw.githubusercontent.com/GNS3/gns3-server/master/scripts/remote-install.sh > gns3-remote-install.sh # bash gns3-remote-install.sh --with-openvpn --with-iou --with-i386-repository
The required packages and a VPN environment are set up for secure access to the remote system. To use the remote server, you only need to configure the GNS3 client for interaction. Remote access can be set up with the Setup Wizard, where you select the option Run Everything on a Remote Server and define the IP address, access protocol, port, and user data. However, that's not all: If one server is not enough, you can also use several servers and thus distribute the load. To do this, create additional servers under Server in the Preferences dialog. When creating new router configurations, you then assign the desired remote servers to them. Another special feature lets you export your network configurations to a ZIP archive and share them with third parties.
Conclusions
GNS3 is an excellent program for simulating Cisco-based networks. You have access to all the important configuration options and analysis tools that are usually required. However, this strength is also its weakness. You have to provide the Cisco images yourself, because the program does not offer integrated IOS images, limiting the range of application considerably. For those who are preparing for their Cisco exams, however, GNS3 is the tool of choice.