You are not logged in.

#1 2018-05-22 22:47:57

Belph
Member
Registered: 2018-04-08
Posts: 26

[solved] OpenVPN: how to let it choose the best server

Aloha,

I am not sure if this is the right section to post this question into, excuse me if it is not smile.

I wanted to ask if it is possble to let OpenVPN ping a couple of server, that I added to a list, and then automatically connect to the best one. I hoped I could set it up to just pick the fastest one upon clicking "connect".



<3 Belph

Last edited by Belph (2018-05-26 14:58:44)

Offline

#2 2018-05-22 23:29:13

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,238
Website

Re: [solved] OpenVPN: how to let it choose the best server

Belph wrote:

connect to the best one

Define "best".  Lowest ping? Fastest throughput? Prettiest rack-mount case?

Offline

#3 2018-05-22 23:42:11

Belph
Member
Registered: 2018-04-08
Posts: 26

Re: [solved] OpenVPN: how to let it choose the best server

fukawi2 wrote:
Belph wrote:

connect to the best one

Define "best".  Lowest ping? Fastest throughput? Prettiest rack-mount case?

Prettiest rack-mount case would be the best, I think.

Nah for real, fastest ofc. I hoped OpenVPN is able to ping several server I put in a list and pick the fastest one out of this list.

Offline

#4 2018-05-23 00:05:29

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,238
Website

Re: [solved] OpenVPN: how to let it choose the best server

OpenVPN doesn't have anything to do this; it will just round-robin multiple servers in the config file.

You could have a script that attempts to identify the server with lowest ping then connect to that.  Something like this:

fping -c3 -q archlinux.org ubuntu.org kernel.org 2>&1 | sort -t/ -k8 -n | head -n1 | cut -d' ' -f1

fping will send 3 pings (-c3) to each host and out only the summary (-q) which includes the average RTT.  We then sort by column 8, delimited by a forward-slash character. Then take the top line (`head`) which has the lowest RTT, and cut down to just the hostname/IP address (`cut`).

Offline

Board footer

Powered by FluxBB