I have two Internet connections at work, my wired Ethernet connection (which is heavily filtered behind a firewall, can't connect to Apple Updates, etc.) and a wireless connection that is unfiltered. I use my wireless connection as my primary connection so that things generally work. However, I have some intranet resources that I need to access via the wired connection only. How can I set it up so that when I visit something like "intranet.mycompany.com" - it will automatically route to the wired network adapter?


You need to add a route manually to cover all the corporate networks. Find the smallest net block that will cover all the corporate IP addresses. For example, the corporate net might be entirely within the range 172.16.22.XXX—172.16.25.XXX. Thus your net block would be

/sbin/route add -net -interface en0

Note that on my machine, en0 is the Ethernet, en1 is the AirPort.

I have a script which sets up a bunch of routes for my local situation which is a corporate network for all corporatey stuff (time sheets, leave applications, workplace health & safety reporting, etc), with WiFi for the useful stuff (Bing, O'Reilly Safari, etc). I still haven't figured out where I need to put this script to have Mac OS X automatically add the arcane routes I need when the interface comes up though.

  • Another note: if you boneheadedly screw up your routing table like I did (and can't access anything anymore), run route -n flush a few times, then switch your network location to something else and back to get back your normal routing information. – geerlingguy Jun 6 '13 at 17:21
  • I also have this issue, but need to do the opposite, and route only traffic to *.apple.com through wifi, and everything else through ethernet. Can the route tool be used for this as well? – TraxusIV Sep 1 '15 at 17:56
  • How do I do that bit "Find the smallest net block that will cover all the corporate IP addresses." please? – Raphael Oliveira Mar 2 '18 at 6:23
  • The net block is defined by the number of leading bits. In the example above the net block means "the first 20 bits of the IP address must match 172.16.16" — the 20 means that you are "AND"ing the IP address with '11111111.11111111.11110000.0000000' to get the 20 leading bits and then comparing that result with '10101100.00010000.00010000.00000000'. If you know that there is a certain range for your corporate network, you need to find the longest string of binary digits that is common between the two. – ManicDee Jul 20 '18 at 1:16
  • I cant thank you enough for this! I tried many other suggestion it didnt work. This saved me so much hassle to switch between interface while work in enterprise environment! :D – DazChong Oct 3 '19 at 4:24

You can setup your Network Service Order to pass most traffic through Wi-fi or Ethernet.

This makes the preferred connection be whatever service you put at the top of the list. Unfortunately, if you want most information to go through Wi-fi except for very specific items, this won't do that. If the Ethernet connection uses a different IP network range than the Wi-fi then it will automatically pass the required resources through Ethernet.

So, let's say you have the wolfing network. Wi-fi: Ethernet:

Any services you need to access that have a DNS record pointing to 192.168.5.x will automatically go through Ethernet, but your DNS query WILL still go to 192.168.1.x

Any other websites that you services you visit will go through Wi-fi if Wi-fi as at the top.

To change the service order go to System Preferences->Network. Click on the Action menu (the gear at the bottom of the Services list) and choose "Set Service Order" Then drag the service you want to have precedence to the top of the list.

  • Yeah, I already have the service order set, but I'm looking for a way to modify the routing tables for specific items. In Windows I would use the "route add" console command. I'm looking for something similar on the Mac. – JacobJ May 18 '12 at 16:46
  • I know that it is possible to add routing tables into OS X, since it is built on top of Unix, and I've heard of people doing it. But I do not know how. Try googling OpenBSD Routing Table CLI. This should tell you how to manage the routing tables through the command-line. If you can't find anything let me know, and I'll take a look. – Phillip Boushy Jun 23 '12 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.