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

相关推荐
归叶再无青10 天前
web服务安装部署、性能升级等(Apache、Nginx)
运维·前端·nginx·云原生·apache·bash
归叶再无青10 天前
企业级web服务(Tomcat开源web应用服务器)
运维·前端·开源·tomcat·bash
chao_78911 天前
构建start_app.sh,实现快速启动项目
python·bash·终端·前后端
笨笨D幸福12 天前
应用程序重定向技术(Shim)
bash·scoop·shim
xuchaoxin137512 天前
bash@bash帮助命令help@bash命令可用选项设置@bash -c@set命令@set --
bash
ol木子李lo13 天前
Linux 命令备忘录
linux·运维·服务器·windows·编辑器·ssh·bash
dingdingfish14 天前
Bash学习 - 第10章:Installing Bash
bash·make·shell·install·configure·5.3
dingdingfish14 天前
Bash学习 - 第8章:Command Line Editing,第3节:Readline Init File
bash·init·bind·readline
dingdingfish15 天前
Bash学习 - 第8章:Command Line Editing,第6-8节:Programmable Completion
bash·shell·completion·complete·compgen·compopt
dingdingfish16 天前
Bash学习 - 第8章:Command Line Editing,第4-5节:Bindable Readline Commands
bash·emacs·vi·bind·readline