Network – How to Change Routing Priority on iMac

high sierraimacNetwork

Our home phone/internet is down; dug up by council contractors, and won't be fixed for a week.
I am using an iPhone hotspot in the interim.

This works, but when I plug the Ethernet connection to my router into my iMac I can no longer access the internet.
I use the local network for file sharing and printing.

How can I stop the iMac from using the Ethernet connection for internet, or PREFERABLY set the priority for the hotspot to be higher when connected?

172.20.10.1 is the Hotspot IP

~$ netstat -nr
Routing tables

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            10.1.1.1           UGSc           53        0     en0
default            172.20.10.1        UGScI          13        0     en1
10.1.1/24          link#6             UCS             2        0     en0
10.1.1.1/32        link#6             UCS             1        0     en0
10.1.1.1           78:a0:51:16:bb:56  UHLWIir        31      156     en0   1192
10.1.1.9/32        link#6             UCS             2        0     en0
10.1.1.255         ff:ff:ff:ff:ff:ff  UHLWbI          0        1     en0
127                127.0.0.1          UCS             0        0     lo0
127.0.0.1          127.0.0.1          UH              1      300     lo0
169.254            link#6             UCS             0        0     en0
169.254            link#7             UCSI            0        0     en1
172.20.10/28       link#7             UCS             1        0     en1
172.20.10.1/32     link#7             UCS             1        0     en1
172.20.10.1        3e:2e:f9:2a:33:64  UHLWIir        15       12     en1   1181
172.20.10.5/32     link#7             UCS             0        0     en1
172.20.10.15       ff:ff:ff:ff:ff:ff  UHLWbI          0        1     en1
224.0.0/4          link#6             UmCS            2        0     en0
224.0.0/4          link#7             UmCSI           2        0     en1
224.0.0.251        1:0:5e:0:0:fb      UHmLWI          0        0     en0
224.0.0.251        1:0:5e:0:0:fb      UHmLWI          0        0     en1
239.255.255.250    1:0:5e:7f:ff:fa    UHmLWI          0       10     en0
239.255.255.250    1:0:5e:7f:ff:fa    UHmLWI          0       10     en1
255.255.255.255/32 link#6             UCS             1        0     en0
255.255.255.255    ff:ff:ff:ff:ff:ff  UHLWbI          0        2     en0
255.255.255.255/32 link#7             UCSI            0        0     en1

Best Answer

Researching this I was able to find this SU Q&A titled: How does Mac OSX prioritize network interfaces when routing? which shows a method to do what you want. This Q&A mentions that macOS orders routing based on the ordering on the network interfaces.

Device ordering

You can see this order with this command:

$ networksetup -listnetworkserviceorder
An asterisk (*) denotes that a network service is disabled.
(1) Wi-Fi
(Hardware Port: Wi-Fi, Device: en0)

(2) Bluetooth PAN
(Hardware Port: Bluetooth PAN, Device: en6)

(3) Thunderbolt Bridge
(Hardware Port: Thunderbolt Bridge, Device: bridge0)

So routes associated with the device en0 (Wi-Fi) will have a higher precedence than routes associated with the device bridge0 (Thunderbolt Bridge). You can use this command to reorder these:

$ networksetup -ordernetworkservices "Thunderbolt Bridge" "Bluetooth PAN" "Wi-Fi"

Now the order is like this:

$ networksetup -listnetworkserviceorder
An asterisk (*) denotes that a network service is disabled.
(1) Thunderbolt Bridge
(Hardware Port: Thunderbolt Bridge, Device: bridge0)

(2) Bluetooth PAN
(Hardware Port: Bluetooth PAN, Device: en6)

(3) Wi-Fi
(Hardware Port: Wi-Fi, Device: en0)

Your setup

For you you'll want to reorder your devices so that the routes from your tethered device, en1 are order higher than your routes from en0.

Before
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            10.1.1.1           UGSc           53        0     en0
default            172.20.10.1        UGScI          13        0     en1
After
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            172.20.10.1        UGScI          13        0     en1
default            10.1.1.1           UGSc           53        0     en0
Related Question