linux服务器使用WonderShaper进行网络速度限制
wondershaper 实际上是一个 shell 脚本,它使用 tc 来定义流量调整命令,使用 QoS 来处理特定的网络接口。外发流量通过放在不同优先级的队列中,达到限制传出流量速率的目的;而传入流量通过丢包的方式来达到速率限制的目的。
wondershaper 的既定目标不仅仅是对一个接口增加其带宽上限;当批量下载或上传正在进行时,wondershaper 还试图去保持互动性会话如 SSH 的低延迟。同样的,它还会控制批量上传(例如, Dropbox 的同步)不会使得下载“窒息”,反之亦然。
Wonder Shaper 1.4
我们先安装依赖
#Debian/Ubuntu系统
apt install -y make git
#CentOS系统
yum install make git -y
然后安装WonderShaper
git clone https://github.com/magnific0/wondershaper.git
cd wondershaper
make install
安装完成后就可以使用了,命令如下
USAGE: wondershaper [-hcs] [-a ] [-d ] [-u ]
OPTIONS:
-h Show this message
-a Set the adapter
-d Set maximum download rate (in Kbps) and/or
-u Set maximum upload rate (in Kbps)
-p Use presets in /etc/conf.d/wonder