Always connect except on "home" network

Post Reply
brianjmurrell
OpenVpn Newbie
Posts: 3
Joined: Sun Jan 07, 2018 8:03 pm

Always connect except on "home" network

Post by brianjmurrell » Sun Jan 07, 2018 8:06 pm

How can I make OpenVPN automatically connect when I am on any network (mobile or WiFi) that is not the network that the OpenVPN server is gatewaying to (i.e. the network that is "behind" the OpenVPN gateway)?

So to be clear, I want to automatically always connect to my OpenVPN server except when I am on the network that is behind the OpenVPN server since that doesn't work and seems pointless anyway. I trust my local network.

brianjmurrell
OpenVpn Newbie
Posts: 3
Joined: Sun Jan 07, 2018 8:03 pm

Re: Always connect except on "home" network

Post by brianjmurrell » Mon Jan 15, 2018 3:19 pm

Is this just not possible?

It seems like an obvious use-case.

User avatar
ordex
OpenVPN Inc.
Posts: 217
Joined: Wed Dec 28, 2016 2:32 am

Re: Always connect except on "home" network

Post by ordex » Mon Jan 15, 2018 3:46 pm

brianjmurrell wrote:
Mon Jan 15, 2018 3:19 pm
Is this just not possible?

It seems like an obvious use-case.
How can the phone understand to be in the right network first?
What's the mechanism you use to auto connect?

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 3700
Joined: Fri Jun 03, 2016 1:17 pm

Re: Always connect except on "home" network

Post by TinCanTech » Mon Jan 15, 2018 5:35 pm

This is normally done by the server administrator.

brianjmurrell
OpenVpn Newbie
Posts: 3
Joined: Sun Jan 07, 2018 8:03 pm

Re: Always connect except on "home" network

Post by brianjmurrell » Sat Jan 20, 2018 7:03 pm

ordex wrote:
Mon Jan 15, 2018 3:46 pm
How can the phone understand to be in the right network first?
If the remote subnet is the same as the local subnet? I.e. I am the VPN client. I connect to the server. The server pushes me the subnet 192.168.1.0/24. I compare that against the (i.e. wireless) interface that I connected to the VPN on and see that it's also in 192.168.1.0/24.

Even if those were not really even the same subnets but just two separate instances of 192.168.1.0/24, things would be broken anyway since it would be ambiguous which network a connection to 192.168.1.33 should go to, so OpenVPN probably ought not to connect to ambiguous networks anyway, yes?
ordex wrote:
Mon Jan 15, 2018 3:46 pm
What's the mechanism you use to auto connect?
Nothing yet since this problem makes autoconnecting impractical. I thought I had noticed a setting in OpenVPN Connect to reconnect if it was previously connected. Maybe I am mistaken and this is all moot.
TinCanTech wrote:
Mon Jan 15, 2018 5:35 pm
This is normally done by the server administrator.
That's me. :-) How is this done then?

Interestingly I just found this similar question.

Post Reply