I'm trying to connect to a microcomputer from my Mac over WiFi via
ssh but am also connected to Ethernet. If I go to System Preferences > Network, I can see that I'm connected to both the Ethernet and WiFi networks simultaneously. I want the Ethernet network to be of higher priority (higher on the list) so that most programs use that connection (e.g., when I open a web browser, it connects via the Ethernet network). However, I want to be able to open the terminal and
ssh to the microcomputer over the WiFi network that I'm also connected to.
I know that both connections can be used simultaneously because I can make it work with this order of operations:
- Disconnect from the Ethernet network by physically removing the Ethernet jack from the Mac (now WiFi to the other microcomputer is the only connection in System Preferences > Network).
sshfrom the Mac to the address of the microcomputer
- Reconnect to Ethernet by plugging the Ethernet cable back into the Mac. Now I can see communicate with the microcomputer over the
sshconnection I established in step 2 but can also use the Ethernet network for all other programs.
I don't like this process because I frequently need to disconnect and reconnect to the
ssh connection. I'd prefer to be able to keep my Ethernet cable connected to my Mac but still be able to
ssh over the WiFi network.
The ideal solution is that there flag I can pass to the
ssh command to specify that I want to use the WiFi connection to perform the
ssh rather than the Ethernet connection. What is the easiest way to do this from the terminal?