Send specific traffic through VPN based on the domain

I'd like to access Hulu and similar sites from outside the US, so I'm using blackVPN via PPTP. Works great, no major problems.

Is there any way to use the (consisting) VPN connection only for a small list of domains like *.hulu.com or *.youtube.com, while not having the other traffic sent through the VPN?

Thanks in advance!

— Ben


Solution 1:

You're looking for static routes and the 'route' command. 'man route' from the shell for full info, but something like route -nv add -net 66.22.138 -interface tun0 (or whatever your VPN interface is) should route traffic bound for hulu.com over the VPN.

You'll probably want to establish a default gateway so that you are assured of routing your traffic correctly.

route add default 192.168.1.1 would add a static route for your router. Replace 192.168.1.1 with the actual IP address.

Note that these settings will not survive a reboot. If they work for you, you'll want to put them in a launch agent file.