Client reconnect time

Scripts to manage certificates or generate config files
Post Reply
DJrunkie
OpenVpn Newbie
Posts: 3
Joined: Sat Aug 29, 2020 9:24 pm

Client reconnect time

Post by DJrunkie » Sun Aug 30, 2020 10:35 pm

Hi I have two OpenVPN servers and was testing the reconnect time using the latest OpenVPN Connect Client.

I'm trying to make it take between 2 - 4 seconds before it decides to try the next server, right now with these client.ovpn settings it takes 10 seconds minimum.

Here is my client.ovpn minus the certs.
Client config

client
nobind
proto udp
<connection>
remote 67.225.129.129 1198 udp
ping 2
ping-restart 4
keepalive 2 4
server-poll-timeout 2
connect-timeout 2
connect-retry 2
connect-retry-max 1
</connection>

<connection>
remote 69.16.214.164 1198 udp
ping 2
ping-restart 4
keepalive 2 4
server-poll-timeout 3
connect-timeout 3
connect-retry 3
connect-retry-max 1
</connection>
dev tun
persist-key
persist-tun
auth-nocache
verb 3
reneg-sec 86400
cipher aes-256-cbc

If the first server is offline on the initial connection attempt then it takes 10 seconds to timeout, and then tries the next server.

If you're connected to the first server, and it goes offline while connected it takes 4 seconds to timeout, and then 10 seconds before it attempts the next server.

I cannot for the life of me figure out where this 10 second timeout is controlled. Anyone have any insight? As you can see I've tried using multiple directives to control this, and I've done google searching for over an hour now trying to get this figured out.

Thank you!
Last edited by Pippin on Mon Aug 31, 2020 8:50 am, edited 1 time in total.
Reason: Formatting

DJrunkie
OpenVpn Newbie
Posts: 3
Joined: Sat Aug 29, 2020 9:24 pm

Re: Client reconnect time

Post by DJrunkie » Mon Aug 31, 2020 12:21 am

Ok figured it out... of course it was this easy.

You have to put this directive outside of the <connection> section. `server-poll-timeout 2`
Client config

client
nobind
proto udp
server-poll-timeout 2
<connection>
remote 67.225.129.129 1198 udp
keepalive 1 3
connect-timeout 3
connect-retry 2
connect-retry-max 1
</connection>

<connection>
remote 69.16.214.164 1198 udp
keepalive 1 3
connect-timeout 3
connect-retry 2
connect-retry-max 1
</connection>

Now it waits 2 seconds on the reconnect before attempting the next server instead of 10 thanks to server-poll-timeout being out of the <connection> section.
Last edited by Pippin on Mon Aug 31, 2020 8:51 am, edited 1 time in total.
Reason: Formatting

Post Reply