Getting the GNS3 to talk to the Internet

Table of Contents

Overview...... 3

To Do...... 3

What’s a TAP?...... 3

1. Within GNS, configure the TAP interface between GNS to the OS...... 4

2. Get, Install and Configure the TAP interface on the OS...... 6

Get and install tunctl software...... 6

On Ubuntu – the installation...... 6

Potential source for the tunctl solution on Windows...... 6

Potential source for tunctl for OSX...... 6

Configure the TAP on the OS...... 7

Configure the startup scripts in /etc/init.d such that the interface is present upon reboot...... 8

3. NTP...... 10

Configure ntp on GNS router r1...... 12

Install tftpd-hpa...... 13

Overview

We want our GNS environment to talk to the Internet and in this case to NTP servers.

The GNS 3 version is 1.5.2 and this works on 8.7 too.

To Do

1)Within GNS, configure the TAP interface between GNS to the OS

2)Get, install and configure the TAP interface in the OS

3)NTP: Install and configure on the OS

4)Milestone – let’s check connectivity

5)Configure NTP on the router in GNS

6)Confirm it is working

What’s a TAP?

Tun/tap interfaces are software-only interfaces, meaning that they exist only in the kernel and, unlike regular network interfaces, they have no physical hardware component (and so there's no physical "wire" connected to them).

TAP (namely network tap) simulates a link layer device and it operates with layer 2 packets like Ethernet frames. TUN is used with routing, while TAP is used for creating a network bridge.

1. Within GNS, configure the TAP interface between GNS to the OS

  1. Start up GNS
  2. Add a cloud
  3. Add a router
  1. Right mouse click the cloud, select the TAP tab, enter tap0, click add, Apply, Okay. Done.
  1. Connect a router interface to the cloud’s tap0 interface and start the router. Done.

  1. Configure f0/0 172.17.1.1/24 and lo0 1.1.1.1/32. The OS tap interface will be assigned 172.17.1.100/24

Done with Step 1

2. Get, Install and Configure the TAP interface on the OS

Get and install tunctl software

On Ubuntu – the installation

apt-get install uml-utilities

Potential source for the tunctl solution on Windows

Potential source for tunctl for OSX

Configure the TAP on the OS

  1. Create the user user

sudo tunctl -u user

  1. Give the tap0 an IP address that is on the connected router’s interface. See step 6 in section 1.

sudo ifconfig tap0 172.17.1.100 netmask 255.255.255.0 up

  1. Add the route between the OS and the router in GNS

sudo route add -host 172.17.1.100 dev tap0

?? I forget ...but this did not work for me

sudo echo 1 > /proc/sys/net/ipv4/ip_forward

  1. On the guest OS run ifconfig and you should see output similar to below

tap0 Link encap:Ethernet HWaddr 06:a2:29:cc:64:1a

inet addr:172.17.1.100 Bcast:172.17.1.255 Mask:255.255.255.0

inet6 addr: fe80::4a2:29ff:fecc:641a/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:500

RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Done

Configure the startup scripts in /etc/init.d such that the interface is present upon reboot

On the OS.

sudo su

cd /etc/init.d

---copy the following into your clipboard ------

#!/bin/sh

### BEGIN INIT INFO

# Provides: tunctltap0

# Required-Start: $remote_fs $syslog

# Required-Stop: $remote_fs $syslog

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: Start virtual tap0

# Description: Start virtual nic interface tap0 for GNS3WB

### END INIT INFO

case "$1" in

'start')

/usr/sbin/tunctl -u user (the user user has to exist)

/sbin/ifconfig tap0 172.17.1.100 netmask 255.255.255.0 up

/sbin/route add -host 172.17.1.100 dev tap0

;;

'stop')

# there is no stopping signal

;;

*)

esac

exit 0

------and cut here too ----

Touch tunctltap0 (or your choice for a file name but for this exercise tunctltap0)

vi tunctltap0

paste the clipboard into the file and wq

chmod 755 /etc/init.d/tunctltap0

update-rc.d tunctltap0 defaults

exit (end sudo su)

3. NTP: Install and configure NTP on the OS

For Mac OSX

For Linux.

sudo apt-get install ntp

My /etc/ntp.conf is below

----- cut here ---

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift

# Enable this if you want statistics to be logged.

#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats

filegen loopstats file loopstats type day enable

filegen peerstats file peerstats type day enable

filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board

# on 2011-02-08 (LP: #104525). See for

# more information.

server 198.60.73.8

server 64.250.229.100

server 131.107.13.100

server 216.228.192.69

# Use Ubuntu's ntp server as a fallback.

server ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for

# details. The web page <

# might also be helpful.

#

# Note that "restrict" applies to both servers and clients, so a configuration

# that might be intended to block requests from certain clients could also end

# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.

restrict -4 default kod notrap nomodify nopeer noquery

restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.

restrict 127.0.0.1

restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if

# cryptographically authenticated.

#restrict 192.168.123.0 mask 255.255.255.0 notrust

# If you want to provide time to your local subnet, change the next line.

# (Again, the address is an example only.)

#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the

# next lines. Please do this only if you trust everybody on the network!

#disable auth

#broadcastclient

---- and cut here too ----

4. Milestone – let’s check connectivity

The dark blue Terminal window is the OS with the route table, pings to GNS router and the nptd deamon running

The black window is the router pinging the OS TAP interface

There are two more configurations to do.

  1. On the OS add a route between the OS network to the GNS router's

sudo route add -net 172.17.1.0 netmask 255.255.255.0 gw 172.17.1.100

  1. On the GNS router add a static route to the 172.17.17.0/24 networks

R1(config) ip route 172.17.17.0 255.255.255.0 f0/0 permanent

Configure NTP on GNS Router R1

R1(config) ntp server 172.17.17.105 version 4

With GNS3 v1.5.2 the version 4 works.

Wireshark

Start up Wireshark to see the conversation between the cloud and router R1 and so you’ll know that the router is talking to the ntpd on the OS.

Done.


Install tftpd-hpa

Once you’re talking with your host OS you can also set up a FTP server.

sudo apt-get install tftpd-hpa

# /etc/default/tftpd-hpa

#TFTP_USERNAME="tftp"

#TFTP_DIRECTORY="/var/lib/tftpboot"

#TFTP_ADDRESS="[::]:69"

#TFTP_OPTIONS="--secure"

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/tftpboot"

TFTP_ADDRESS="0.0.0.0:69"

TFTP_OPTIONS="-s -c -l"

sudo mkdir /tftpboot

sudo chmod -R 777 /tftpboot

sudo chown -R nobody /tftpboot

sudo update-rc.d /etc/tftpd-hpa defaults

sudo service tftpd-hpa restart

On the router (using Putty and copied via ctrl-c)

r1#copy startup-config tftp: ?

<cr>

r1#copy startup-config tftp:

Address or name of remote host []? 172.17.17.20

Destination filename [r1-confg]?

!!

1498 bytes copied in 0.096 secs (15604 bytes/sec)

r1#

On the VM

nbh@ubuntu:~$ ls /tftpboot

r1-confg

nbh@ubuntu:~$

nbh@ubuntu:~$ ls /tftpboot

r1-confg

nbh@ubuntu:~$