How can I enable automatic connection to more than one server?

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
CraftyClown
OpenVPN Power User
Posts: 69
Joined: Sat Nov 01, 2014 9:55 am

How can I enable automatic connection to more than one server?

Post by CraftyClown » Sat Jan 06, 2018 2:49 am

Hey all,

On one of my client machines I need to access two different servers, which I can do manually via the OpenVPN GUI, however I would like to enable this automatically.

I have the windows service set to run at start up and I have two tap adapters installed, however I'm not sure where I need to place the certificates etc for each connection. I have tried placing them in separate sub folders, but that doesn't seem to work and they can't all go in the same folder because of the multiple ca.crt files clashing.

Where am I going wrong here?

CraftyClown
OpenVPN Power User
Posts: 69
Joined: Sat Nov 01, 2014 9:55 am

Re: How can I enable automatic connection to more than one server?

Post by CraftyClown » Sat Jan 06, 2018 6:00 pm

Is this even possible using the official OpenVPN client, or do I need to look at third party options such as Viscosity or Tunxten?

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: How can I enable automatic connection to more than one server?

Post by TinCanTech » Sun Jan 07, 2018 1:30 pm

CraftyClown wrote:
Sat Jan 06, 2018 2:49 am
I have tried placing them in separate sub folders, but that doesn't seem to work and they can't all go in the same folder because of the multiple ca.crt files clashing
They can go in sub-folders.

See --config file in The Manual v24x

CraftyClown
OpenVPN Power User
Posts: 69
Joined: Sat Nov 01, 2014 9:55 am

Re: How can I enable automatic connection to more than one server?

Post by CraftyClown » Sun Jan 07, 2018 6:32 pm

TinCanTech wrote:
Sun Jan 07, 2018 1:30 pm
CraftyClown wrote:
Sat Jan 06, 2018 2:49 am
I have tried placing them in separate sub folders, but that doesn't seem to work and they can't all go in the same folder because of the multiple ca.crt files clashing
They can go in sub-folders.

See --config file in The Manual v24x

Thank you TinCanTech,

So I do have my files in separate sub folders, each is set up to use different UDP ports and I have two tap adapters installed. Is there something else I might have missed here?

My config files for the two connections are as follows:

Code: Select all

client
dev tun
proto udp
remote indigorebel.ddns.net 1194
resolv-retry infinite
nobind
persist-key
persist-tun

ca ca.crt
cert client2.crt
key client2.key
ns-cert-type server
cipher AES-128-CBC
comp-lzo
verb 4
float

Code: Select all

client
dev tun
proto udp
remote craftyclown.ddns.net 1196
resolv-retry infinite
nobind
persist-key
persist-tun

ca ca.crt
cert home2.crt
key home2.key
ns-cert-type server
cipher AES-256-CBC
comp-lzo
verb 4
float

User avatar
Pippin
Forum Team
Posts: 1201
Joined: Wed Jul 01, 2015 8:03 am
Location: irc://irc.libera.chat:6697/openvpn

Re: How can I enable automatic connection to more than one server?

Post by Pippin » Sun Jan 07, 2018 8:03 pm

Hi,

Try one with tun0 and the second with tun1

CraftyClown
OpenVPN Power User
Posts: 69
Joined: Sat Nov 01, 2014 9:55 am

Re: How can I enable automatic connection to more than one server?

Post by CraftyClown » Mon Jan 08, 2018 1:26 am

Pippin wrote:
Sun Jan 07, 2018 8:03 pm
Hi,

Try one with tun0 and the second with tun1
Thanks Pippin, I tried changing the config scripts as below, however no joy :(

Is there anything else I might be missing here?

Code: Select all

client
dev tun0
proto udp
remote craftyclown.ddns.net 1196
resolv-retry infinite
nobind
persist-key
persist-tun


ca ca.crt
cert home2.crt
key home2.key
ns-cert-type server
cipher AES-256-CBC
comp-lzo
verb 4
float

Code: Select all

client
dev tun1
proto udp
remote indigorebel.ddns.net 1194
resolv-retry infinite
nobind
persist-key
persist-tun


ca ca.crt
cert client2.crt
key client2.key
ns-cert-type server
cipher AES-128-CBC
comp-lzo
verb 4
float

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: How can I enable automatic connection to more than one server?

Post by TinCanTech » Mon Jan 08, 2018 1:01 pm

what do your logs say ?

CraftyClown
OpenVPN Power User
Posts: 69
Joined: Sat Nov 01, 2014 9:55 am

Re: How can I enable automatic connection to more than one server?

Post by CraftyClown » Mon Jan 08, 2018 2:40 pm

TinCanTech wrote:
Mon Jan 08, 2018 1:01 pm
what do your logs say ?

Both of the service logs read the same:

Code: Select all

Options error: --ca fails with 'ca.crt': No such file or directory (errno=2)
Options error: --cert fails with 'home2.crt': No such file or directory (errno=2)
Mon Jan 08 14:26:47 2018 us=400157 WARNING: cannot stat file 'home2.key': No such file or directory (errno=2)
Options error: --key fails with 'home2.key'
Options error: Please correct these errors.
Use --help for more information.

Code: Select all

Options error: --ca fails with 'ca.crt': No such file or directory (errno=2)
Options error: --cert fails with 'client2.crt': No such file or directory (errno=2)
Mon Jan 08 14:26:47 2018 us=371581 WARNING: cannot stat file 'client2.key': No such file or directory (errno=2)
Options error: --key fails with 'client2.key'
Options error: Please correct these errors.
Use --help for more information.
This is only an issue when both sets of files are in sub folders. If I move either set into the root of the config folder, that connection will work. Both connections work manually as well, only the automated service is having a problem.

CraftyClown
OpenVPN Power User
Posts: 69
Joined: Sat Nov 01, 2014 9:55 am

Re: How can I enable automatic connection to more than one server?

Post by CraftyClown » Tue Jan 09, 2018 5:12 pm

Anyone have any suggestions?

CraftyClown
OpenVPN Power User
Posts: 69
Joined: Sat Nov 01, 2014 9:55 am

Re: How can I enable automatic connection to more than one server?

Post by CraftyClown » Thu Jan 11, 2018 1:15 pm

I'm still struggling to get two connections working simultaneously. Is there a better place for me to be asking for assistance with this?

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: How can I enable automatic connection to more than one server?

Post by TinCanTech » Thu Jan 11, 2018 1:29 pm

CraftyClown wrote:
Mon Jan 08, 2018 2:40 pm
Options error: --ca fails with 'ca.crt': No such file or directory (errno=2)
Options error: --cert fails with 'home2.crt': No such file or directory (errno=2)
Mon Jan 08 14:26:47 2018 us=400157 WARNING: cannot stat file 'home2.key': No such file or directory (errno=2)
Options error: --key fails with 'home2.key'
Options error: Please correct these errors. Use --help for more information.


Please read this:
https://openvpn.net/index.php/open-sour ... tml#config

Post Reply