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<br /> $ tunctl -t tap0 -u toby<br /> $ ifconfig tap0 10.0.1.10 netmask 255.255.255.0 up<br /> $ 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<br /> $ sudo ip addr add 10.0.0.10/255.255.255.0 dev tap1<br /> $ sudo ip link set tap1 up<br /> $ sudo firewall-cmd --zone=FedoraWorkstation --add-interface=tap1<br /> $ sudo ip addr show tap1<br /> 11: tap1: <broadcast,multicast,up,lower_up> mtu 1500 qdisc fq_codel state UP group default qlen 500<br /> link/ether 26:2b:e4:a0:54:ba brd ff:ff:ff:ff:ff:ff<br /> inet 10.0.0.10/24 scope global tap1<br /> valid_lft forever preferred_lft forever<br /> inet6 fe80::242b:e4ff:fea0:54ba/64 scope link<br /> valid_lft forever preferred_lft forever<br />
Configuring the interface on the Cisco router inside of GNS3
router1#conf t<br /> Enter configuration commands, one per line. End with CNTL/Z.<br /> router1(config)#int f0/0<br /> router1(config-if)#ip address 10.0.0.1 255.255.255.0<br /> router1(config-if)#no shut<br /> router1(config)<br /> router1>write mem<br />
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<br /> PING 10.0.0.10 (10.0.0.10) 56(84) bytes of data.<br /> 64 bytes from 10.0.0.10: icmp_seq=1 ttl=64 time=0.103 ms<br /> 64 bytes from 10.0.0.10: icmp_seq=2 ttl=64 time=0.096 ms<br /> 64 bytes from 10.0.0.10: icmp_seq=3 ttl=64 time=0.050 ms<br /> 64 bytes from 10.0.0.10: icmp_seq=4 ttl=64 time=0.058 ms<br /> 64 bytes from 10.0.0.10: icmp_seq=5 ttl=64 time=0.103 ms</p> <p>--- 10.0.0.10 ping statistics ---<br /> 5 packets transmitted, 5 received, 0% packet loss, time 3999ms<br /> rtt min/avg/max/mdev = 0.050/0.082/0.103/0.023 ms<br /> # ping -c 5 10.0.0.1<br /> PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.<br /> 64 bytes from 10.0.0.1: icmp_seq=1 ttl=255 time=9.16 ms<br /> 64 bytes from 10.0.0.1: icmp_seq=2 ttl=255 time=5.64 ms<br /> 64 bytes from 10.0.0.1: icmp_seq=3 ttl=255 time=11.2 ms<br /> 64 bytes from 10.0.0.1: icmp_seq=4 ttl=255 time=7.29 ms<br /> 64 bytes from 10.0.0.1: icmp_seq=5 ttl=255 time=2.98 ms</p> <p>--- 10.0.0.1 ping statistics ---<br /> 5 packets transmitted, 5 received, 0% packet loss, time 4005ms<br /> rtt min/avg/max/mdev = 2.980/7.266/11.253/2.847 ms</p> <p>router1#ping 10.0.0.10</p> <p>Type escape sequence to abort.<br /> Sending 5, 100-byte ICMP Echos to 10.0.0.10, timeout is 2 seconds:<br /> .!!!!<br /> Success rate is 80 percent (4/5), round-trip min/avg/max = 4/9/12 ms<br />
I do believe that about covers.