2

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

2 Answers 2

2

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
3
  • The iMac insisted I list all 9 services! networksetup -ordernetworkservices "Wi-Fi" "Ethernet" "iPhone USB" "iPad USB" "FT232R USB UART" "Bluetooth PAN" "Thunderbolt Bridge" "Thunderbolt Bridge 2" "Bluetooth DUN" - most of these are unknown, and a hangover from my 1st 3G phone. I can't seem to remove them either.
    – Milliways
    Commented Apr 14, 2019 at 1:53
  • @Milliways - sounds like another Q to ask here 8-)
    – slm
    Commented Apr 14, 2019 at 1:54
  • @Milliways - I think you can get rid of them lie this - sudo ifconfig <device> down
    – slm
    Commented Apr 14, 2019 at 1:59
3

You can set the service order in the Network preference pane in Preferences.app.

Open Network preferences, click the small cogwheel icon below network connection list (next to the + and – icon), choose "Set Service Order…" in the menu.

Then you just drag the entries in the dialog (w/o typing all the interface names).

Btw., in the Network pref pane you can also delete unused network interfaces (– icon) or make them inactive (cogwheel menu).

macOS Network pref pane

You must log in to answer this question.

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