• Home
  • Archive
  • Disclosure
    • Disclaimer
    • Comment Policy
    • Privacy Policy
  • Just Three
  • Contact
    • Who Am I ?
    • What does Ethereal Mind mean ?

EtherealMind

Software Defined & Intent Based Networking

You are here: Home / OSX / Installing Tun Tap Driver on Leopard

Installing Tun Tap Driver on Leopard

13th February 2008 By Greg Ferro Filed Under: OSX

First, I read about what TunTap is at Wikipedia and VTUN Sourceforge. From what I read, TunTap was written for the VTUN project to specifically encapsulate Ethernet packets (TAP driver), whereas the TUN driver encapsulated IP packets. The driver is used by other popular software so it looks like it is here to stay. It is implemented as part of the Linux Kernel.

Go here Tun TAP driver for MAC OS X and download the installer package for Leopard.

Extract the package using Stuffit Expander (free app, google for it), and this will create a pkg file. This is a self installing script package so use Finder to run it, it will ask for your password so as to root privileges to install the Tun and Tap drivers into your dev directory.

After this I went into my /dev directory and did an ls and you can see the Tun and Tap driver are there.

tuntap2.png

and

tuntap1.png

Setup Dynagen to connect to the TAP driver

The next step is to then to create the TAP configuration in your dynagen net file. The following a sample:


# Simple lab
model = 3640
ghostios = true
sparsemem = true

[localhost]

[[3640]]
image = /Users/gregferro/Documents/dynalab/dyncode/c3640-js-124-17.image
ram = 128
idlepc = 0x604c0ebc

[[ETHSW sw1]]
1 = access 1 NIO_tap:/dev/tap0
2 = access 1
3 = access 1
4 = access 2

[[ROUTER r1]]
model = 3640
e0/0 = sw1 2
e0/1 = LAN 2
e0/2 = LAN 12
e0/3 = sw1 4

[[router r2]]
model = 3640
fa0/0 = sw1 3
fa1/0 = LAN 2

Once you have get this to successfully start you will now be able to see the interface


gf:smalllab gregferro$ ifconfig -l
lo0 gif0 stf0 en0 fw7 en1 vmnet8 vmnet1 en3 en2 tap0
gf:smalllab gregferro$

We need to give this interface an ip address:


gf:smalllab gregferro$ sudo ifconfig tap0 198.18.0.250/24 up
Password:
gf:smalllab gregferro$

now you will be able to configure R1 with an IP address and you can now reach your OS X system.


r1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
r1(config)#int e0/0
r1(config-if)#no shut
000033: *Mar 1 00:04:17.795 UTC: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
000034: *Mar 1 00:04:18.795 UTC: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
r1(config-if)#ip add 198.18.0.1 255.255.255.0
r1(config-if)#^Z
r1#
r1#
000035: *Mar 1 00:04:23.403 UTC: %SYS-5-CONFIG_I: Configured from console by console
r1#
r1#
r1#ping 198.18.0.250

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 198.18.0.250, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/4/8 ms
r1#

About Greg Ferro

Human Infrastructure for Data Networks. 25 year survivor of Corporate IT in many verticals, tens of employers working on a wide range of networking solutions and products.

Host of the Packet Pushers Podcast on data networking at http://packetpushers.net- now the largest networking podcast on the Internet.

My personal blog at http://gregferro.com

Comments

  1. Dirk says

    1st May 2008 at 16:58 +0000

    Hello Greg,

    Just want to say “Thank you!” for this very useful howto!

    Cheers, Dirk

  2. Lucas says

    7th July 2008 at 20:28 +0000

    You are my hero!!!

    Thanks for this great info. Is there any way to access the internet with the router? In a nutshell, I want to make my MAC to act as an ISP using the tap driver.

    Thanks again!
    Best,
    Lucas

  3. Gian Paolo says

    26th September 2008 at 20:42 +0000

    Worked flawlessly on my iMac. Thank you.

  4. Brandon Carroll says

    7th November 2008 at 00:50 +0000

    Hey Greg,

    I followed these directions but get this message when i start the lab:

    es/dynagen ‘/Users/brandoncarroll/Documents/dynalab/labs/ipsec_ha.net’ ; exit
    Reading configuration file…

    *** Warning: Connecting SW2 port 4 to access 3 NIO_tap:/dev/tap0 resulted in:
    206-unable to create TAP NIO

    *** Error: errors during loading of the topology file, please correct them
    Press ENTER to continue

    When I do an ls in the /dev directory I see the tun and taps. Any idea what I may be doing wrong?

    Thanks

    Brandon

    • CaitSith says

      24th January 2009 at 18:18 +0000

      I have the same “206-unable to create TAP NIO” error message using GNS3 and the sourceforge version of TunTap drivers.
      Greg Ferro, can you help?
      Thank you

  5. packeteer says

    8th December 2008 at 00:33 +0000

    http://tuntaposx.sourceforge.net/ < best source for tun tap driver (your original link is dead)

    • Greg Ferro says

      14th December 2008 at 18:09 +0000

      Did these instructions work for that software – its a long time ago, but I remember having problems with the sourceforge version.

  6. bdelano says

    7th February 2009 at 09:41 +0000

    I am getting the same 206 error in dynamips and when I try to create a tap interface [sudo ifconfig tap0 create] i get “SIOCIFCREATE: Invalid argument”. I can see the kext are installed but it doesn’t look like leopard is playing nice. Has anyone got this to work with 10.5.6?

    Output:
    laptop:Downloads bdelano$ kextstat | egrep “tun|tap”
    118 0 0x56b6e000 0x6000 0x5000 foo.tun (1.0)
    119 0 0x56b74000 0x6000 0x5000 foo.tap (1.0)
    laptop:Downloads bdelano$ sudo ifconfig tap0 create
    Password:
    ifconfig: SIOCIFCREATE: Invalid argument

    • Greg Ferro says

      12th February 2009 at 21:06 +0000

      Yep, you are right. The TUN/TAP drivers no longer work under Leopard. This article is probably useless and is no longer relevant.

      • John says

        8th March 2009 at 17:00 +0000

        That is not true. The kernel extensions installed by http://tuntaposx.sourceforge.net do work under Leopard. I’m using them with Dynagen now and the process for setting up is still the same.

  7. Scott V says

    10th March 2009 at 06:03 +0000

    I have never had success with Tun/Tap for OS X – neither in Tiger before nor Leopard now.

  8. Andreas says

    15th April 2009 at 11:33 +0000

    Hello All,

    I’ve just downloaded tuntap_20080804.tar.gz from Sourceforge and I can confirm that it works perfectly with dynamips-0.2.7-RC3-OSX-intel-bin.zip on a MacBook running OSX 10.5.6.

    I can ping a tap0 assigned IP address from a virtual router and visa versa.

    One problem I did have was when the tap0 interface was in the same subnet that the notebook is in, i.e. 192.168.1.x/24.

    When I assigned the tap0 interface the IP address of a different subnet, e.g. 192.168.2.x/24, it worked as expected. It goes without saying that the virtual router’s interface needs to be in the same subnet.

    Many thanks for this very useful article.

    Andreas

    • duga says

      27th June 2009 at 15:17 +0000

      Hi Andreas,

      I already download the driver also, but I failed to bring up the tap interface using #ifconfig tap0 plumb
      I can see the tapX and tunX on /dev
      Can you please show the step by step installation?

      Thanks,

      duga

    • duga says

      27th June 2009 at 16:04 +0000

      Hi Andreas,

      It’s already works great, thanks for all of you guys

      Regards,

      duga

  9. Jesse says

    27th September 2009 at 20:11 +0000

    Hi,

    When I install the Tun Tap drivers, I can only see “tap0-15” and no “tun” when using the “ls -la /dev” command. I am running Mac OS X 10.5.8. I need help.

  10. GeorgeM says

    11th February 2010 at 05:47 +0000

    Can you have multiple Tap interfaces and trunk these Tap interfaces to a Cisco switch?

    Also, was anybody succesfull in using Dynagen/Dynamips with Virtual Interfaces on Mac OS 10.5.8? I was able to create the virtual interfaces, assign the proper tagging, bind 2 routers (R2 to vlan2 and R3 to vlan3) in the Dynagen’s .net file but I wasn’t able to ping R3 from R2.
    Any ideas?

  11. Nick B. says

    15th December 2010 at 19:03 +0000

    Thanks Greg for some must useful articles.

    I’ve just succeeded getting the tuntap drivers to work on my system, Snow Leopard 10.6.5.
    I downloaded the tuntaposx installer from http://sourceforge.net/projects/tuntaposx/wp-content/uploads/

    Connection to the tuntap via Dynamips version 0.2.8-RC2-x86 in a Dynagen.net file was as per your
    example. My only error was giving tun0 and the router ip addresses in the same subnet as my
    other active OSX interface en1, once I’d corrected that it all works. I can now access the router with SDM V2.5 – this runs on OSX after copying the directory over from a Windows installation!

    • Nick B. says

      15th December 2010 at 19:06 +0000

      Just to add that the tuntap version I used was tuntap_20090913.tar.

  12. Johan Havermans says

    26th October 2011 at 12:25 +0000

    Greg et al,
    I failed in getting the tuntap drivers working on Mac OSX 10.7 Lion and also in connecting DynaMIPS (embedded in GNS3) to my virtual machines (Parallels Desktop / VirtualBox) and connect my virtual LAN to my real LAN. 
    At the end, I got it all working. 
    Since I did spent quite some time on this website to figure out how to get it work in Lion. I documented what I did and it might be useful for others to post it here:

    http://forum.gns3.net/topic4206.html?sid=6ebdb861bfceebd5c94e96a525167768

    Good luck

    Johan

  13. Sebastian says

    7th March 2015 at 22:11 +0000

    For Users on OSX 10.10.2 brew install Caskroom/cask/tuntap

Network Break Podcast

Network Break is round table podcast on news, views and industry events. Join Ethan, Drew and myself as we talk about what happened this week in networking. In the time it takes to have a coffee.

Packet Pushers Weekly

A podcast on Data Networking where we talk nerdy about technology, recent events, conduct interviews and more. We look at technology, the industry and our daily work lives every week.

Our motto: Too Much Networking Would Never Be Enough!

Find Me on Social Media

  • LinkedIn
  • RSS
  • Twitter
  • YouTube

Return to top of page

Copyright Greg Ferro 2008-2019 - Thanks for reading my site, it's been good to have you here.

Opinions, Views and Ideas expressed here are my own and do not represent any employer, vendor or sponsor.Full disclosure