Enabling GNS3 to talk to it’s host and beyond

I’m currently working my way through a CCNA text book and reached a point where I need to be able perform some tasks which rely on connecting the virtual network environment inside of GNS3 to the host machine, for the purpose of connecting to a tftp service (just in case you were curious).

After a little googling it became apparent that this is indeed possible, though most of the guides focused on using GNS3 on a Windows machine. Where as I, am very much a Linux guy.

So as a reminder to myself but also as a helpful reference for others here is what I had to do on my Fedora 22 machine

The first way was using standard tools in Linux, the second I made sure I was able to create the same setup using Network Manager (again to make sure that I am utilising the latest tools for the job).

Standard method (from the command line)

[bash]$ sudo dnf install tunctl
$ tunctl -t tap0 -u toby
$ ifconfig tap0 netmask up
$ firewall-cmd –zone=FedoraWorkstation –add-interface=tap0 –permanent[/bash]


Using Network Manager (from the command line)

[bash]$ sudo ip tuntap add dev tap1 mode tap user toby
$ sudo ip addr add dev tap1
$ sudo ip link set tap1 up
$ sudo firewall-cmd –zone=FedoraWorkstation –add-interface=tap1
$ sudo ip addr show tap1
11: tap1: <broadcast,multicast,up,lower_up> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 26:2b:e4:a0:54:ba brd ff:ff:ff:ff:ff:ff
inet scope global tap1
valid_lft forever preferred_lft forever
inet6 fe80::242b:e4ff:fea0:54ba/64 scope link
valid_lft forever preferred_lft forever

Configuring the interface on the Cisco router inside of GNS3

[text]router1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
router1(config)#int f0/0
router1(config-if)#ip address
router1(config-if)#no shut
router1>write mem

The bit of config inside GNS3

I nearly forgot to write this section.  Doh!  Anyway, it’s lucky for everyone that I remember, so without any further padding… seriously, no more padding… the config in GNS3…

Select Cloud from the side panel in GNS3.

Next we need to configure the cloud… (hint.  right click the cloud and select configure).

Select TAP and then type in the name of the tap device created, in my case tap1.

The final step is to draw the virtual connection between the cloud and the router (making sure to map it to the correct interface).

At this point we should be in a happy place.

Proof that it works

[text]# ping -c 5
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=0.103 ms
64 bytes from icmp_seq=2 ttl=64 time=0.096 ms
64 bytes from icmp_seq=3 ttl=64 time=0.050 ms
64 bytes from icmp_seq=4 ttl=64 time=0.058 ms
64 bytes from icmp_seq=5 ttl=64 time=0.103 ms

— ping statistics —
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.050/0.082/0.103/0.023 ms
# ping -c 5
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=255 time=9.16 ms
64 bytes from icmp_seq=2 ttl=255 time=5.64 ms
64 bytes from icmp_seq=3 ttl=255 time=11.2 ms
64 bytes from icmp_seq=4 ttl=255 time=7.29 ms
64 bytes from icmp_seq=5 ttl=255 time=2.98 ms

— ping statistics —
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 2.980/7.266/11.253/2.847 ms


Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to, timeout is 2 seconds:
Success rate is 80 percent (4/5), round-trip min/avg/max = 4/9/12 ms

I do believe that about covers.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.