Internet Sharing & OpenVPN/Viscocity?

Got a problem with Viscosity or need help? Ask here!


Posts: 2
Joined: Sun Jul 04, 2010 7:07 am

Post by Katagi » Sun Jul 04, 2010 7:12 am
Hello All,

I am trying to share my OpenVPN connection over the Ethernet (VPN is working thru WLAN).

Since there is no tun0 or any other device in the GUI section of Network preferences pane I tried to enable it manually using following commands:

sudo sysctl -w net.inet.ip.forwarding=1
sudo /usr/sbin/natd -l -interface tun0 -use_sockets -same_ports -unregistered_only -dynamic -clamp_mss -enable_natportmap -natportmap_interface en0
sudo ipfw add 01000 divert natd all from any to any via en0
sudo ipfw add 01100 divert natd ip from to any via en0
sudo ipfw add 01200 divert natd ip from any to me via en0

( is my VPN network: inet --> and I want to share it with en0 ethernet).

But it still doesn't work i.e. from my ethernet network I can't ping outside.

Any suggestions?



Posts: 2
Joined: Sun Jul 04, 2010 7:07 am

Post by Katagi » Sun Jul 04, 2010 8:19 am
Ups. My bad i never read this thread :oops:

Sorry. I just downloaded the first program WaterRoof and simply enable the NAT for tun0 device and it worked right ahead.

Thanks. This question may be closed/deleted.


Posts: 2
Joined: Tue Jun 21, 2011 2:01 pm

Post by themesser » Tue Jun 21, 2011 2:09 pm
hi katagi, can you tell how you accomplished that using waterroof ?
i can see my connection to the vpn server in the connection list, but don't know at all what to do in the "NAT setup" but when i click "start NAT" an erro pops up. Is there something to configure ?


Posts: 1
Joined: Tue Aug 16, 2011 8:44 pm

Post by dsnetter » Tue Aug 16, 2011 8:58 pm
Ok, I've got a new twist on this whole thing, and would LOVE it if someone could steer me toward a solution.

Here's one setup that I've gotten working just fine:

Internet connected to my macbookpro's ethernet interface, en0, with an IP assigned by my ISP
OpenVPN connected through this interface, creating the virtual interface, tun0, with an IP that (I believe) Viscosity generates,
I want to share my OpenVPN connection over wifi, so I create an ad-hoc network with IP's in the same net, My macbookpro uses, and this IP shows up as the IP address for interface en1. I then tell all the other devices on the ad-hoc to use as their gateway. I run WaterRoof and start NAT with tun0 as the WAN interface. It all works like a charm.

But, and this one makes me want to do bad things to Steve, my AppleTV will not recognize an ad-hoc network. Won't even let me type in the wifi name manually... it just refuses to see it. Now, it'll see a wifi network created by my macbookpro just fine if it's created using the Internet Connection Sharing features in Mac OSX, but and here's the rub, I can't figure out how to get NAT to work this way.

If I set my Airport up manually (no DHCP) and choose an IP like before,, then the Internet Connection Sharing will create this IP for interface en1: I figured I could work with this, and set up all my subnet masks to, and hoped NAT would be happy. But it's not. None of my devices can see the internet now.

What to do?


Posts: 6
Joined: Fri Aug 31, 2012 1:04 am

Post by frriction » Fri Aug 31, 2012 1:08 am
can anyone explain me how dsnetter has setup adhoc connection.

I have downloaded waterroof but do not know what to do ahead. :roll:


User avatar
Posts: 2102
Joined: Thu Sep 04, 2008 9:27 pm

Post by James » Fri Aug 31, 2012 9:04 pm
Hi frriction,

I recommend you take a look through the posts in the following topic - some users have contributed scripts to automate the setup as well:

James Bekkema
Viscosity Developer

6 posts Page 1 of 1