How to force OS X to always use my VPN? [duplicate]
Solution 1:
You need a firewall between you and the Internet that will block all traffic except traffic to the IP address of your VPN host
Your router will more than likely have this functionality built in
Solution 2:
Mac OS X includes the command line based ipfw
command which allows you to set advanced local firewall rules.
ipfw works with rules which are written and checked in order. Therefore the low number rules are first checked towards the end of the list. There are two approaches when configuring firewalls:
- Closing the network + Allow traffic
- Opening the network + Denying traffic
In your case you need to close off all traffic, and then only allow traffic to your VPN's IP address, using only the ports that your VPN uses. This will prevent any stray packets from being able to get out so long as your rules are tight.
There are many great guides and tutorials on the net for ipfw which is widely used in many Unix and Linux operating systems, here are some:
- http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/firewalls-ipfw.html
- http://www.ibiblio.org/macsupport/ipfw/
- http://freebsd.rogness.net/redirect.cgi?basic/firewall.html
I suggest you investigate them and see if you are able to understand the command sufficiently to give it a go. At a bare minimum I would recommend ensuring you know how to disable the firewall and clear the rules just in case you tie your machine in knots through misconfiguration!
Good luck :)