Lead Image © Joseasreyes, 123RF.com

Lead Image © Joseasreyes, 123RF.com

Network simulation with GNS3

Sand Castles

Article from ADMIN 50/2019
The GNS3 network simulator is a convenient open source tool for the design and simulation of Cisco-based networks.

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.

Alternative Network Simulators

Historically, network simulators and emulators have been lacking, and the line between the two is not always easy to draw. Which solution is the most suitable depends in particular on the area of application.

Common Open Research Emulator (CORE) [2] takes advantage of the namespace functionality of Linux containers. Project maintainer Eriberto Mota regards the environment as a "Network lab in a box," which delivers great effectiveness and scalability. A GUI is available for network development; CORE supports static and mobile networks.

Marionnet [3], according to its developers, is a virtual network laboratory. The Linux-based environment supports definition, configuration, and deployment on complex networks. A user-friendly GUI is available for macOS and Windows users. Special features include dynamic reconfiguration and the "gateway device," which can be used to connect a virtual network to a physical network.

NetSim 11 [4] (NetSim 12 has been released since this article was written) is a commercial solution especially for administrators seeking CCNET, CCNA, or CCNP certification. This graphical tool allows the use of 42 different router models and five different switch models. The high level of user comfort, however, is something for which the developers seek remuneration, with license fees between $99 and $349.

Cisco also sells its own commercial software in the form of Cisco Modeling Labs [5]. The decisive difference from other emulators is that real images of Cisco's IOS operating system are used. The simulator is available as a subscription model, with the cost calculated on the basis of the number of nodes and the term of use.

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
PC2> ip

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.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs

Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>


		<div class=