When I start openvpn on the server with:
sudo openvpn /etc/openvpn/server.conf
It works and I can connect my client to it.
When I start it with:
sudo /etc/init.d/openvpn start
It appears to work as I see:
* Starting virtual private network daemon(s)...
* Autostarting VPN 'openvpn': missing /etc/openvpn/openvpn.conf file !
But I cannot connect the client to it.
Checking the port shows it as "closed" (in the sense that nothing is listening there... it is not closed by the firewall) in the latter case while "open" in the former.
So where is the disconnect? Is init.d not starting what I thought it would? Is it not loading the correct conf file (but then why do I not need to load openvpn.conf when I start the server directly)? Am I missing a parameter somewhere?
EDIT: Reason behind the solution
Examining the init.d script as suggested by JeffG showed it was getting the $NAME of the conf file from:
NAME=${NAME%%.pid}
Which then looks for:
$CONFIG_DIR/$NAME.conf
This made: NAME=openvpn
so then the script went looking for openvpn.conf
which does not exist as I named the file server.conf
(which is how the instructions on the openvpn site say to name the file). Simply copying that file over to be named as the init.d script wanted (Hyppy's solution) fixed the problem.
Try this:
Im quite new to Raspberi Pi and i ran into the same problem after i installed OpenVPN. It works when I start it via the CLI using:
openvpn --config /etc/openvpn/openvpn.conf
But whenever I start it via "/etct/init.d/openvpn start" or "service openvpn start" it doesn't seem to be reading my config file. This section on the startup script gave me a hint...
So i googled around how to autostart deamon on Raspbian. After enabling the openvpn to auto-start it worked for me.
update-rc.d openvpn enable
service openvpn start
i hope this helps :)
Check you init.d script. Ensure that it is using
/etc/openvpn/server.conf
for configuration