Redirect request to a specific https address only through VPN (OSX)

2

I would like to use my company's VPN only to manage my emails via exchange (https). Which means I have to redirect the traffic going to https://mail.company.com through my VPN but not the other addresses.

If I go to Network Preferences -> Advanced -> Proxies I see we can bypass proxy settings for a list of hosts and domains, but I want to do the other way: use the proxy only for a list of domains.

user149377

Posted 2012-07-31T14:21:23.417

Reputation: 23

Answers

0

Short version:
You can add a route for a specific host.

Long version:
If you only use https://mail.company.com/ for this task then you can change the routing table to route all request for this host via a specific interface. In this case via the VPN.

Using the shell the command for this would be something like thing:
route add -host IP_from_mail.company.com IP_of_VPN_gateway
Replace IP_from_mail.company.com with the IP of mail.company.com. If you do not know which IP that is try ping mail.company.com.

This should work until your next reboot.

To add it permanently you need to do some things which I can not test due to a lack os OS/X on my part. Googling seems to point to sudo launchctl load -w /Library/LaunchDaemons/setstaticroute.plist. However this is untested by me since I have no OS/X

Hennes

Posted 2012-07-31T14:21:23.417

Reputation: 60 739

Thank you very much for your reply. But it seems that it not the only problem that I have: my company is the child company of another one. When the proxy is on, I can resolve *.company.com but not *.mom_company.com. And the server is on https://email.mom_company.com. Would you know what I can setup to be able to resolve email.mom_company.com ? I can setup my email to use the IP address of email.mom_company.com, but Exchange will change it back to a name that I can't resolve anymore without all traffic going through https. I hope I am clear enough...

– user149377 – 2012-07-31T23:59:45.290