SSH Hang and Timeout after 30 to 60 Seconds After Login with Pipe-Broken

Mindwatering Incorporated

Author: Tripp W Black

Created: 03/01/2019 at 02:01 AM

 

Category:
OS X Tips & Hints
General Mac Tips

Issue:
SSH from our Macs upgraded to Mojave and High Sierra have issues connecting to servers on another subnet. We know the issue is that they are dropped on the way back. We know they make it through the bridge VM, and die between the router and our Macs. If we use ssh or putty w/in a Windows 7 VM in Bridge mode, then SSH maintains a connection successfully.

Troubleshooting:
We tried opening additional access rules by removing restrictions that only permitted certain IPs from using SSH to the neighboring subnet.
We tried changing the hop count for the static route in the main gateway to a higher number, and then a lower number.
We tried changing the /etc/sshconfig on the server hosts, and the local ~/.ssh/config files to add keep alives, etc. All that did was make the hang before the pipe-broken message take longer.
We tried wireless and wired connections, no difference.

Solution / Workaround:
Although all evidence indicated that the packets were being lost on the way back, we decided to try setting up the static route in the mac directly.

In this example, the local LAN network is 192.168.222.0/24, and the neighboring LAN is 192.168.112.0/24. The bridge virtual device is at 192.168.222.2.

Applications --> Utilities --> Terminal

$ networksetup -listallnetworkservices
--> returned the list of network options. We were using a wired connection: Ethernet
$ sudo networksetup -setadditionalroutes Ethernet 192.168.112.0 255.255.255.0 192.168.222.2
<enter password>
$ networksetup -getadditionalroutes Ethernet
--> returned the route above that we just tried.
$ ssh myadminid@192.168.112.123

The connection stayed consistent.


Note:
To remove all additional routes for an adapter, do the following command:
$ sudo networksetup -setadditionalroutes Ethernet




Keywords:
Mac
OSX
Static Route
Routing Table



previous page