OpenVPN does not work after server restart

This forum is for admins who are looking to build or expand their OpenVPN setup.

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
User avatar
Kulturmensch
OpenVPN User
Posts: 28
Joined: Tue Feb 16, 2016 8:06 am
Contact:

OpenVPN does not work after server restart

Post by Kulturmensch » Mon Jan 08, 2018 9:05 am

My openvpn installation (V-Server, Ubuntu 16.04 LTS and Plesk Onyx) works fine exept for a reboot of the server. Then although the vpn between desktop and server works but the server does not any longer accept outgoing traffic.

After having manually used the commands:
1. => net.ipv4.ip_forward=1
and
2. => iptables -t nat -A POSTROUTING -o venet0 -s 10.8.0.0/24 -j MASQUERADE
everything works fine again.

As recommended the first command is set in sysctl,conf and the 2nd one in rc.local. This worked in my old server but it does not work in the new one.

Do you have any solution for this?

Skaperen
OpenVPN Power User
Posts: 89
Joined: Fri Aug 05, 2011 3:02 pm
Contact:

Re: OpenVPN does not work after server restart

Post by Skaperen » Wed Jan 10, 2018 4:10 am

in these scripts redirect all the output to files you can go read. maybe the output has a clue to what went wrong. before your commands in these scripts put:

Code: Select all

exec 1>/var/`basename $0`.log
exec 2>&1
or

Code: Select all

exec 1>/var/somenamyoucanremember.log
exec 2>&1
reboot and check your results.

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

Re: OpenVPN does not work after server restart

Post by TinCanTech » Wed Jan 10, 2018 1:04 pm

1. see /etc/sysctl.conf

2. google "iptables-persist"

Post Reply