From e37641653ce2c5d12de2db4395078f21f880ee08 Mon Sep 17 00:00:00 2001 From: Hendrik Jonas Meyer Date: Tue, 16 Jan 2018 22:24:17 +0100 Subject: [PATCH] add option to drop the default route on providers, that do not override it properly --- README.md | 9 +++++++++ transmission/environment-variables.tmpl | 3 +++ transmission/start.sh | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/README.md b/README.md index 1917b2fb2..f3c1390ba 100644 --- a/README.md +++ b/README.md @@ -367,3 +367,12 @@ $ sudo systemctl stop transmission-openvpn.service # Later ... $ sudo systemctl start transmission-openvpn.service ``` + +## Drop the default route + +Some VPNs do not override the default route, but rather set other routes with a lower metric. +This might lead to te default route (your untunneled connection) to be used. + +To drop the default route set the environment variable `DROP_DEFAULT_ROUTE` to `true`. + +*Note*: This is not compatible with all VPNs. Please check yourself if your provider overrides the default route properly. diff --git a/transmission/environment-variables.tmpl b/transmission/environment-variables.tmpl index 5ae9d6538..db971dfd6 100644 --- a/transmission/environment-variables.tmpl +++ b/transmission/environment-variables.tmpl @@ -81,3 +81,6 @@ export PGID={{ .Env.PGID }} # Support custom web frontend {{ if .Env.TRANSMISSION_WEB_HOME }} export TRANSMISSION_WEB_HOME={{ .Env.TRANSMISSION_WEB_HOME }} {{end}} + +# Support dropping the default route after connection +export DROP_DEFAULT_ROUTE={{ .Env.DROP_DEFAULT_ROUTE }} diff --git a/transmission/start.sh b/transmission/start.sh index 456a43faf..18665a978 100755 --- a/transmission/start.sh +++ b/transmission/start.sh @@ -38,6 +38,11 @@ fi . /etc/transmission/userSetup.sh +if [ "true" = "$DROP_DEFAULT_ROUTE" ]; then + echo "DROPPING DEFAULT ROUTE" + ip r del default || exit 1 +fi + echo "STARTING TRANSMISSION" exec sudo -E -u ${RUN_AS} /usr/bin/transmission-daemon -g ${TRANSMISSION_HOME} --logfile ${TRANSMISSION_HOME}/transmission.log &