« Back to all guides

Install OpenVPN on FreeNAS

1. (Optional) Create jail

If you want OpenVPN to run in a jail, you must first create one. If you already have jail, or don't want to use it go to step 2.

Go to the FreeNAS GUI. In the menu, click on Jail -> Add Jail. Enter ovpn as the name for the jail.

2. Enable SSH

In the menu, click on Services. Make sure SSH is On. In the left menu, click on Services -> SSH. Make sure you allow password login for root.

3. SSH to the NAS

Use a SSH client to SSH to your NAS. If you're on Windows, we suggest Putty. If you're on MacOS or Linux, use the terminal.

4. Enter the jail (if created)

If you're using a jail, we now need to enter it. Write:


Locate the JID for the jail you want. The name for the jail is under the Hostname column.


5. Download components

pkg update && pkg upgrade && pkg install bash openvpn unzip curl

6. Exit and re-enter jail (if created)

exit jexec REPLACE WITH THE JID tcsh

7. Enable auto start

echo 'openvpn_enable="YES"' >> /etc/rc.conf
echo 'openvpn_configfile="/usr/local/etc/openvpn/openvpn.conf"' >> /etc/rc.conf

8. Download the configuration you want

9. Enter your login credentials

echo "username" >> /usr/local/etc/openvpn/credentials
echo "CHANGE TO YOUR PASSWORD" >> /usr/local/etc/openvpn/credentials

10. Start OpenVPN and see that everything works

/usr/local/etc/rc.d/openvpn start

11. Verify that the connection was successful

Wait about 30 seconds and then run:

curl https://www.ovpn.com/v1/api/client/ptr

You should see something like:

{"status":true,"ip":"the external ip","ptr":"PTR for the IP address"}

12. Done

Congratulations! Your device is now protected behind OVPN and will automatically connect on reboots. If you encountered any issues, please send the log file (/tmp/openvpn.log) to our support.