logIt Log Around The Clock

That Handy Tap Interface on Mac OSX

Ubuntu has been my desktop for some years. I’ve become so attached in a way that I no longer know how to work without. Then of course, the pain of moving to Mac is one foreseeable future. Unlike my usual repository where everything is on the table and for free, this one is a little tougher to handle. Well, if I were to cut to the chase, tap interface for instance, was nowhere near to be found. My VirtualBox depends a lot on these virtual networks as I’m used to try things out.

..you’ll always have love-hate relationship with the tools you work with.. blindly turning yourself into devoted-fanatic is another thing..

Enough bragging (let’s spare that). First we need to have /dev/tap0, /dev/tap1, etc., available using TunTap kernel extension.

I modify the small script from this post to have it available on background instead of keeping a shell open all the time:

I saved it as /usr/local/bin/setup-tap1.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/python
 
import os
while 1:
	try:
		file_path = '/dev/tap1'
		dev_file = os.open(file_path, os.O_RDWR)
		interface = 'tap1'
		while 1:
			pass
	except:
		print "tap interface is closing"
		exit()
		break

Let the shell takes care of putting it to background (daemon):

[root]$ /usr/local/bin/setup-tap1.py &

and there you have one working tap interface:

virtualbox-mac-osx-tap-interface.png

VirtualBox tap interface in Mac OSX Lion 10.7

[Moving-in would probably be easier if I started life with FreeBSD. More posts to come]


One thought on “That Handy Tap Interface on Mac OSX

Leave a Reply