wondershaper 一款限制 linux 服务器网卡级别的带宽工具

文章目录

一、关于wondershaper

wondershaper是一个脚本,允许用户限制一个或多个网络适配器的带宽。它通过使用iproute的tc命令来实现这一目的,但极大地简化了操作过程。

该工具最初由Bert Hubert在2002年发布,最初的版本缺乏命令行界面,从1.2版本开始增加了此功能。自1.3版起,采用了HTB队列而非CBQ,这在高于10兆比特的高速链路上提供了更好的带宽管理能力。1.4版中实现了改进的入站流量整形方法,并增加了对下载或上传(两者都限制也是可能的)速率设定的能力。

原始的README是一份相当详细的文档,对于想要了解更多背景信息的人来说,可以查阅。除了操作说明外,本文档被认为是最新和最全面的指导。

二、文档链接

https://gitcode.com/magnific0/wondershaper/overview

三、源码下载

bash 复制代码
git clone https://gitcode.com/magnific0/wondershaper.git

四、限流测试

bash 复制代码
#添加限制测试
wondershaper -a eth0 -d 2048 -u 512
docker rmi openjdk:8
docker pull openjdk:8

#去除限制测试
wondershaper -c -a eth0
docker rmi openjdk:8
docker pull openjdk:8

22:20 限速2M=2048的vnstat测试截图 http://124.71.129.204:8086

五、常见报错

1. /usr/local/sbin/wondershaper: line 145: tc: command not found

原因: 系统没有默认安装tc组件

解决: 安装tc命令

bash 复制代码
yum -y install iproute-tc

2. Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs...

原因: centos8停止更新导致的报错

解决: https://blog.csdn.net/hkl_Forever/article/details/125383667

相关推荐
IMPYLH9 小时前
Linux 的 shuf 命令
linux·运维·服务器·bash
IMPYLH11 小时前
Linux 的 shred 命令
linux·运维·服务器·bash
IT摆渡者13 小时前
Linux 巡检脚本BASH
linux·运维·bash
IMPYLH1 天前
Linux 的 sha384sum 命令
linux·运维·服务器·网络·bash·哈希算法
IMPYLH1 天前
Linux 的 sha512sum 命令
linux·运维·服务器·bash·哈希算法·散列表
维吉斯蔡1 天前
【Ubuntu】Fcitx 搜狗拼音无法在 VS Code 输入中文的修复方案
linux·vscode·ubuntu·bash
IMPYLH2 天前
【无标题】
linux·运维·服务器·网络·bash
IMPYLH2 天前
Linux 的 sha256sum 命令
linux·运维·服务器·网络·bash·哈希算法
码农小旋风3 天前
2026 最新 Claude Code Windows 安装教程:Node、Git Bash、命令检查一步步配好
windows·git·bash·claude
浅时光_c4 天前
3 shell脚本编程
linux·开发语言·bash