Clean Disconnect and Reconnect OpenVPN Service + DNS Questio

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
ChrisCa
DD-WRT Novice


Joined: 26 Feb 2019
Posts: 33

PostPosted: Sun Sep 12, 2021 10:57    Post subject: Clean Disconnect and Reconnect OpenVPN Service + DNS Questio Reply with quote
Hello,

i had frequently issues with my openvpn connection as i get in the log soft-auth-errors, rebooting the device 20 times, sometimes fixed the issue, and i got a vpn connection established sometimes not. Even sometimes pressing Apply Settings again, worked, sometimes not. I was wondering if the VPN Connection is not clean disconnected, and i could use additional command to safe disconnect / reconnect the connection. I was wondering if i should add under Administration - Commands - Startup / Shutdown the following:

Code:
root stopservice openvpn
root startservice openvpn

or the following on Shutdown:
Code:
killall -s SIGUSR1 openvpn


Or if i should create an Additional Cron Job and do this per day:
Code:
0 5 * * * root stopservice openvpn; sleep 30; startservice openvpn

What would be the best solution?

Another question regarding the DNS Server is:

My Provider has a Public DNS Server, and the others are Not Public.

The Public DNS Server is used to establish the VPN Connection, if the Connection is Up and running just the Private DNS Servers are used, as they are closer anyhow to my Location.

I was wondering if i could add a command or something to my VPN Config, that the Public DNS Server is used till the Connection is UP and running, and afterwards just the Private DNS Servers are used?

Actually i use the following additional settings for my OpenVPN Connection:

Code:
tls-client
tls-cipher TLS-DHE-RSA-WITH-AES-256-CBC-SHA
key-direction 1
resolv-retry infinite
keepalive 10 60
nobind
persist-key
persist-tun
persist-remote-ip
verb 3

Thanks,
Crisca
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12839
Location: Netherlands

PostPosted: Sun Sep 12, 2021 11:34    Post subject: Reply with quote
We can provide better assistance if you follow the forum guidelines link in my signature at the bottom of this post.

What router and what build?

To which VPN provider?

Except for the keepalive settings you should not need anything in additional Config.

Openvpn documentation see also my signature.

There you can also find a script to restart the connection aka a watchdog script.

Depending on build used the router starts with your regular DNS and then automatically use the pushed DNS server of the provider, assuming you use DNS in strict order.

Also explained in the Openvpn documentation

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
ChrisCa
DD-WRT Novice


Joined: 26 Feb 2019
Posts: 33

PostPosted: Sun Sep 12, 2021 11:50    Post subject: Reply with quote
Hello,

thanks for your reply. I use Linksys WRT3200ACM Router.

I had a long time no issue with Build r46716 and updated yet to r47282.

Provider is I V P N

I red already the Openvpn documentation.

But was wondering what could be adapted, what is the best solution, as it seems the sessions build up on the VPN Servers, and when the limit is reached the servers answer with a soft-auth-error.

Thx
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12839
Location: Netherlands

PostPosted: Sun Sep 12, 2021 12:55    Post subject: Reply with quote
Unfortunately the OpenVPN client setup guide does not have any good instructions for IVPN so it is a bit of a guessing game.

Like I said you do not need any thing in additional config except the keep alive.

The guide will give some general instructions.

You can also add extra remote server addresses if one server is down (also explained in the guide)

However that probably will not solve the soft-auth problems for that you can try the watchdog script to automatically start the tunnel again.

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
ChrisCa
DD-WRT Novice


Joined: 26 Feb 2019
Posts: 33

PostPosted: Sun Sep 12, 2021 13:06    Post subject: Reply with quote
Thanks a lot egc for the information. Will try with the watchdog script, and the recommendation regarding just use keep-alive in additional config.

br
Chrisca
300000
DD-WRT Novice


Joined: 18 Aug 2011
Posts: 20

PostPosted: Sat Oct 09, 2021 12:43    Post subject: Reply with quote
If you dont like openvpn disconnected and click connect again you should add this line into Additional Config so it will reconnect automatics for you.

keepalive 50 130
remap-usr1 SIGHUP
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12839
Location: Netherlands

PostPosted: Sat Oct 09, 2021 13:15    Post subject: Reply with quote
Thanks for reminding Smile

(See Page 6 OpenVPN Client setup guide:
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327398
(a sticky in this forum Smile )

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum