Allow internet connection through nothing but a certain VPN connection in Mac OS X

2

How can I configure Mac OS X such that it can only allow an internet connection (both downloads and uploads) through a given VPN connection?

If the VPN connection disconnects, the internet should stop working.

I need to do this due to security reasons. Sometimes I use ISPs that I have no reason to trust. Especially on wifi hotspots.

How do I do this? I'm sure there is nothing I can do through the Mac OS X GUI, but is there any hack I can do via the Terminal?

Enchilada

Posted 2011-08-09T00:51:49.310

Reputation: 335

Answers

0

I doubt this is possible with the VPN stuff in OS X. Correct me if I'm wrong.

However, I was able to solve this by using OpenVPN and Tunnelblick.app. Tunnelblick has capabilities for running scripts when the VPN connection dies. So I just run a script that turns off the Ethernet/AirPort when the VPN dies. Seems to be working.

Enchilada

Posted 2011-08-09T00:51:49.310

Reputation: 335

I've found a way using pf.conf that may interest you. Details are here.

– Nick – 2012-09-08T11:28:44.490

0

If you are making a VPN connection, isn't the default route for all traffic to use that connection?

Anyway, set a default route to the VPN. Traffic should stop when the link dies.

It's late and I might not be interpreting your question clearly :D

user94004

Posted 2011-08-09T00:51:49.310

Reputation: 1

That's all well and fine while the VPN connection is active. However, if the VPN connection prematurely disconnects (and while I'm away from my computer and thus don't notice it), the internet connection will fall back to my insecure default non-VPN connection. That's what I want to avoid. – Enchilada – 2011-08-13T13:37:25.157