SOLVED Auto start openVPN on FreeNAS-Server

Status
Not open for further replies.

marove

Cadet
Joined
Dec 22, 2016
Messages
9
Hello together,

I hope this question is not completely dumb but I'm pretty new to BSD. My FreeNAS-Server stands behind a Firewall which does not allow connections from the Internet to the Server. Fortunately I have a Server running openVPN in the Internet. I've seen that openVPN is already preinstalled on the BSD-Machine and the test of my config just runs fine. All I now want to do, is to autoconnect the freeNAS-Server to my VPN-Server.

What is the best way to start openVPN on startup? Is there any "systemctl" equivalent? I've read, that I can add:

openvpn_enable="YES"
openvpn_configfile="/usr/local/etc/openvpn/client.conf"


Is this the way I should go? And is this way also update-proof?

Regards
Marove
 

marove

Cadet
Joined
Dec 22, 2016
Messages
9
Hello m0nkey_,

thank you for your reply. Unfortunately I was not able to create a working start/init-script or command. The command didn't work and the script has to lay on a mounted volume, which is not possible, because the volume is encrypted and does not mount automatically. I found a solution and have written a small blog entry here: https://www.timoschindler.de/automatischer-aufbau-einer-openvpn-verbindung-beim-start-von-freenas/ (unfortunately in German).

In short for everybody here:

1. Copy all needed openvpn-files to a directory on the server.
2. Add the following to /conf/base/etc/rc.conf :

Code:
# Start openVPN
openvpn_enable="YES"
openvpn_if="tun"
openvpn_dir="/root/vpn"
openvpn_configfile="/root/vpn/client.conf"


Restart and everything should work fine. You can also check /var/log/messages for any error messages.
Thanks for the hint and your help :).
Regards
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
Modifying anything in /conf is not recommended. Next update, your changes may be lost. Please use the tunables UI in the GUI to make these kinds of additions to rc.conf. This way your changes will survive an upgrade.
 
Status
Not open for further replies.
Top