Run aria2 with isolated netns with Systemd

git clone https://github.com/Jamesits/systemd-named-netns
cd systemd-named-netns
make install
/etc/default/netns-bridge
BRIDGE=br-lan
DHCPV4=1
/etc/default/netns-bridge-aria2c
MACADDR=52:54:01:02:76:79
/etc/systemd/aria2c-daemon.service
[Unit]
Requires=network-online.target netns-bridge@aria2c.service mts-Incoming.mount
After=network-online.target netns-bridge@aria2c.service mts-Incoming.mount
BindsTo=netns-bridge@aria2c.service mts-Incoming.mount
JoinsNamespaceOf=netns@aria2c.service
 
[Service]
PrivateNetwork=yes
SyslogIdentifier=aria2c-daemon.service
User=orzfly
Group=orzfly
ExecStart=/usr/bin/aria2c \
  --enable-rpc \
  --rpc-listen-all=true \
  --rpc-allow-origin-all \
  --rpc-listen-port=27679 \
  --rpc-secret=TOKENTOKENTOKENTOKENTOKENTOKENTOKENTOKENTOKENTOKENTOKENTOKENTOKEN \
  --max-concurrent-downloads=10 \
  --max-connection-per-server=16 \
  --min-split-size=1M \
  --split=16 \
  --max-overall-download-limit=0 \
  --max-download-limit=0 \
  --max-overall-upload-limit=0 \
  --max-upload-limit=0 \
  --max-tries=1000 \
  --retry-wait=5 \
  --input-file=/var/lib/aria2c-daemon/session \
  --save-session=/var/lib/aria2c-daemon/session \
  --save-session-interval=15 \
  --disk-cache=0 \
  --allow-overwrite=false \
  --always-resume=true \
  --auto-file-renaming=false \
  --continue=true \
  --remote-time=true \
  --lowest-speed-limit=50K \
  --file-allocation=none \
  --dir=/mts/Incoming/Downloads \
  --seed-time=60 \
  --bt-detach-seed-only=true \
  --bt-request-peer-speed-limit=2M \
  --bt-max-peers=100 \
  --bt-max-open-files=100 \
  --bt-save-metadata=true \
  --user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3291.0 Safari/537.36' \
  --allow-piece-length-change=true
Restart=always
RestartSec=15s
 
[Install]
WantedBy=multi-user.target
Previous naive version with raw netns commands

See Alsos