How to connect GNS3 to the internet in MacOSX
Posted by Josh on Sat 27 Dec 2008Categories: Cisco , Cisco Routers , Dynamips , GNS3 , MAC - [35] Comments
Here at Blindhog.net, we have issued tutorials for connecting Windows or Linux to a physical network using gns3, but apparently, there is a little difference for MacOSX. I recently received an email from one of our readers, Ivan Pletenev. Ivan describes how to connect GNS3 to internet through wifi-interface in MacOSX. You will find his writeup below. Thanks Ivan!
To set up this connection we need to do 2 things:
- Connect MacOSX and GNS3 through loopback-interface
- Set up NAT in MacOSX
First of all, like blindhog.net says, we need to edit our GNS3 .net file. After that we will have something like this:
[localhost:3700]
workingdir = /Users/besch/tmp/gns3
[[3640]]
image = /Users/besch/Documents/Documentations/cisco/c3640-jk9o3s-mz.124-16a.bin
ram = 96
chassis = 3640
[[ROUTER R1]]
model = 3640
console = 2002
cnfg = /Users/besch/tmp/gns3/WLANRouter/R1.cfg
slot0 = NM-1FE-TX
f0/0 = nio_tap:/dev/tap0
[GNS3-DATA]
[[Cloud C0]]
connections = R1:f0/0:nio_tap:/dev/tap0
Now we need a loopback interface (tap0). Download and install tuntaposx program from http://tuntaposx.sourceforge.net/
After installing we can check that we have necessary devices by running ‘ls /dev’ command in the console window. If you have tap0..tap15 and tun0..tun15 in your listing, then everything is ok.
But we still don’t have the created tap interface. To create tap0 interface all we need is just open our GNS3-project. But it has to be opened with root privileges. Execute this command in the console:
sudo chown root:wheel /Applications/GNS3.app/Contents/Resources/dynamips-0.2.8-RC2-OSX-Leopard.intel.bin
Now we can open our project. Then we need to set up our new tap0 interface:
sudo ifconfig tap0 10.100.100.100 netmask 255.255.255.0
The last thing – setting up router’s interface in GNS3 and checking connection:
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#ip address 10.100.100.101 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#do ping 10.100.100.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.100.100.100, timeout is 2 seconds:
.!!!!
2 . Now let’s try to connect our R1 with internet. I remind you that we have an wireless connection (interface en1, ip 10.189.249.130). All what we need to do is to use NAT:
Lets check do we have IP Forwarding turned on?
sysctl net.inet.ip.fw.forwarding
If we’ve got 1 – it’s on, if 0 – then we have to turn it on:
sudo sysctl -w net.inet.ip.forwarding=1
The same thing for the firewall:
sysctl net.inet.ip.fw.enable
if we’ve got 0 – we need to turn it on:
sudo sysctl -w net.inet.ip.fw.enable=1
Now let’s run natd and add rule for firewall:
sudo natd -alias_address 10.189.249.130 -interface en1 -use_sockets -same_ports -unregistered_only -dynamic -clamp_mss
sudo ipfw add divert natd ip from any to any via en1
The last thing – setting up router’s gateway of last resort in GNS3 and checking connection:
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip route 0.0.0.0 0.0.0.0 10.100.100.100
R1(config)#do ping google.com
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 72.14.205.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 148/184/220 ms

December 27th, 2008 at 8:42 pm
nice post….
February 6th, 2009 at 4:31 am
Excellent tutorial. I’ve spend many hours trying to get GNS3 to talk to the internet but without success. Seems like the key is the IP forwarding and NAT.
Thanks.
March 3rd, 2009 at 10:19 pm
I had to also execute the following to get dynamips to run as root:
sudo chmod +s /Applications/GNS3.app/Contents/Resources/dynamips-0.2.8-RC2-OSX-Leopard.intel.bin
March 13th, 2009 at 7:44 pm
And backwards?
If i have the CUCM in my physical network i can’t reach the GNS network with this setup – right?
April 1st, 2009 at 8:13 pm
Hi Josh i am new to gns3, and I am looking for the linux Lab to this. please help
I run ubuntu
April 1st, 2009 at 9:11 pm
Hi Josh i am new to gns3, and I am looking for the linux Lab to do this. please help
I run ubuntu
April 22nd, 2009 at 5:44 pm
Hi I have a Macbook and when I tried to cread the tap0 using this command
sudo ifconfig tap0 10.100.100.100 netmask 255.255.255.0
but I get this message:
ifconfig: interface tap0 does not exist
can you help me please?
thank you
May 18th, 2009 at 7:10 pm
Cant seem to get this working.
What is supposed to happen after i enter the following command, it asks for password then nothing.
sudo chown root:wheel /Applications/GNS3.app/Contents/Resources/dynamips-0.2.8-RC2-OSX-Leopard.intel.bin
This command says ifconfig: interface tap0 does not exist
sudo ifconfig tap0 10.100.100.100 netmask 255.255.255.0
Thanks in advance.
May 27th, 2009 at 8:21 am
Giovanni, did you install tuntaposx?
Robert:
1. you need do sudo command to give the neccessary rights to dynamips-0.2.8-RC2-OSX-Leopard.intel.bin.
2. Again – did you install tuntaposx?
May 27th, 2009 at 8:22 am
Giovanni, did you install tuntaposx?
Robert:
1. you need to do sudo command to give the neccessary rights to dynamips-0.2.8-RC2-OSX-Leopard.intel.bin.
2. Again – did you install tuntaposx?
July 24th, 2009 at 2:46 pm
I am having the same issue. I did install tuntaposx and if I look in /dev i can see the tap0 – tapx files. I used the sudo command to give the necessary rights but I still get tap0 does not exist.
September 13th, 2009 at 11:07 pm
Hi all!
I need your help please:
I’m getting the following error: “ifconfig: interface tap0 does not exist”
Have you found how to fix this issue?
Thanks in advance
September 28th, 2009 at 1:27 pm
I am also having this issue. No “tun” entries are listed in /dev (I can only see tap0-15). I cannot bring up int tap0. Could this be related to the Cisco VPN client for Mac OS installed on my Mac?
October 4th, 2009 at 8:01 pm
Well, I have been trying to get the tap0 int to work for around 6 months now. I am not trying to get it to connect to the Internet, but to a 3560 switch so I can do some CCIE labs.
Until this post, it has never worked…I get the same results as everyone else, Giovanni, Robert, etc.
I made a .net file the same as above, then did ifconfig -l and did not see the tap0 int.
Then I started my .net file (not even using the sudo commands as above). After the gns3 .net file loaded – I saw a connection from C0 to R1 for the first time ever!!!
Then I did another ifconfig -l and there was the tap0 interface!!!
Hope this helps.
Marc
March 9th, 2010 at 6:32 pm
[...] blindhog.net » How to connect GNS3 to the internet in MacOSX (tags: ccna tuntaposx tun tap gns3 cisco mac osx macosx leopard networking emulator pemu simulator labs ccie ccnp dynamips dynagen) [...]
March 26th, 2010 at 1:45 am
hi, I was able to perform all the above steps. however, i am unable to ping from the gns3 router to the internet. i can only ping 10.100.100.100.
on my mac, i am unable to access the internet after issuing the natd command. i can ping 10.100.100.100 and .101 though.
any idea? thanks!
March 29th, 2010 at 11:18 am
I’m still having the:
I’m usign SnowLeopard 10.6.2
“ifconfig: interface tap0 does not exist”
Has anyone found a solution for that.
Thanks.
Ramón
April 5th, 2010 at 9:17 am
sudo ifconfig tap0 create up
sudo ifconfig tap0 x.x.x.x/x
April 11th, 2010 at 3:37 pm
[...] http://www.blindhog.net/how-to-connect-gns3-to-internet-in-macosx [...]
April 23rd, 2010 at 9:53 pm
No dice,
I’m unable to have tap0 up and when trying to make a manual connection from a f0/1 to nio_tap:tap0 GNS3 gives me the erro:
206-unable to create TAO NIO
Any ideas?
Thanks
April 24th, 2010 at 12:43 pm
thekerb,
I am not sure how it works with MacOSX, but in Linux, this means you need to run GNS3 as root.
In ubuntu, I use ‘sudo gns3′ from the cli or change the shortcut to ‘gksudo gns3′.
Maybe this will help.
Josh
May 24th, 2010 at 1:02 pm
Hello
((
I have been at it for days now and still cant get it to work
I need it cause i have to study for ccnp.
I see the tap0 when i do ls /dev but when i configure the ifconfig ip address it says tap0 does not exist.
Please help me
June 22nd, 2010 at 9:28 am
Problem:
sudo ifconfig tap0 10.100.100.100 netmask 255.255.255.0
ifconfig: interface tap0 does not exist
Ignore it move on and configure this in your .net file:
[[ROUTER R1]]
F0/0 = nio_tap:/dev/tap0
Start your GNS3
From your OSX terminal do a ifconfig -all
TAP0 should be there.
June 27th, 2010 at 1:16 am
Hi guys, as Robert mentioned, it seems that you need a software with sufficient privilege to bring up the tap interface before you can configure it with ifconfig. I was stuck, but now it is working. More details here:
http://etherealmind.com/installing-tun-tap-driver-on-leopard/
August 26th, 2010 at 12:34 pm
@adrian -@Robert and @Eric are right – I ran into the same issue and then realized that when Josh saids, “But we still don’t have the created tap interface. To create tap0 interface all we need is just open our GNS3-project.” What he is saying without going into detail is that you have to define the tap0 and have GNS running as “root”. To define the tap0 in GNS. See here how I did it: http://leecardona.com/pages/technology-12
October 25th, 2010 at 9:47 pm
hi, if we successfully configure the router (i.e. Router1) to connect to the internet in GNS3, then we have another router connected to Router1, can NAT work to give the other router an internet connection as well? Thanks!
November 7th, 2010 at 1:25 pm
Awesome posts, i’ve been looking for ways to run dynamips/gns3 on my mac.
November 14th, 2010 at 7:04 pm
Hey, great post, pitty i havent got it to work yet, i’ve been over these, times after times i dont know what i am doing wrong…. =/
So, what i did is i installed GNS3 and dynamips(installed dynagen and am using dynamips from /Application/Dynagen/) i had some troubles at beggining with dynamips, because it wasn’t inside GNS3 .dmg, dont know why, but now, i have it working alright, i have everything set up, and working, i installed tuntaposx correctly and i can see the tap0-15 tun0-15 when i ls /dev, so all seems ok, but when i try to open the .net with the confs you have it gives this error on dynamips:
netio_tap_create: unable to open TAP device dev/tap0 (No such file or directory)
in gns3:
206-unable to create TAO NIO
i am running dynamips and gns3 has root user, i dont know what else to do, but i think i will try to uninstall all and reinstall if i dont get any solution in next 2 days, cause i have alot to work on and i cant… =/ Ty all for atention. []
November 14th, 2010 at 7:06 pm
Forgot to put .net conf, here it is:
autostart = False
[127.0.0.1:7200]
workingdir = /Users/”usr”/Documents/GNS3/Projectos/SvM/Lab7/Lab7_working
udp = 10000
[[2621]]
image = /Applications/Dynagen/IOS/c2600-advipservicesk9-mz.124-19.bin
ram = 128
idlepc = 0x81fa91bc
sparsemem = True
ghostios = True
chassis = 2621
[[ROUTER R1]]
model = 2621
console = 2000
x = -107.0
y = -58.0
f0/0 = NIO_tap:dev/tap0
[GNS3-DATA]
configs = Lab7_configs
workdir = Lab7_working
[[Cloud C1]]
x = -360.5
y = -69.0
connections = R1:f0/0:NIO_tap:/dev/tap0
December 12th, 2010 at 9:46 pm
Those of you encountering 206 errors most likely made a mistake when specifying the TAP device. GNS3 only makes it more confusing, because when you create a generic Ethernet NIO, you can just specify the bare device name (e.g., “en0″), but when you create a TAP NIO, you must specify the full path to the TAP character device (e.g., “/dev/tap0″). In the configs posted above, people have made exactly this mistake – either the full path is omitted entirely (e.g., “tap0″) or it is entered incorrectly (e.g., “dev/tap0″ – note the missing leading “/”).
What I’d like to know, is how to bridge to the TAP interface from VMware Fusion. VMware Fusion will only allow me to bridge to the Ethernet (en0) and AirPort (en1) interfaces from the GUI, and I don’t know how to use any of the command line support tools installed alongside Fusion.
Best wishes,
Matthew
April 5th, 2011 at 9:11 am
I got this to come up… but I can ping from my computer to the virtual router, but not vice versa, firewall is turned off… has anyone else had this problem?
May 22nd, 2011 at 5:01 pm
For those that are having issues with 206 errors:
chmod 666 /dev/tap*
chmod 666 /dev/tun*
August 30th, 2011 at 8:37 am
You are a Freaking genius thanks a lot, i had months looking for these two commands!
a billion of time thanks!
September 24th, 2011 at 4:58 am
Hi guys,
After a lot troubleshooting i managed to partially make it work. Problem is that when i issue the
sudo sysctl -w net.inet.ip.forwarding=1
command i get the message:
net: class is not implemented
I am running the Lion OSX and i have no idea how to proceed. Any recommendations?
October 26th, 2011 at 5:18 am
Charles,
I did spend quite some time in getting GNS3 to work on Lion with Virtual Machines such as Parallels Desktop and VirtualBox.
The tuntap stuff gave me headache and also connecting my virtual network to the internet. It is working right now and I documented what I did.
Maybe this post can help you:
http://forum.gns3.net/topic4206.html?sid=6ebdb861bfceebd5c94e96a525167768
For connecting your virtual network to the internet, look at script 3 in section “Step 9: tap0 up – Connecting the virtualized network to your LAN” op page 16.
Good luck