After rebooting, OpenVPN crashes and does not turn on

Hello everyone.

Please tell me what needs to be done in Lucy so that after turning off the router or rebooting, OpenVPN does not crash (disconnect)
When I set up OpenVPN everything works, but as soon as I reboot the router it crashes.

vpn1

define "crashes" ?

1 Like

Read the system log. OpenVPN logs each step of the connection process and will tell you what failed. tun0 will not exist until OpenVPN has succesfully connected to the server.

1 Like

Try adding this to the OpenVPN configuration.
--connect-retry <n> <m>: First retry after n seconds, then m seconds for subsequent retries. Something like: connect-retry 60 30.

1 Like

Sorry, I didn't understand your question, could you ask more precisely?

I agree with you, we need to look at the logs, from what point is it better to do this? For example, I turn off the router, then turn it on, see that OpenVPN is not working and see what is preventing this from happening, right?

Thank you for your recommendation. I understood you correctly that what you wrote needs to be added to the path Services => OpenVPN => Edit openvpn config file

But I did not understand where in the configuration file it is better to place it ?

I tried to insert what you recommended before verb3 but unfortunately it didn't work, I also looked at the logs for errors and I see:

daemon.err openvpn(usa)[1228]: RESOLVE: Cannot resolve host address: vpn.proton.org:443 (Try again)

 daemon.err hostapd: Configuration file: /var/run/hostapd-phy0.conf

Which means your internet connection is not (yet) up to reach vpn server. Nothing crashes, it just does not attempt to reconnect later.

3 Likes

It can help if you show us your configs, please connect to your OpenWRT device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button.
Remember to redact keys, passwords, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network
cat /etc/config/dhcp
cat /etc/config/firewall
ip route show
cat /etc/config/openvpn
for ovpn in $(ls /etc/openvpn/*.ovpn);do echo $ovpn; cat $ovpn; echo;done
for vpn in $(ls /tmp/etc/openvpn*.conf);do echo $vpn;cat $vpn;echo;done
logread | grep openvpn
1 Like

Easy. You stated:

Describe this "crash". Provide precise details.

1 Like

seems OP doesn't know what it means - After rebooting, OpenVPN crashes and does not turn on - #5 by tom1995.

Yea, I quoted it. I guess the OP is as unsure as we are (from lack of information).

1 Like

Thank you, I will try to do it well and publish it.

Thank you for deciphering, I understand. We will continue to look for the cause.

That is difficult to tell since i cannot view your script, but im sure you have nobind ,fast-io or pull somewhere, insert it after the last one you can find in your script.

It might help if we see your configs, please connect to your OpenWRT device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button

Remember to redact keys, passwords, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network
cat /etc/config/dhcp
cat /etc/config/firewall
ip route show
cat /etc/config/openvpn
for ovpn in $(ls /etc/openvpn/*.ovpn);do echo $ovpn; cat $ovpn; echo;done
for vpn in $(ls /tmp/etc/openvpn*.conf);do echo $vpn;cat $vpn;echo;done
logread | grep openvpn

I looked at what you asked, it seems to me that it will complicate the answer to my simple question. What you ask is redundant information for solving this problem. As I already wrote, everything works correctly for me, I don’t need instructions on how to set up OpenVPN, it works!
I need to understand why when I reboot the router, the settings are reset.

I looked, this is what I have:

client
dev tun
remote  us.proton.org 443
resolv-retry infinite
nobind
persist-key
persist-tun
auth-nocache
verb 3
remote-cert-tls server
comp-lzo no
data-ciphers
data-ciphers-falback
proto tcp

There is no indication anything ever crashed. Does that answer your question by rendering it unfounded thus invalid?

1 Like