A low-powered home server is one of the best ways to download files using BitTorrent and Usenet, but if you want to minimise legal hassles you need to anonymise your traffic. Here’s how to turn your FreeNAS box into the ultimate downloading machine so you can download safely and monitor its activity from anywhere.
Reminder: downloading and sharing material you don’t own the copyright to is illegal. The decision on whether you do that is entirely up to you.
We’ve shown you how to turn an old computer into a networked backup, streaming and torrenting machine with FreeNAS. We’ve also shown you how to take that macjine to the next level by installing Usenet and media management programs on it. But even with all that power, our downloading machine is missing a few things:
- A VPN service that can anonymise all our traffic to keep it safe from prying eyes;
- A method of monitoring our system from the internet, so you can keep track from another machine or a mobile phone.
In this guide, we’ll show you how to add both of these features, turning your home server into the ultimate anonymous downloading machine.
Note: If you’re just starting out, we recommend checking out our other FreeNAS guides first. Our original guide will show you how to set up FreeNAS 7, while our second guide will show you how to install programs manually, using Usenet as an example. Keep in mind that, while we’re still referring to it as FreeNAS to keep some consistency with earlier guides, these guides use the FreeNAS 7 project, now known as NAS4Free, instead of the more recent FreeNAS 8. This guide should work whether you have an old FreeNAS 7 box or a new NAS4Free box — they’re essentially the same piece of software.
Set Up A VPN For Anonymous Downloading
We’ve said it before, and we’ll say it again: the only way to stay anonymous is by using a proxy or VPN service. Yes, that costs money — typically around $US10 a month or so — but these days, you shouldn’t download without one. Unfortunately, FreeNAS doesn’t come with a VPN, so you’ll need to set it up from scratch. Fortunately, that isn’t too hard — you just need to find a VPN service that works for you.
What You Should Look For In A VPN
lot of fine VPN services out there
- OpenVPN support without plain-text authentication. Most VPNs support OpenVPN — which is what we’ll be using on our NAS — but many of them require you to store your username and password in a plain text file. Not only is this insecure, it requires additional features make the installation more complicated. If you’re considering a VPN service, check its guides on how OpenVPN operates. There won’t usually be any guides for FreeBSD, but the Linux guide should be a good example. If the service requires some sort of
password.txtfile rather than a
.keyfile, you’ll want to look elsewhere.
- Support for port forwarding is essential for monitoring your machine from other devices. Without this option, you won’t be able to specify which ports on the VPN go to your NAS. Check your VPN’s FAQ to see if it supports port forwarding if you want to use Dynamic DNS (and note that this is different from the port forwarding on your router — it’s a built-in feature of the VPN service itself).
- BitTorrent support. Some privacy servers have clauses against using their services for BitTorrent. If you’re using BitTorrent on your NAS, you obviously want to make sure your VPN allows it.
- Other privacy features depending on your needs. If you’re aiming for anonymity, you should obviously look for a VPN client that doesn’t log activity, but you may also want one that accepts Bitcoin payments or is routed through a specific country to enable access to content from that country.
In this guide, we’ll be using a VPN service called Mullvad as an example. It works well, but I strongly recommend you research other VPN services that fit your specific needs. Photo by Pavel Ignatov (Shutterstock).
Step One: Set Up A Jail For Installing New Programs
We’ll need to install OpenVPN from the FreeBSD command line, in the same way we did with SABnzbd and Sick Beard in our previous guide. Before you do this, you’ll need to set up a “jail” on your system, which allows you to install programs on one of your NAS’ drives (since our FreeNAS installation resides on a flash drive).
If you followed our guide to setting up SABnzbd and Sick Beard, you can skip this step and move on to step two of this guide, since you’ve already done all of this.
First, SSH into your NAS. Windows users should download PuTTY, and type in the IP address of your NAS on the main page. You’ll want to log in as
root and type in the password you created for yourself when you set up the NAS. If you’re on OS X, type this command into the Terminal and press Enter.
ssh -l root 192.168.0.10
In this example,
192.168.0.10 should be changed the IP address of your NAS.
Once you’ve logged in as
root, you’ll need to create a few folders and mount them, using the following commands. Replace
SEAGATE with the drive on your NAS where you’ll store the programs.
cd /mnt/SEAGATE mkdir extensions cd extensions mkdir var mkdir usr mkdir tmp mount_unionfs -o w /mnt/SEAGATE/extensions/usr/ /usr/ umount -f /var mount_unionfs -o w /mnt/SEAGATE/extensions/var/ /var/
This puts your
tmp folders on an actual hard drive where you’ll be allowed to install programs that don’t come with your NAS. You’ll want to run a few of these every time you start up your NAS from now on, so head to your NAS’ web interface and go to System > Advanced > Command Scripts and add the following command to the list as a
mount_unionfs -o w /mnt/Media/extensions/usr/ /usr/
When you’re done, head to step two.
Step Two: Install OpenVPN
We’re going to use OpenVPN to connect to our VPN service. Assuming you’re running the newest version of NAS4Free, which is based on FreeBSD 9, run the following commands:
setenv PKG_TMPDIR /mnt/SEAGATE/extensions/tmp/ setenv PACKAGESITE "ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9-current/Latest/" pkg_add -rv openvpn
If you’re using an older version of FreeNAS, check which version of FreeBSD it’s based on from the home page of the Web interface. The chances are good that it’s FreeBSD 7.3, in which case you’ll want to install OpenVPN with the following commands instead:
setenv PKG_TMPDIR /mnt/SEAGATE/extensions/tmp/ setenv PACKAGESITE "http://ftp6.us.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-7.3-release/Latest/" pkg_add -rv openvpn
NAS configurations often differ, so make sure you’re installing the correct package for your NAS’ software. You’ll also want to replace
amd64 if your NAS is 64-bit.
Step Three: Set Up OpenVPN With Your VPN Service
First, we’re going to edit our config file. Open it up in your favourite text editor (the Linux one is best, if it exists) and take a peek inside. It should look something like this:
client dev tun proto udp remote openvpn.mullvad.net 1194 resolv-retry infinite nobind persist-key persist-tun ca master.mullvad.net.crt cert mullvad.crt key mullvad.key remote-cert-tls server comp-lzo verb 3 ping-restart 120 ping 10
Usually it will have some instructions inside, too, so you know what each setting does. Most of the defaults should be fine, but if you have any trouble, try some of the above settings and see if they work (obviously using your VPN’s server under
remote and the correct file names under
cert and or
When you’re done, SSH back into your NAS and run the following command:
Lastly, open up your NAS’ web interface and head to System > Advanced > rc.conf and add the following variables:
openvpn_enable with a value of
openvon_if with a value of
Once you’ve saved those variables, continue to the next step to try running OpenVPN for the first time.
Step Four: Start OpenVPN
Once all your config files are in place and your ports are forwarded, it’s time to try running OpenVPN for the first time. Open up your NAS’ web interface and go to Advanced > Command. Type the following command into the “Command” box and press Execute:
/usr/local/etc/rc.d/openvpn start /usr/local/etc/openvpn/openvpn.conf
openvpn: Initialization Sequence Completed
If it didn’t work, you may need to change some settings in your config file. Look for any errors you see in your log and try it again. If OpenVPN is running but you can’t connect, you’ll need to go to Advanced > Command and run
kill 1234 before trying again, where
1234 is the process ID of OpenVPN. You’ll see this in the log; note it will change every time you restart OpenVPN.
This is the hardest part of the process, and troubleshooting the problem will require different steps depending on your VPN service and the other software you have running on your NAS. Don’t give up, and make sure to follow all the instructions from your provider to the letter to get everything working. If you’re using BitTorrent, now would be a good time to check your torrent client’s IP using CheckMyTorrentIP.com, as described in step three of our BitTorrent anonymisation guide. If you get your VPN’s IP, then you’ve successfully set up an anonymous downloading NAS!
Step Five: Set Up Your Firewall
The last thing you should do, once your VPN is up and running, is set up a firewall on your NAS that blocks all traffic except your VPN connection. That way, if your VPN goes down, your NAS won’t fall back on your regular connection, which can expose your actual IP and destroy any anonymity you may have had.
In your NAS’ web interface, go to Network > Firewall. Firewall settings vary, but here’s a template you can use to create your rules:
Click on the image for a closer look. Going number by number in the image, here’s what each set of rules does:
- This rule allows all local traffic on your network. That way, no matter what happens, you can still access your NAS and its web interface from your other computers.
- These two rules enable your DNS connection, which usually travels along port 53.
- These two rules allow your VPN to establish a connection. The rule in the screenshot assumes your VPN uses port 1194 to do so. If you use a different port in your OpenVPN config file, use that here instead.
- These rules allow any traffic that travels over the VPN, such as your downloading. These may be different depending on your VPN service you use. Look in the log when you connect and see what IP addresses it uses in its routes. For example, mine uses addresses like
10.8.0.169, so I added
10.8.0.0/24to my firewall to allow any connections from that range of IP addresses.
- These rules allow multicast connections, which your NAS will need if it uses services like Bonjour to connect to other computers on your home network. Not everyone needs these open, but you may — if you don’t add these rules, you’ll generally just see a few minor errors in your log from time to time.
- These two rules allow DHCP, if your NAS uses it. If you have a static IP, you don’t need this rule.
- Lastly, this rule denies all other traffic that doesn’t match the above rules. For our purposes, this basically means all traffic that doesn’t go through the VPN. If your VPN goes down, your NAS won’t be able to access the internet, and everyone trying to peep on your downloading will not be able to see who you are.
Again, your firewall may differ in some of the details, but this is a good place to start. Click the Plus sign to add each individual rule, and when you’re done, check the Enable box and click “Save and Restart” in the bottom left corner. Head back to your SSH window and try to
ping www.google.com again, first with OpenVPN running, and then after you’ve killed OpenVPN as described in step four. The ping should work correctly when OpenVPN is running, and return errors when OpenVPN isn’t running. Again, if it doesn’t work correctly, you may have to fiddle with some settings until you get it right.
Once everything’s working properly, give yourself a pat on the back, because you’ve now anonymised all the traffic coming in and out of your NAS! It’s not an easy process, especially because it’s a little different for everyone, but it can be done.
Monitor Your Downloads With Dynamic DNS
So you’ve got yourself a kickass downloading machine, but what happens when you’re out and about and come across a file you’d like to download? Or maybe you want to check in on your server and see what TV shows you’ve downloaded or ripped to your home theatre PC? By default, you can’t access your NAS from outside your home network, but a few tweaks make that possible.
Step One: Sign Up For A Dynamic DNS Service
talked about how to do this beforeDynDNSNo IP
Before you sign up, check your router’s admin page to see which services your router supports. Mine only supports DynDNS, for example, so that was the one I had to use. Other routers may support different services, so check the Dynamic DNS settings of your router for more info.
Step Two: Set Up Dynamic DNS on Your Router and NAS
Next, do the same thing on your NAS. Open up your NAS’ web interface and go to Services > Dynamic DNS. Pick your provider, type in your domain name and credentials, then check the Enable box in the upper-right corner. Click the Save and Restart button to start the service.
Step Three: Forward Any Necessary Ports
Lastly, you’ll probably need to forward a few ports on your router so your NAS is accessible from the outside world. Once again, we’ve talked about this before, so check our guide to port forwarding if this is the first time you’ve done it.
You’ll also need to set up port forwarding from your VPN service’s web site. Otherwise, your VPN won’t know who you are when you try to connect from the outside world (since a number of other users are using the same VPN as you). Head to your VPN’s home page, log in, and look for the section on port forwarding. (If you’re using Mullvad, it’s on the main page after you log in). Click the New button to add a new port. Your VPN service usually dictates how many you’re allowed to have.
Step Four: Try Accessing Your NAS From Elsewhere
Lastly, try to access one of your web interfaces using your new hostname. For example, if your hostname is
myawesomenas.dynalias.org and your newly-assigned BitTorrent port is 12345, you would type the following into your address bar to access it:
Again, repeat this process for any other services you have running such as SABnzbd or Sick Beard. If everything works, then congratulations! Now you can monitor your downloads, add new downloads, and otherwise keep track of your NAS from anywhere on any device.
It isn’t a simple process, and it can be a little different for everyone, but all the setup is well worth it. When you’re done, you’ll have a quiet, low-powered machine that stays on 24/7 and downloads all your files for you, completely anonymously, with easy access from wherever you are. If you run into any problems during setup, be sure to check out the NAS4Free forums, the OpenVPN forums, the FreeBSD forums, or the comments of this post. Good luck!