找回密码
 立即注册
搜索

手动限制VPS主机网络带宽的脚本:WonderShaper,避免触发限速规则

hhjuu 2024-8-13 17:32:48
有些主机商家的带宽限速规则比较严格, 比如多少分钟内,占用过高,比如超过多少Mbps的话就限速,这个时候可以自己手动限速, 可以避免触发限速规则。WonderShaper 是一个专门用于手动限制 VPS 网络带宽的脚本,用于对特定网卡进行带宽限速,封装 linux 的 tc 命令,使用起来更加简单和方便。
安装 wondershapercurl -Lo /usr/sbin/wondershaper https://raw.githubusercontent.co ... /wondershaper;chmod +x /usr/sbin/wondershaper;
查询网卡ifconfig # 大多数为 eth0
对网卡设置限速wondershaper -a eth0 -d 5000  -u 2000 # 限制 下载 5Mbps, 上传 2Mbps# wondershaper -a eth0 -d 90000 -u 90000 # 限制 下载  90Mbps, 上传 90Mbps
-a 网卡名(这里设了 eth0)
-d 下载速度 (单位为 Kbps)
-u 上传速度 (单位为 Kbps)
速度单位为 Kbps(Kbit/s) (100000 Kbps = 100Mbps = 12.5 MB/s)
取消网卡限速wondershaper -a eth0 -c # eth0 为网卡名
查看状态wondershaper -a eth0 -s # eth0 为网卡名
speedtest 测试网速speedtest # 根据就近节点, 测试限速效果
防止重启机器,限速失效
您需要登录后才可以回帖 立即登录
共收到 0 条点评
蜀ICP备2020032245号-4
微信公众号
微信小助理
返回顶部