Skip to content
← All work
ShellVPNSynology

transmission-vpn

Forces a NAS torrent client through a VPN, with a kill switch if it drops.

The problem

Running a torrent client on a Synology NAS is convenient right up until the VPN drops — then the NAS quietly leaks your real IP and you never find out. Most setups route the whole box through the tunnel, which breaks everything else the NAS is supposed to be doing.

What I built

A script that forces only Transmission through the VPN — L2TP, PPTP, or OpenVPN — and leaves the rest of the NAS on its normal connection. If the tunnel drops, a kill switch cuts the torrent traffic dead so nothing leaks while the VPN is down.

How it works

It's pure Shell, built to live on the NAS itself. It binds Transmission to the VPN interface, watches the tunnel, and tears the route down the instant the connection fails — no whole-system VPN, no leaks, no babysitting.

The outcome

Quietly relied on by people running it on their own NAS boxes. It's the kind of small, sharp tool that does exactly one thing and does it without surprises.

This one came straight out of my own setup. I wanted my NAS to keep doing everything it does — file shares, backups, the works — while only the torrent client lived behind the VPN. The off-the-shelf answer is “route the whole NAS through the tunnel,” which is a sledgehammer for a problem that needs a scalpel.

So I wrote the scalpel. Bind Transmission to the VPN interface, watch the tunnel like a hawk, and the moment it drops, kill the traffic rather than let it spill onto the open connection. It’s a script, it’s boring, and that’s exactly the point: it just works on the NAS and stays out of your way.