Installing Tun Tap Driver on Leopard
13 February, 2008 by Greg Ferro Print Posting
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.

and

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 = 0×604c0ebc
[[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#











Hello Greg,
Just want to say “Thank you!” for this very useful howto!
Cheers, Dirk
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
Worked flawlessly on my iMac. Thank you.
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