最後更新: 2024-05-09
介紹
tc
如果有 root 權限, 又不介意同時限制 DL&UP, 那可以直接用 tc 指令
詳見: tc
apt-get install iproute2
# rate 30mbit # Sets the maximum average download rate to 30 mbps
# burst 1mb # Amount of bytes that can be burst at ceil speed
tc qdisc add dev eth0 root tbf rate 30mbit burst 5mb latency 500ms
# checking
tc qdisc show dev eth0
qdisc tbf 8008: root refcnt 13 rate 30Mbit burst 5Mb lat 500ms
# 取消限速
tc qdisc del dev eth0 root
trickle
A lightweight userspace bandwidth shaper.
supports connection established via "SOCK_STREAM"
* not work with statically linked executables, nor with setuid(2) executables
# Install
apt-get install trickle
trickle -V
trickle: version 1.07
# in standalone mode, independent of trickled(8)
# -d rate # download@KB/s
# -u rate # upload@KB/s
trickle -s -d 100 wget http://example.com/file.zip
# By PID
ps aux | grep <process_name>
trickle -s -d 100 -p <PID>
trickled
a userspace bandwidth manager daemon
trickled manages several trickle(1) sessions at a time
Opts
-s Uses syslog for all output (instead of stderr).