Mac OS X 10.6 – How to Selectively Route Traffic via Ethernet or WiFi with Proper DNS

macmacosnetworkingosx-snow-leopardrouting

When I'm at work, I access various intranet pages as well as the wider Internet through ethernet. However, the company LAN blocks some ports (e.g. Google Calendar). I can get to those through WiFi. So, I gave the Airport priority, and then using route add, I set up selective routing: all intranet traffic goes through the ethernet and everything else via WiFi: sudo route add 10.0.0.0/8 <intranet gateway>.

However, there are a number of intranet sites that have their own DNS; i.e., hr.company.com only resolves on the intranet. The only way that I can get the DNS to work properly is to add the internal DNS server to the Airport DNS listing, however I fear that when I go elsewhere and forget, this will break things.

What's the right way to get the DNS to resolve using this setup?

Best Answer

Your situation is a fairly common one in large organisations. In this situation, you should use a Proxy Configuration File (set this in System Preferences > Network > Advanced... > Proxies > Automatic Proxy Configuration).

You'll have to create your own PAC file and host it somewhere but it's fairly simple Javascript and Wikipedia has a few examples: http://en.wikipedia.org/wiki/Proxy_auto-config

Another thing you may have to add is a setting in System Preferences > Network > Advanced... > DNS. You can add a DNS server here to manually add the domain in here.

You can also set these configurations per-location by adding Locations in the System Preferences > Network > Locator combobox.

Related Question