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)
$ sudo dnf install tunctl $ tunctl -t tap0 -u toby $ ifconfig tap0 10.0.1.10 netmask 255.255.255.0 up $ firewall-cmd --zone=FedoraWorkstation --add-interface=tap0 --permanent
Using Network Manager (from the command line)
$ sudo ip tuntap add dev tap1 mode tap user toby $ sudo ip addr add 10.0.0.10/255.255.255.0 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 10.0.0.10/24 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
router1#conf t Enter configuration commands, one per line. End with CNTL/Z. router1(config)#int f0/0 router1(config-if)#ip address 10.0.0.1 255.255.255.0 router1(config-if)#no shut router1(config) 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…
Next we need to configure the cloud… (hint. right click the cloud and select configure).
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
# ping -c 5 10.0.0.10 PING 10.0.0.10 (10.0.0.10) 56(84) bytes of data. 64 bytes from 10.0.0.10: icmp_seq=1 ttl=64 time=0.103 ms 64 bytes from 10.0.0.10: icmp_seq=2 ttl=64 time=0.096 ms 64 bytes from 10.0.0.10: icmp_seq=3 ttl=64 time=0.050 ms 64 bytes from 10.0.0.10: icmp_seq=4 ttl=64 time=0.058 ms 64 bytes from 10.0.0.10: icmp_seq=5 ttl=64 time=0.103 ms --- 10.0.0.10 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 10.0.0.1 PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=255 time=9.16 ms 64 bytes from 10.0.0.1: icmp_seq=2 ttl=255 time=5.64 ms 64 bytes from 10.0.0.1: icmp_seq=3 ttl=255 time=11.2 ms 64 bytes from 10.0.0.1: icmp_seq=4 ttl=255 time=7.29 ms 64 bytes from 10.0.0.1: icmp_seq=5 ttl=255 time=2.98 ms --- 10.0.0.1 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 router1#ping 10.0.0.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.0.10, 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.