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”).
- SSH from 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 SSH connection 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?