Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
topics:aria2-netns-systemd [2017/12/20 18:12]
orzfly created
topics:aria2-netns-systemd [2017/12/22 05:01]
orzfly
Line 1: Line 1:
 ====== Run aria2 with isolated netns with Systemd ====== ====== Run aria2 with isolated netns with Systemd ======
  
 +<​code>​
 +git clone https://​github.com/​Jamesits/​systemd-named-netns
 +cd systemd-named-netns
 +make install
 +</​code>​
 +
 +<code - /​etc/​default/​netns-bridge>​
 +BRIDGE=br-lan
 +DHCPV4=1
 +</​code>​
 +
 +<code - /​etc/​default/​netns-bridge-aria2c>​
 +MACADDR=52:​54:​01:​02:​76:​79
 +</​code>​
 +
 +<code ini /​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
 +</​code>​
 +
 +<spoiler |Previous naive version with raw netns commands>​
 <code ini /​etc/​systemd/​aria2c-daemon.service>​ <code ini /​etc/​systemd/​aria2c-daemon.service>​
 [Unit] [Unit]
Line 62: Line 133:
 WantedBy=multi-user.target WantedBy=multi-user.target
 </​code>​ </​code>​
 +</​spoiler>​
  
 ===== See Alsos ===== ===== See Alsos =====
 +  - [[topics:​ip-netns-cheatsheet]]
 +  - https://​github.com/​Jamesits/​systemd-named-netns
   - https://​gist.github.com/​rudylacrete/​dcd9779175fe18731852   - https://​gist.github.com/​rudylacrete/​dcd9779175fe18731852
  
 {{tag>​netns systemd aria2}} {{tag>​netns systemd aria2}}