SSH sessions hang after VPN reconnect

Solution 1:

Unfortunately, I think each VPN client will be picky about this in its own way. Since the network is dropping from underneath the SSH connection, you will have three scenarios that could cause it to "hang", or just drop (that I can think of).

  1. Data is flowing back and forth, and the connection is gone.
  2. You get a new IP address when reconnecting.
  3. Timeout/Alive conditions trigger before you reconnect.

2 Suggestions...

  1. Use screen (you said you don't want to do this, I know, but it really is the most robust solution. There are scripts out there that can greatly enhance/automate the reconnection process).
  2. Compare your SSH configurations. Usually stored in /etc/ssh_config or similiar.

BTW -- I don't think you should need to close windows, just do "~ ." (tilde dot). Tilde is used to control the ssh session. See the manpage for more details.