Has anyone successfully set up a CLI-only (no web UI's!) torrent client that can tunnel all of its traffic through a VPN? (Either by sending all traffic through a particular interface or a SOCKS proxy)?
I have a Private Internet Access subscription and would like to use it to download torrent files on my headless Debian 7 machine without having to tunnel all of the traffic on my system.
Best Answer
The approach I would recommend is to route all your traffic through the VPN except SSH; this provides much more protection for your privacy and significantly reduces the risk of any personal information leaking.
This approach has several separate components.
Torrent client
rtorrent is an excellent torrent client for running in a headless environment. Run it in a tmux session so you can connect and disconnect at will.
Additionally, you can patch rtorrent with the canvas colour patch.
Routing traffic
Essentially, you want to set up packet filtering for all traffic on a specific port (your SSH port, here assumed to be non-standard 666) and interface (eth0). You can discover your gateway (here 192.168.1.1) with
route -n
. You will also neediproute2
installed for this:Once you have it all setup and working, you'll need to script it to run at boot. See Ben. D's answer on Serverfault for a full walkthrough.
Browsing
Surfraw is excellent for command line browsing, and can hand off to w3m for loading the returned results.
Thanks to Gilles excellent answer here, it is possible to bind a key in w3m to trigger the magnets script from the rtorrent wiki. So, with this in your w3m config:
when you navigate to a magnet link, you can send it to rtorrent. See this post for the details.