TL;DR: if your static route doesn't work, but you have Wifi+Ethernet on your Mac, and 2 Ethernet ports on your NAS, you can configure one port on the NAS and the Ethernet port of your Mac to be on a different subnet than your wifi/router one (192.168.100.x
vs 192.168.0.x
: it doesn't really matter as long as they're different). The second port of your NAS can still be connected to the router via DHCP, to ensure remote sync processes keep working.
Ok everyone, this is for future reference for people in my same situation (a Mac with at least one Ethernet port and WiFi + a NAS with two ethernet ports).
One way you could accomplish the task of routing all traffic towards the NAS through one specific interface (in my case, Ethernet) and all the rest through WiFi could be as follows:
On the MAC:
- Configure WiFi for web surfing (usually, DHCP or a static address inside the router subnet). E.g.: if your router is
192.168.0.1
, your Mac's WiFi card could be assigned 192.168.0.2
. Subnet mask will be 255.255.255.0
, and obviously the Gateway will be your router's address.
- Turn DHCP off for your Ethernet port and manually configure its address inside a different subnet from the one where the router is. E.g.: you could set it to -say-
192.168.100.1
, subnet mask always 255.255.255.0
, leave "Gateway" blank (and check that DNS too is blank).
- Make sure the Ethernet addresses are advertised first by placing
Ethernet on top of WiFi in the Services Order panel (click the gear button
below the network services)
Link your Mac to your NAS via a cable (or through a switch), and let's set the NAS this way: (remember that for this to work the NAS has to have two Ethernet ports, not one)
- Link one of the NAS Ethernet ports to your WAN network (the one with internet access). Set this interface as DHCP in the Network settings of the NAS. This will assign the NAS and address in the same pool of the router, and the Mac's (let's say
192.168.0.3
)
- Link the second Ethernet interface to your Mac's Ethernet, directly or via a switch (note that both connections coming from the NAS can run through the same switch and still work)
- In your NAS' control panel turn DHCP off for this second interface (you don't want the router to talk to it!) and manually configure it to another address in the same pool of your Mac's Ethernet IP. In this example, it could be
192.168.100.2
, Subnet mask 255.255.255.0
, Gateway 192.168.100.1
(your Mac's address).
YMMV depending on your NAS, or on your Mac's OS, but as far as I'm concerned I can testify that now on my MacOs 10.13.6 all "standard" traffic is correctly routed through WiFi, while the NAS (and the NAS only) is receiving full-speed traffic directly from the Ethernet connection.
This trick has one "downside", in that it will project not one but two NAS instances on the network (one is 192.168.0.x
, the other 192.168.100.x
), so obviously you'll have to make sure that you instruct your Finder to see the "correct" (Ethernet) NAS. If you keep addressing the other IP, its traffic will still be routed through WiFi.
As to the management console (usually reachable via web browser), it will keep working flawlessly on both addresses.
This is only one possible solution. The other route (no pun intended), via script + static route, would possibly be more elegant and streamlined, but it requires some scripting and it's seemingly harder to achieve.
I'll post it anyway as soon as I'll get it to work.