Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

When I'm connected to two networks with separate routers using Wifi and Ethernet, how does my Mac know what connection to use when I visit a website?

share|improve this question

3 Answers 3

up vote 36 down vote accepted

From the Apple Support database article regarding network connection priority:

If you connect to the Internet or a network in several different ways (using Wi-Fi or Ethernet, for example), you can change the order of the network port configurations your computer tries when connecting to the Internet or network.

If there are multiple active network port configurations when you try to connect, OS X tries the one at the top of the list first, and then tries the other port configurations in descending order.

In that support article it is also described how you can change the priority order of network connections in System Preferences.

share|improve this answer
1  
If ethernet is higher priority but disabled & Wifi is enabled & connected, what will happen when I plug in to ethernet? Will I disconnect from the network & reconnect? Or stay connected via Wifi? –  anotherdave Aug 13 '13 at 22:25
1  
→ anotherdave: the Wi-Fi interface will be turned down (equivalent of an ifconfig en1 down), and the Ethernet interface will be turned up (equivalent of an ifconfig en0 up). If this last one is based on DHCP, this will cause a DHCP request and answer (< 6 s). If any of your interfaces have intermitent drop out, this will lead to an endless interfaces switching and DHCP requests. –  daniel Azuelos Aug 13 '13 at 23:03

It's in your Network Preferences. Here's screen shots from 10.7.3.

Access the settings from the gear at the bottom of the network type sidebar.

enter image description here

Choose "Set Service Order..." to drag them into the preferred order.

enter image description here

share|improve this answer

I recommand you to never use a configuration where you may have at the same time different interfaces up on the same machine. You won't have any easy knowledge and control of this dual connectivity.

This may lead to huge difficulties to analyse even the simplest network trouble.

This may also cause loops within company or personnal networks very hard to diagnose. For example, have a look at the following command:

sysctl -a | grep forwarding

which will show you if IPv4 or IPv6 is going through your Mac from one interface through the other without your knowledge or control.

As much as possible define locations with the interface you know you want to connect to and switch on the right one at will:

Apple menu > Location > Home / AirPort
                      > Office / Ethernet
                      > outside / AirPort [unsecure]
                      > …


When 2 (or more) interfaces (for example Ethernet and Wi-Fi) are flagged green (Connected) within:

Apple menu > System Preferences… > Network

one way to know which one you are taking to reach the outside is the following line command (within a Terminal or xterm window):

route get default | grep interface
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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