I've got ethernet and wifi in the network devices. I use internet through wifi and file sharing over ethernet (we got an access point with DHCP and an ethernet switch with static IP - the access point and the switch are using two different subclasses) And yes, I got the LAN on the top of the devices priority.

We don't have any NAS, we just use the "File Sharing" feature on OS X. What drives me crazy is the fact that when I click on the server list on the left sidebar in Finder I can connect to other iMacs, but - I don't know why - sometimes I connect through wifi and sometimes over ethernet. I disabled gateway and DNS on the ethernet configuration, and for a while it seemed to fix the problem.

I solve it by disabling wifi, so OS X is forced to use only ethernet. How can I force AFP/SMB sharing to use ethernet instead of wifi? Should I look for some bonjour tweaking? It would be great to block bonjour discovering over wifi.

  • 1
    How is it possible that from the same Mac you might see the same file server on 2 different network interfaces? For example, www.apple.com is only visible on your Wi-Fi interface, if I guessed correctly your network architecture.
    – dan
    Feb 8, 2016 at 17:10
  • Thanks, but the problem is that when you try to reach a local resource, sometimes the machines use wifi instead of ethernet...
    – sekmo
    Feb 10, 2016 at 11:56
  • 2
    Do you really need these 2 networks at the same time? If yes, please clarify your network architecture within your original question.
    – dan
    Feb 10, 2016 at 12:24
  • Sorry but in the original form of the question I wrote "I've got ethernet and wifi in the network devices. I use the internet through wifi and file sharing over ethernet"
    – sekmo
    Feb 10, 2016 at 16:20

4 Answers 4


Below is a network diagram based on what I have read thus far. I have made some assumptions about the IP numbering conventions, but that will have no effect on the overall scenario.

I am assuming that you are using two different subnets rather than 2 different classes of networks. But, either way, you have two very different network IP addressing schemes for your Ethernet network and another for your WiFi Network

enter image description here


  • Wi-Fi is used to connect to the Internet. This means that your computer gets it IP, DNS and gateway settings via DHCP from the router.

  • The device (in this case the NAS) that you are transferring files to is on the Ethernet network and the addresses are set STATICALLY. That means the IP, DNS, and Gateway info must be manually configured.

What we don't know:

  • How the networks on the iMac are configured. Did you duplicate the DNS and gateway settings from the Ethernet to the WiFi?
  • How the network on the NAS is configured. Did you specify a DNS, and gateway here as well?
  • How the routers are configured. What did you use for gateway, DNS, route advertisement, etc.

All of this missing information plays a key role in why network traffic is taking the route it is taking.

What we know:

The key comment here is what @sekmo said

"....the problem is that when you try to reach a local resource, sometimes the machines use wifi instead of ethernet... "

The only way that a network adapter will forward traffic from one segment to another is if it knows about it. This means:

  1. The router is connected to the switch (the yellow line)
  2. The network route to get to is being advertised to the clients on by the router.

We also know that your computer (iMac) is not acting as a router because it already knows the routes to each network. It would NEVER send a file destined for the NAS through the WiFi router unless there was a connection between the two networks.

Why would your iMac choose WiFi for file transfer rather than the faster Ethernet?

The reason for this comes down to response time. If the computer you are transferring to has gone to sleep, it will take longer to respond back than the WiFi router which is always on. That's how your system automatically prioritizes traffic for you - it doesn't look for the fastest to transfer, it looks for the quickest to respond to it's request.

What you have done here is put two network adapters, even though they are addressed completely differently, on the same network. You would expect them to load balance, or prioritize traffic based on destination, but because the two networks literally overlap each other, you are creating a bunch of network overhead.


The easy solution would be to remove the connection between the WiFi router and the Ethernet router (yellow line). This way, neither router will advertise a path you don't want traffic to go down.

You also want to remove the DNS and Gateway settings from all the Ethernet connected nodes - there should be no reason for them to get to the Internet and you want only ONE path to the Internet and ONE path to your NAS.

(Disclaimer: You can create redundant networks, but that is outside the scope of this document and your question)


This is not a recommended setup. There is no need to create a dual homed, multiple gateway network with Internet traffic and file transfer traffic going on completely different networks. Unless you are running a server which is doing multiple duty as a file server, web server, and Internet proxy, a single connection is more than sufficient.

If speed is that critical to you, look at getting multiple ETHERNET adapters and bonding them together - you will need to upgrade you switch to accommodate this.


If you ARE running a server, WiFi for the Internet has to be the worst way to configure this.

  • Thanks for your response :-) We don't have any NAS, we just use the "file sharing" feature on mac osx. What drives me crazy is the fact that when I click on the server list on the left sidebar in finder I can connect to other imacs, but - I don't know why - sometimes I connect through wifi, sometimes over ethernet. I disabled gateway and DNS on the ethernet configuration...
    – sekmo
    Feb 11, 2016 at 11:27
  • 1
    @sekmo Never use the sidebar (or "connect as" at the top of a share's window) to access a server. It will always yield an arbitrary (either wifi or ethernet) connection to your shares in your environment. This is also valid for my answer.
    – klanomath
    Feb 11, 2016 at 11:50
  • The NAS is arbitrary - it represents a host to share files. If the other Macs you see on the sidebar sometimes connect via WiFi and sometimes over Ethernet, it means the two networks are physically connected and are known to each other. Removing the DNS and Gateway will only partially fix the problem; you need to isolate the networks from each other. I still maintain this is not the correct setup at all
    – Allan
    Feb 11, 2016 at 13:15
  • @klanomath, "Connect As" is related to the user credentials used to access the host (user1, user2, etc.), not the network path used to get to the host
    – Allan
    Feb 11, 2016 at 13:19
  • @Allan I know that. I just wanted to emphasize what not to do.
    – klanomath
    Feb 11, 2016 at 13:36

Properly done you can achieve this by prioritizing one interface over the other.


two different networks (physically and logically) e.g. Ethernet: and Wi-Fi

  • assign static IPs to the ethernet adapters on the source(s) and the target(s) with a proper net mask. A default gateway is not needed.
  • In System Preferences -> Network hit the gear at the bottom left -> Set service order.
    Move the ethernet interface to the top or at least one in front of the Wi-Fi interface and apply the changes if asked.
  • Close System Preferences
  • In the menubar of the Finder hit "Go" -> "Connect to server…" and enter either afp://192.168.0.x, cifs://192.168.0.x or smb://192.168.0.x (with x= the last octet of the IP address of the share) to connect to the share(s).

If the shares are in a different network (i.e. behind a router) you have to add a route:

In the example below I assume the ethernet router has the IP and the network behind the router is the network.

sudo route add -net

To make this route persistent add a launch daemon on your machines:

sudo nano /Library/LaunchDaemons/local.staticroute.shares.plist

with the content

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

save the file (ctrl-O) and quit nano (ctrl-X).

Load the launch daemon with:

sudo launchctl load -w /Library/LaunchDaemons/local.staticroute.shares.plist

To access the shares enter afp://192.168.56.x, cifs://192.168.56.x or smb://192.168.56.x (with x= the last octet of the IP address of the share).

If you want to access your 192.168.0.x Mac from the 192.168.56.x computers you respectively have to add a route on the 192.168.56.x computers to the network. Here I assume the router address is

OS X (non-persistent & persistent):

sudo route add -net

To make this route persistent on the 192.168.56.x computers add launch daemons similar to the above plist but use


Windows (persistent):

route add -p mask 


route add -net netmask gw

To add a persistent route in Linux check your Linux distro documentation.

  • Yes, I've got two different networks: one for the access point and one for the LAN - with two different IP classes. But I can't find out how to manual configure routing on mac... Have I to look for iptables somewhere on the mac? :-)
    – sekmo
    Feb 10, 2016 at 12:03

An easy fix might be to:

  • assign a static IP to the ethernet adapter
  • set a host entry and route on the connecting machine to connect to the static IP before the default route for general traffic

You don't specify the clients that connect, so describing those operations specifically might take a lot of work. Worse, your network isn't really defined - so if you aren't using DHCP for both connections on the Mac (assuming you are even running OS X on a mac to share via SMB) - it's even more unclear if my suggestion would work for your specific case.

  • sorry, I forgot to write that I use DHCP for connecting to the access point and manual configuration for LAN.
    – sekmo
    Feb 10, 2016 at 12:00
  • 2
    @sekmo: please add all the useful information within your original question. Not many people will dig through microcospic comments to help you with a correct answer. ---- Missing info.: ifconfig -a, netstat -nr, how you name your local afp/smb server (this will tell everyone if you use DNS, bonjour, IP address to route traffic toward it).
    – dan
    Feb 11, 2016 at 0:09

Thanks for all your answers, especially Allan. Anyway, I will stick with the simplest and more reliable solution: use an AP-client featured Access Point attached to the ethernet switch, so I can connect to the internet through the LAN, without using Wi-Fi.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .