Connecting GNS3 simulator to the Internet (part 2)

So now we need to configure a cloud to connect GNS3 to the laptop. We should already have tap0 up and running and IPtables configured to allow traffic as seen on the previous post.

Below is a network topology diagram.


GNS3 topology

We need to create the cloud connecting it to tap0 interface. For that we edit the .net file containing the topology and add the following.


[[ROUTER R2]]
model = 3640
console = 2002
aux = 2108
cnfg = configs/R2.cfg
slot0 = NM-1FE-TX
f0/0 = nio_tap:tap0
slot1 = NM-4T
s1/0 = R3 s1/0
slot2 = NM-1E
e2/0 = R1 f2/0
slot3 = NM-16ESW
x = -21.0
y = -61.0

and for the cloud

[[Cloud C2]]
x = -63.8566172588
y = 84.919044975
connections = R2:f0/0:nio_tap:tap0

Now save the configuration and restart GNS3.

Now there should be connectivity to the gateway (192.168.1.1). To connect to the internet add a default gateway.

Router2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#ip rou
Router2(config)#ip route
Router2(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1
Router2(config)#do sh ip route
Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
ia – IS-IS inter area, * – candidate default, U – per-user static route
o – ODR, P – periodic downloaded static route

Gateway of last resort is 192.168.1.1 to network 0.0.0.0

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.0.0/30 is directly connected, Ethernet2/0
D 172.16.0.0/16 is a summary, 00:18:32, Null0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.0.0.0/30 is directly connected, Serial1/0
D 10.0.0.0/8 is a summary, 00:18:32, Null0
192.168.1.0/30 is subnetted, 1 subnets
C 192.168.1.0 is directly connected, FastEthernet0/0
S* 0.0.0.0/0 [1/0] via 192.168.1.1
Router2(config)#

We can see the connectivity below.

Connectivity to the internet

Also don’t forget to add the routes on your Linux box for the other routers.

[11:07:13] xavi@lstkco14073: ~ $ sudo ip route add 172.16.0.0/30 dev tap0
[11:07:49] xavi@lstkco14073: ~ $ sudo ip route add 10.0.0.0/30 dev tap0
[11:08:13] xavi@lstkco14073: ~ $ netstat -nr | grep tap
10.0.0.0 0.0.0.0 255.255.255.252 U 0 0 0 tap0
172.16.0.0 0.0.0.0 255.255.255.252 U 0 0 0 tap0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 tap0
[11:08:21] xavi@lstkco14073: ~ $ ping -c 3 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_req=1 ttl=255 time=19.9 ms
64 bytes from 10.0.0.1: icmp_req=2 ttl=255 time=3.12 ms
64 bytes from 10.0.0.1: icmp_req=3 ttl=255 time=6.61 ms

— 10.0.0.1 ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 3.122/9.878/19.901/7.229 ms
[11:08:39] xavi@lstkco14073: ~ $

That would be all. Comments and suggestions are more than welcome. 🙂

Leave a Reply