Ubuntu Linux服务器限速非常容易,我们可以使用wondershaper限制服务器上传速度、下载速度,防止恶意刷流量。
wondershaper是一个脚本,可有效控制服务器网卡端口速度。(wondershaper官网源码)
我们以Linode机房VPS举例:
[table id=7 /]
Ubuntu安装wondershaper:
apt-get install wondershaper
使用规则:
wondershaper [-hcs] [-a <adapter>] [-d <rate>] [-u <rate>] 解释:
-hDisplay help-a <adapter>Set the adpter-d <rate>Set maximum download rate (in Kbps)-u <rate>Set maximum upload rate (in Kbps)-pUse the presets in /etc/conf.d/wondershaper.conf-cClear the limits from adapter-sShow the current status of adapter
举例:
wondershaper -a eth0 -d 1024 -u 512
wondershaper -c -a eth0
# limit bandwidth to 10Mb/10Mb on eth0
wondershaper eth0 10000 10000