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

相关推荐
難釋懷1 天前
Shell脚本-while循环语法结构
linux·运维·服务器·bash
難釋懷2 天前
Shell脚本-for循环应用案例
linux·运维·服务器·bash
白总Server2 天前
Nginx 中间件
大数据·linux·运维·服务器·nginx·bash·web
Pasregret2 天前
策略模式:动态切换算法的设计智慧
算法·bash·策略模式
SpikeKing5 天前
Server - 优雅的配置服务器 Bash 环境(.bashrc)
服务器·bash·bashrc·bash_profile
涛ing7 天前
【Linux “less“ 命令详解】
linux·运维·c语言·c++·人工智能·vscode·bash
難釋懷7 天前
bash的特性-bash中的引号
开发语言·chrome·bash
vortex57 天前
Bash 中的数学运算详解
linux·运维·开发语言·bash·运维开发
kfepiza7 天前
用sed替换文本 笔记250419
linux·笔记·bash·命令模式
Cuit小唐7 天前
ifconfig -bash: ifconfig: command not found
开发语言·bash