TorGuard would like to thank Rick for this important step by step walkthrough:
nowadays, it is prudent to protect your privacy when downloading torrents on the net. Some trials have recently been brought against ISPs by companies for damages allegedly users download illegal content. Many of these lawsuits have focused on trying to get the ISP to release the client IP address lists and their associated activity logs. After using FreeNAS and more recently NAS4Free the Bitorrent client ', I thought it would be interesting to see if we could OpenVPN installed and running though the firewall NAS to ensure only protected traffic is channeled through our customer BT.
I'm currently using Torguard for VPN and I can highly recommend them. They offer many places around the world, are reasonably priced and have excellent customer service when you need them. Here are the steps I followed to get VPN working on my NAS4Free Server:
- You will need a VPN provider for this course . Click here to try Torguard.
- You will also need to know how to connect to your server using SSH (not covered in this guide.)
- Prepare the environment: SSH and create the following directories on one of your NAS mounted drives (/ mnt / your player). In this example, I'm using "Media2".
cd / mnt / Media2
mkdir extensions
cd extensions
mkdir var
mkdir usr
mkdir tmp
mount_unionfs -ow / mnt / Media2 / extensions / usr / local / usr /
umount -f / var
mount_unionfs -ow / mnt / Media2 / extensions / var / / var /
- Create boot command environment:
in NAS4Free , go to "system | Advanced | command scripts" and insert the command following startup:
mount_unionfs -ow / mnt / media / extensions / usr / local / usr /
(make sure you replace "Media2" with your correct path)
- Install OpenVPN
setenv PKG_TMPDIR / mnt / Media2 / extensions / tmp /
setenv PACKAGESITE "setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-current/Latest/"
pkg_add -rv openvpn
(if you install on a 32-bit system change "amd64" to "i386")
- Install Certificates and .ovpn. files
Create the directory:mkdir / mnt / Media2 / extensions / usr / local / etc / local openvpn
Go to Torguard and obtain certificates and zipped file .ovpn so you can securely connect to the network Torguard. Unzip the OpenVPN config files (Installation Manual) in your OpenVpn folder you just created above
Choose one of .ovpn * files and change it :. "Openvpn.conf"
(although later you can use the * .ovpn files directly by specifying them in the script autosignon if you want)
- Test our setup so far:
#START VPN
/usr/local/etc/rc.d/openvpn start / usr / local /etc/openvpn/openvpn.conf
(Torguard enter your username and password)
#test VPN
ifconfig tun0
(you should see something like this: $ ifconfig tun0 tun0: flags = 80510 mtu 1500 metric options = 80000 inet6 fe80 :: 216: 76ff: fedb: B529 64% tun0 prefixlen ScopeID 0xc inet 10.8.0.26 - > 10.8.0.25 netmask 0xffffffff Options ND6 = 21 Opened by PID 2991)
This means that the tunnel is running!
- Configure the firewall rules to ensure all WAN traffic goes through the VPN.
If you use the NAS to other WAN-wise purposes, remember that there is no way to send only traffic through the VPN BT. In this configuration, all related WAN traffic will use the VPN tunnel.
Click here to download the rules of firewall at hand. Go to "Network | Firewall" and import the rules and allow
Remember to change the destination subnet to jive with the network of your VPN provider (Torguard s is 10.8 .0.54 / 24) [
- now, we need to automate this sucker survive reboots.
We need to install "wait".
pkg_add -r wait
- Create a file autosignon in your directory OpenVPN and add the following code:
# / usr / local / bin / expect -f
set force_conservative 0
if {} {$ force_conservative
set send_slow {1} .1
proc send ignore arg {} {
sleep .1
exp_send -s - $ arg
}
} openvpn.conf openvpn spawn
match_max 100000
wait -exact "Enter auth Username "
send -" YOUR_USERNAME_HERE r "
wait -exact" Enter auth Password: "
send -"YOUR_PASSWORD_HERE
r "
expect eof
- Add the "autosignon" script at startup in the "system | Advanced | command scripts "
/ mnt / Media2 / extensions / usr / local / etc / openvpn / autosignon; ./autosignon &
- Test it in: "Advanced | Run Command "
Ensure that OpenVPN is stopped (if it is running before):/usr/local/etc/rc.d/openvpn stop
Run the script by running autosignon:/ mnt / Media2 / extensions / usr / etc / openvpn / autosignon / local; ./autosignon &
Check it out by running :.ifconfig tun0
Make sure you see the same output of step 7 above
Try pinging google.com from the command window.
this is what you should be good to go if something does not work check the server logs at :. "Diagnosis! | Log "
Here are some quick OpenVPN commands for troubleshooting:
- # Stop all openvpn process
-TERM killall openvpn
- connection # check
ifconfig tun0
- #stop openvpn
/ usr / local / etc / rc.d / openvpn stop
0 Komentar