网卡限速工具之WonderShaper
Tags: WonderShaper网络网络限流限流限速
1.什么是WonderShaper
WonderShaper是用来对特定网卡进行快速限速的工具,它实际是对Linux的tc命令进行封装后的shell脚本,所以使用成本比tc更低,更容易上手,以下配合测速工具speedtest一起使用。
github:https://github.com/magnific0/wondershaper
2.如何安装WonderShaper
1 2 3 4 5 6 7 8 9 10 11 | #直接拉取wondershaper,开箱即用 git clone https://github.com/magnific0/wondershaper.git [root@lhr wondershaper]# ./wondershaper -v Version 1.4.1 [root@lhr wondershaper]# #网速测试工具speedtest安装(Ubuntu) apt install -y speedtest-cli -- yum install -y speedtest-cli (centos) |
3.WonderShaper使用帮助
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | [root@lhr wondershaper]# ./wondershaper -h USAGE: ./wondershaper [-hcs] [-a <adapter>] [-d <rate>] [-u <rate>] Limit the bandwidth of an adapter OPTIONS: -h Show this message 【帮助信息】 -a <adapter> Set the adapter 【指定网卡接口】 -d <rate> Set maximum download rate (in Kbps) and/or 【限制下载速度(Kbps)】 -u <rate> Set maximum upload rate (in Kbps) 【限制上传速度(Kbps)】 -p Use presets in "/etc/systemd/wondershaper.conf" -f <file> Use alternative preset file -c Clear the limits from adapter 【清除指定网卡规则,用于取消限速】 -s Show the current status of adapter 【显示当前网卡的状态】 -v Show the current version 【显示当前版本】 Configure HIPRIODST in "/etc/systemd/wondershaper.conf" for hosts requiring high priority i.e. in case ssh uses dport 443. MODES: wondershaper -a <adapter> -d <rate> -u <rate> wondershaper -c -a <adapter> wondershaper -s -a <adapter> EXAMPLES: 【使用示例】 wondershaper -a eth0 -d 1024 -u 512 【设置网卡eth0的上行速度为512kbps,下行速度为1024kbps】 wondershaper -a eth0 -u 512 【只设置上行速度为512kbps】 wondershaper -c -a eth0 【清除网卡eth0的规则】 wondershaper -p -f foo.conf 【设置指定的配置文件】 |