Torrent downloader with VPN only

Hello, I want to install transmission or rtorrent on my Dietpi and connect it to my openvpn that I have on external cloud VPS. I’m not good at that to make it manually so I find docker images like rtorrent-rutorrent-openvpn, transmission-openvpn or wireguard-transmission. I have openvpn and wireguard installed on my VPS. I use openvpn for my smartphone and laptops. I don’t know nothing about wireguard but try to learn so i first try wireguard. I install it on my VPS and on Dietpi. Then I do:
docker pull sebdanielsson/wireguard-transmission.
Next there’s some commands that I don’t know how to change to work with my Dietpi:

docker run --name wireguard-transmission \
--privileged \
-e "USERNAME=transmission" \
-e "PASSWORD=transmission" \
-e "INTERFACE=wg0" \
-e "KILLSWITCH=wg0" \
-p 51820:51820/udp \
-p 9091:9091 \
-v /path/to/wg-conf-dir:/etc/wireguard \
-v /path/to/transmission-conf-dir:/etc/transmission-daemon \
-v /path/to/transmission-complete-dir:/transmission/complete \
-v /path/to/transmission-incomplete-dir:/transmission/incomplete \
-v /path/to/transmission-watch-dir:/transmission/watch \
sebdanielsson/wireguard-transmission

I don’t know what to do in wireguard config.
Maybe more easy will be to use openvpn-transmission image?
If someone had time to help me, I would be very grateful.
Regards,
Przemek

Normally if you start the wireguard interface on your system and allow the whole internet as allowed IPs, then all traffic will go through the tunnel. The wireguard should be supported by dietpi scripts, so you need to set up the keys to both peers, exchange the public keys, and create the configuration file.

Looks like WIreguard delivered by the docker image is a server according the configuration. But you would need to have a client to be able to connect to your VPS Wireguard server.

More easier to install wireguard and transmission directly. The docker image make thinks more complicate. I don’t see any benefit on using docker in this case.

First start and complete your wireguard installation on your VPS. Once you have created the client configurations files on VPS side, you can install wireguard client on DietPi and transfer the client file. A small how-to is available on our online docs https://dietpi.com/docs/software/vpn/#wireguard-an-extremely-simple-yet-fast-and-modern-vpn

Once wireguard is working you can start with transmission

Looks like WIreguard delivered by the docker image is a server according the configuration. But you would need to have a client to be able to connect to your VPS Wireguard server.

More easier to install wireguard and transmission directly. The docker image make thinks more complicate. I don’t see any benefit on using docker in this case.

First start and complete your wireguard installation on your VPS. Once you have created the client configurations files on VPS side, you can install wireguard client on DietPi and transfer the client file. A small how-to is available on our online docs > VPN Software Options - DietPi.com Docs > … modern-vpn

Once wireguard is working you can start with transmission

Hi, I have installed wireguard server on my VPS and I install wireguard and transmission from dietpi-software on my Dietpi local server. But I don’t know how to make only transmission from dietpi works with wireguard. I have also nextcloud and emby on dietpi and I don’t want then to use wireguard.
I find that tutorial:

Will it work as I want?
Regards,
Przemko

yeah that could be a way. Basically you would go to bind transmission to the VPN IP.

But trendy is much more an expert on iptables than I. Probably he has some thought on the config and how it will influence your Nextcloud installation.

Can You tell me few things?
In that tutorial TRANSMISSION CONFIG section there’re X.X.X.X and xxxx.xxxx… addreses.

  1. What IP I have to put there? My VPS serwer IP [wireguard server]?
  2. What peer-port?
    In /etc/systemd/system/transmission-daemon.service there’s <wg-quick@wgtorrents.service> => what is that service? Do I have to make that file with some config or it was created automatically when I installed wireguard on Dietpi?
    In WIREGUARD CONFIG section.
  3. Is is wireguard client on Dietpi config or on my VPS server?
  4. What I need to put here:
PostUp = systemd-resolve -i %i --set-dns=193.138.218.74 --set-domain=~.; ip rule add from X.X.X.X table 42; ip route add default dev %i table 42; ip -6 rule add from xxxx:xxxx:xxxx:xxxx::xxxx table 42
PostDown = ip rule del from X.X.X.X table 42; ip -6 rule del from xxxx:xxxx:xxxx:xxxx::xxxx table 42

and here:

Endpoint=se4-wireguard.mullvad.net:51820
AllowedIPs=0.0.0.0/0,::/0

?
Regards Przemko.

The IP of the dietpi.

This is your choice.

Dietpi

Replace the xxx with your tunnel IP.

I am not so sure about that, maybe you should ask the author.

That would be difficult. Outgoing torrent ports are not always fixed. Then one would have to match userid or process id in iptables, but I have never tried it myself.

I would try to setup Wireguard connection first before going to integrate transmission

trendy , Joulinar thanks very much. I will try those options and experiment first on my laptop and then on Dietpi if I figure something out.
Regards,
Przemko

Usually it’s quite simple to configure Wireguard. Keep in mind that you need to configure server side as well as client side.

Joulinar Hi, I don’t understand that wireguard config so I think something like that:

Regards,
Przemko

Well looks like something that could be working. But I need to say, I never used something like this.

All this looks way more complicated to me, than setting up a wireguard tunnel.

Hi, It was very easy. Everything was clear described. I install Deluge on Dietpi and I see it works with proxy (my VPS IP) like with VPN.
Thanks for help and Your time.
Regards,
Przemko

Hello trendy and Joulinar I have strange problem when I install Radarr and configure Deluge with that proxy. I don’t know it is those apps problem because I have that earlier about 2 times in 3 months but from 27.11.2020 I have about 2 times a day when my Dietpi lose internet connection. I have my Rpi4 connected with ethernet cable. When my Dietpi loose connection I can’t ssh, my nextcloud, emby and other services can’t acces from browser, only Kodi works but don’t sync. I see on my smartphone app Finge that my Raspbery is online. I must turn off and turn on manually and everything wors. How can I check what is wrong?

Edit. I have that error just few minutes ago and something new happen, Dietpi restart byself. I find command in google but I’m new in journalctl.

root@Przemas82:/home/dietpi# journalctl -p 3 -xb
-- Logs begin at Thu 2019-02-14 11:11:58 CET, end at Mon 2020-11-30 22:13:23 CET. --
lis 30 20:31:35 Przemas82 blkmapd[146]: open pipe file /run/rpc_pipefs/nfs/blocklayout failed: No such file or directory

lis 30 20:32:08 Przemas82 noip2[1031]: execl /tmp/DietPi-Config/nextcloud failed (No such file or directory)
lis 30 22:09:54 Przemas82 kernel: Out of memory: Killed process 963 (mono) total-vm:933400kB, anon-rss:713088kB, file-rss:
0kB, shmem-rss:0kB, UID:999 pgtables:1888kB oom_score_adj:0

Regards,
Przemek

looks like you are running out of memory. In the case below, Mono get killed. And this is impacting Radarr.

kernel: Out of memory: Killed process 963 (mono)

Do you have swap enabled? can you check free -m

Hi, I have swap:

dietpi@Przemas82:~$ free -m
              total        used        free      shared  buff/cache   available
Mem:           1626         910         287         116         427         516
Swap:            58          52           6

hmm its 58MB only. Let’s try to get it bigger

/boot/dietpi/func/dietpi-set_swapfile 1024

I do that
Now:

dietpi@Przemas82:~$ free -m
              total        used        free      shared  buff/cache   available
Mem:           1626         658         340          88         626         793
Swap:          1023           0        1023

I must tell You that I find that error in journalctl:

journalctl -p 3 -xb
-- Logs begin at Tue 2020-12-01 07:11:24 CET, end at Tue 2020-12-01 07:13:11 CET. --
gru 01 07:11:24 Przemas82 blkmapd[137]: open pipe file /run/rpc_pipefs/nfs/blocklayout failed: No such file or directory

gru 01 07:11:57 Przemas82 noip2[1042]: execl /tmp/DietPi-Config/nextcloud failed (No such file or directory)
root@Przemas82:/home/dietpi# systemctl status nfs-blkmap.service 
● nfs-blkmap.service - pNFS block layout mapping daemon
   Loaded: loaded (/lib/systemd/system/nfs-blkmap.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-12-01 07:11:24 CET; 2min 47s ago
  Process: 135 ExecStart=/usr/sbin/blkmapd $BLKMAPDARGS (code=exited, status=0/SUCCESS)
 Main PID: 137 (blkmapd)
    Tasks: 1 (limit: 3283)
   CGroup: /system.slice/nfs-blkmap.service
           └─137 /usr/sbin/blkmapd

gru 01 07:11:24 Przemas82 blkmapd[137]: open pipe file /run/rpc_pipefs/nfs/blocklayout failed: No such file or directory

I disable that service but I see still this occur. What do You think about that and that other error with nextcloud:
noip2[1042]: execl /tmp/DietPi-Config/nextcloud failed (No such file or directory) ?

Edit. After that I set downloading in deluge and after about 2 minutes I have connection lost.

root@Przemas82:/# journalctl -p 3 -xb
-- Logs begin at Tue 2020-12-01 07:17:02 CET, end at Tue 2020-12-01 07:33:48 CET. --
gru 01 07:17:02 Przemas82 blkmapd[149]: open pipe file /run/rpc_pipefs/nfs/blocklayout failed: No such file or directory

gru 01 07:31:27 Przemas82 noip2[1064]: execl /tmp/DietPi-Config/nextcloud failed (No such file or directory)

Maybe this something with deluge proxy options?



Regards,
Przemko

I guess you have multiple issues. I guess they need to be fixed one by one

Do you mount anything via NFS? If not I would recommend to remove that package!
Do you use NoIP? If yes you could try to setup configuration again.