Trouble connection to certain droplets when connected to VPN server droplet

December 11, 2015 1.8k views
Networking VPN

Here is an interesting little problem I am having. Kudos to anyone who can clue me in to an answer:

Background:
All my droplets are Ubuntu 14.04
All are based in San Francisco
All up to date and running fine for at least a month

The problem:
Recently I set up OpenVPN on a droplet, and connect to that vpn from home. Works great for the last week. No problems with the VPN or droplet or home network.
I keep the VPN connected at all times for various reasons.

Yesterday I needed to ssh in to another droplet (webserver), but encountered this error:

ssh_exchange_identification: read: Connection reset by peer

If I disconnect from the VPN, I can ssh in fine to that droplet.

I tried a few other droplets I manage, and some of them will ssh fine while on the VPN, and some will not.
The common factor for the non-connecting ones seems to be the subnet of the droplet: 255.255.240.0 which is the same subnet of the droplet that I have OpenVPN running on.

So, in summary: Droplets that have the same subnet of my VPN server will not allow me to connect while I am connected to the VPN.

Droplets on a different subnet will connect fine.

Are there some rules I can add to my VPN config that will allow me to ssh to droplets within the same subnet?

Thanks in advance!!

2 comments
  • Found a solution:

    on the droplets I am trying unsuccessfully to ssh into:

    add the IP address of the VPN server to /etc/hosts.allow
    like this:

    sshd:  my.vpn.ip.address
    

    no need to restart anything..I can now ssh to my droplets when connected to the VPN, even if the droplets have the same subnet

  • Thanks for posting the solution slerracircle!

    I'm just trying to ssh into my droplets without a VPN and wasn't able to get through for some reason until I used your solution. I've never had to use the /etc/hosts.allow file before, but I can live with it since it allows me to get to my servers. :)

    Like others have posted on the "Connection Reset" issue, it does not occur on all droplets. Per haps, its just a matter of time before it engages.

1 Answer

This question was answered by @sierracircle:

Found a solution:

on the droplets I am trying unsuccessfully to ssh into:

add the IP address of the VPN server to /etc/hosts.allow
like this:

sshd:  my.vpn.ip.address

no need to restart anything..I can now ssh to my droplets when connected to the VPN, even if the droplets have the same subnet

View the original comment

Have another answer? Share your knowledge.