Transmission (seedbox) over VPN using OpenVPN

Transmission (seedbox) over VPN using OpenVPN

We have seen how to make Raspberry Pi a seedbox using Transmission using debian based distro, openSUSE and arch linux. Of course there are alternatives such as Deluge or rTorrent.

All of your network traffic should use your VPN connection, if it is active, so by default Transmission should tunnel all of your torrent traffic over the VPN. That's fine until your VPN connection drops and all of your torrent traffic starts using your regular internet connection, which is kind of what we were trying to avoid with the VPN in the first place.

In this tutorial we'll setup Transmission to only route our torrent traffic through the VPN, and if the VPN is not connected Transmission will just stop torrenting until the VPN is reconnected.

OpenVPN installation

First of all, let's install OpenVPN.

sudo apt-get update && sudo apt-get install openvpn

Create a directory in your home directory and download the OpenVPN files from your provider.

cd ~/
mkdir vpn
cd vpn

We will test with VPNbook. But there are plenty of great providers you can choose.


Download the files that doesn't say web surfing only; no p2p (for us it's PL226 Server OpenVPN Certificate Bundle and DE4 Server OpenVPN Certificate Bundle. But you better check often for changes).

Decompress the zip files and you'll have files such as


Make sure that those files are in the directory vpn in your home directory.

Create a file named password.txt in the same directory.

nano password.txt

And add the credentials you'll find at vpnbook page.

5bheau6u (that might change)

Now open one file

nano vpnbook-pl226-udp25000.ovpn

and find the auth-user-pass and point it to the txt file

auth-user-pass /home/USER/vpn/password.txt

That way you don't need to type the username and password every time you run the command.

Then, create a script to start your vpn connection and make it executable:

chmod +x

Now edit your script to look like this:


sudo openvpn --config /home/USER/vpn/vpnbook-pl226-udp25000.ovpn --script-security 2

The name of the ovpn file might be different for you.

Now you should be able to execute this script to connect to your vpn:


Now you are connected to the VPN and all of your traffic should tunnel through there.

You can check your ip.


* Naspberry pi OpenVPN
* OpenVPN forums (Password.txt file)
* OpenVPN on strech

Transmission Over OpenVPN

We need to create a template of our transmission-daemon setting.json file so that we can update the ip address that we download torrents through every time the VPN connects:

sudo cp /etc/transmission-daemon/settings.json /etc/transmission-daemon/settings_template.json

Open /etc/transmission-daemon/settings_template.json:

nano /etc/transmission-daemon/settings_template.json

And change the following value:

"bind-address-ipv4": "IP_ADDRESS",

Now setup a new script that OpenVPN will call when a VPN connection is successfully established.

sudo touch /etc/openvpn/
sudo chmod +x /etc/openvpn/

Open /etc/openvpn/ (as superuser):

nano /etc/openvpn/

and set it up like this:


/etc/init.d/transmission-daemon stop
sed s/IP_ADDRESS/$4/ /etc/transmission-daemon/settings_template.json > /etc/transmission-daemon/settings.json
/etc/init.d/transmission-daemon start

Now edit your script from the OpenVPN tutorial and update it to look like this:


sudo openvpn --config /home/USER/vpn/vpnbook-pl226-udp25000.ovpn --script-security 2 --up /etc/openvpn/

From now on, when you connect to the VPN it will force your torrent traffic to use the VPN connection, and if you get disconnected it should stop torrenting until you reconnect.

Transmission Over OpenVPN

Run in the background

Using screen as super user:

screen -S vpnbook -d -m ./

after that you can quit the terminal, also you can reattach to it by:

screen -r vpnbook

Another way to run in the background is by adding an &

/home/USER/vpn/ &

But you have to run the command every time you reboot.

Run Bash script in background and exit terminal

Some tutorials to check out:
* openvpn-install
* How to run your own OpenVPN server on a Raspberry PI
* OpenVPN Server raspberry pi /w PiVPN (video)

- All the above are for debian based distro. If you have another distro, check the directory of your json file.
- Change USER to your username.
- Download illegal torrents is prohibited. Please do not use this tutorial for illegal reason.

Δεν υπάρχουν σχόλια

Από το Blogger.