I have a Macbook Pro running macOS Sierra 10.12.6

I'm using Wifi to connect to a server using SSH. My iPhone is also connected to my laptop and both Wifi and iPhone USB have the green circle next to them in Network settings. How can I configure my network so that it uses my iPhone USB for Internet and Wifi for SSH?

    ether 34:36:3b:ce:3e:88 
    inet netmask 0xffffff00 broadcast
    media: autoselect
    status: active
    ether 22:3c:ae:94:e7:84 
    inet6 fe80::18a5:b2ff:226e:8492%en4 prefixlen 64 secured scopeid 0xf.    
    inet netmask 0xfffffff0 broadcast
    nd6 options=201<PERFORMNUD,DAD>
    media: 100baseTX <full-duplex>
    status: active

1 Answer 1


There are at least two ways! First make sure that the iPhone is above WiFi in the network service order; that makes it the default for all traffic. Then you can either:

  1. Use SSH's -b <ip> flag to bind SSH to your desired IP. So if your WiFi IP is, ssh as per usual with ssh -b

  2. Add a static route to your remote host routing through the desired IP. If your desired IP to connect from is and your remote host is $ sudo route add then SSH normally. When you're done, tear down the route with $ sudo route delete

  • Of course your IPs will likely change; try this out and once it's working you can script it so that you don't have to manually input your IPs every time. I would personally write a bash script and utilize probably sed, awk, grep, ifconfig, and cut. If you're better than me on the command line, you could probably do it just with ifconfig and awk.
    – Harv
    Dec 8, 2017 at 8:18
  • The iPhone USB is not above Wifi in settings. How can I do that?
    – Amir Amini
    Dec 8, 2017 at 8:31
  • Click the gear icon, "set service order" and drag it above WiFi.
    – Harv
    Dec 8, 2017 at 8:32

You must log in to answer this question.

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