Graphical Network Simulator (GNS3) allows you to simulate a network on your computer.
From the webpage:
- GNS3 is an open source software that simulate complex networks while being as close as possible to the way real networks perform. All of this without having dedicated network hardware such as routers and switches.
TheAUR and AUR packages are needed to run the GNS3 GUI. The AUR package are needed to simulate Cisco routers.
gns3-server@USERservice, where USER is the username for the user-level account on which GNS3 will be run.
libvirt can be used to create the end devices "Cloud" (providing a virtual wan interfaces, isolating the tested network to the other devices in the main network) and NAT. To make libvirt work correctly, GNS3 needs dnsmasq and AUR. Install them and ensure the libvirtd daemon is running before using GNS3 with Cloud and NAT end devices.
Adding virtual machines
To use VirtualBox machines for your topology, you need to install and . To avoid any problems with GNS3 not finding VirtualBox, it is recommended to install VirtualBox AFTER you install GNS3. If you already have VirtualBox installed, you should be able to just reinstall it.
If you do not install the
vboxapi.py script, and GNS3's
vboxwrapper.py needs this to connect the virtual machines.
Adding the GNS3 virtual machine to VirtualBox
The official GNS3 virtual machine should be used to increase performance. Go to GNS3 Github and download the VirtualBox version of the GNS3 virtual machine with the exact same version number as your GNS3 version. Unzip and import the virtual machine in VirtualBox.
To create a network connection between the GNS3 virtual machine and the host OS, a host-only network must be configured. In File > Host Network Manager, set up a host-only network. In most cases, it will be called
vboxnet0 or similar. Note the IP address dedicated to the interface in the GUI. For some reason, VirtualBox does not assign the IP to the interface, nor does it enable it. Therefore, this must be performed manually in the terminal. See Network configuration#Routing table for more information on assigning IP addresses.
# ip addr add IP_address/subnet_mask dev vboxnet0 # ip link set dev vboxnet0 up
Launch the GNS3 startup wizard, select the GNS3 virtual machine, and it should be able to start the virtual machine.
Adding virtual machines to GNS3
When the connection between GNS3 and VirtualBox have been made, you need to tell GNS3 which virtual machines it should see and be able to use.
- In GNS3, click on Preferences > VirtualBox. Check that the path to vboxwrapper.py (should be
/usr/share/gns3/vboxwrapper.pyand is set per default) is correct (if you get an OK when pressing the Test Settings button, it works, otherwise see the installation step).
- Go to the VirtualBox Guest tab to add the VirtualBox virtual machines in GNS3. Choose an identifier name, a virtual machine from the virtual machine list (you may have to refresh the list using the provided button). To avoid confusion and possible errors, it is recommended to use the same identifier name as the name of the virtual machine. When a virtual machine is selected, you can choose other options for it as well:
- Number of NICs is the number of network interface cards you will see inside your virtual machine (e.g. ifconfig on Linux, if you have 4 NICs on your virtual machine, then set it to 4 in GNS3, and if you have 1 NIC, then set it to 1 in GNS3).
- Reserve first NIC for VirtualBox NAT to host OS is to you have your first network interface card (e.g. eth0 on Linux) configured with network address translation (NAT), allowing your virtual machine to access your host network and Internet (if your host can access it of course).
- Enable console support to activate a serial console access to your virtual machine. Please note that serial console support must also be configured on the operating system running in your VirtualBox guest for this feature to work. Here is a howto for Debian/Ubuntu Linux.
- Enable console server (for remote access) is to remotely access to your virtual machine serial console. GNS3 creates a mini Telnet server that act as a proxy between the serial console and Telnet clients. This feature requires the Enable console support to be enabled.
- Start in headless mode (without GUI) will hide the VirtualBox graphical interface when the virtual machine is started. This option is mostly useful if you have configured the previously described console support.
Adding virtual machines to your topology
After you have told GNS3 which virtual machines it should be able to see, you can drag and drop them in your topology. Simply select the computer-icon in the left sidebar. You can now choose VirtualBox guest. Drag this to where you want to add your virtual machine in your topology. When you drop it in, you will be prompted about which virtual machine to add. Select the one you want and click OK. You should now be able to boot the virtual machine from GNS3 with a right click then Start.
To use VMware in GNS3, you need to create a cloud in your GNS3 topology, and then in your VMware machine, connect it to the NIC of the cloud in your topology.
Instructions taken (and ported) from GNS3 forums:
- Select network adapter "Host only" to your Virtual machine in Vmware
- Check how this network adapter (
vmnet1) is named (ifconfig should list it).
- Add a cloud to your workspace in GNS3.
- Configure the cloud and select the network adapter you just looked up.
- Right Click on the cloud and select Configure.
- Select the C0 on the cloud.
- Select NIO Ethernet.
- Select Generic Ethernet NIO.
- Select the appropriate adapter from the drop-down menu and press the Add button.
- The adapter for your virtual machine should now be added to the cloud.
- Connect cloud to your topology, for example to a router.
- Adding IP addresses (in the same subnet) to the Virtual machine and the emulated router in GNS3.
- Ping between router and virtual machine should now be successful, otherwise, try to redo the steps.
When devices have been added to your topology, you will need to connect them. Select the link-icon (the bottom icon in the left sidebar, which looks sort of like a mouse or Ethernet port with an RJ45 connector), click on a device (like a switch). Next, click on the device (like a virtual machine) you want to connect to the switch. You will be prompted to select the NIC which should be used. When you have created all the links you want, click the link-icon in the left sidebar to deselect it, otherwise GNS3 will still be in 'create link'-mode.
VPCS is a simple virtual PC simulator, supported by GNS3 and useful to enhance the simulation of a full working network topology. To use it, installAUR.
Wireshark packet capture
Wireshark can be used with GNS3 to "sniff" packets from the links between devices of a virtual topology. Install it and create a symbolic link under
$ ln -s /usr/bin/wireshark ~/GNS3/wireshark/
GNS3 virtual machine is not on the same network as the local server
The following warning may be encountered:
The GNS3 VM (IP 192.168.56.101, NETWORK 192.168.56.0/24) is not on the same network as the local server (IP 127.0.0.1, NETWORK 127.0.0.0/8), please make sure the local server binding is in the same network as the GNS3 VM
To fix this, go to the Edit > Preferences > Server > Host Binding drop-down menu, and change the binding of the local server to whichever IP address (sub-net and mask) matches the IP address listed on the Information screen in the GNS3 virtual machine. See https://gns3.com/initiatives/gns3-vm-is-not-on-the-same-netwo.
virbr0 does not exist, please install libvirt
virbr0 does not exist, that means the default network has not been started through libvirt, and you will not be able to setup a NAT in GNS3.
To temporarily start the default network, use virsh:
# virsh net-start default
And to auto-start it on reboot:
# virsh net-autostart default