2025年3月31日 星期一 乙巳(蛇)年 正月初一 设为首页 加入收藏
rss
您当前的位置:首页 > 计算机 > 系统应用 > Linux

WonderShaper服务器网卡宽带限速(支持多网卡分别限制)

时间:08-10来源:作者:点击数:33

介绍

安装

一:安装依赖

  • #Debian/Ubuntu系统
  • apt install -y make git
  • #CentOS系统
  • yum install make git -y

二:安装WonderShaper

  • git clone https://github.com/magnific0/wondershaper.git
  • cd wondershaper
  • make install

三:命令详细

  • USAGE: wondershaper [-hcs] [-a <adapter>] [-d <rate>] [-u <rate>]
  • OPTIONS:
  • -h 显示此消息
  • -a <adapter> 设置适配器
  • -d <rate> 设置最大下载速率(单位:Kbps)
  • -u <rate> 设置最大上传速率(单位:Kbps)
  • -p 使用 /etc/conf.d/essenshaper.conf 中的预设
  • -c 从适配器中清除限制
  • -s 显示适配器的当前状态
  • -v 显示当前版本

四:使用示例

首先使用ifconfig命令来查看网卡名称;

博主的网卡名称为enp1s0,下面使用以下命令来限制enp1s0网卡的宽带速率;

  • #限制上传带宽为10Mbps
  • wondershaper -a enp1s0 -u 10240
  • #限制下载带宽为10Mbps
  • wondershaper -a enp1s0 -d 10240
  • #限制上传和上传均10Mbps
  • wondershaper -a enp1s0 -d 10240 -u 10240
  • #清除网卡限速规则
  • wondershaper -c -a enp1s0

宽带测试

一:下载测试

  • CacheFly 亚太 - 100MB
  • wget -O /dev/null http://cachefly.cachefly.net/100mb.test
  • Online 法国 - 1000MB
  • wget -O /dev/null http://ping.online.net/1000Mo.dat
  • Online 荷兰 - 1000MB
  • wget -O /dev/null http://ping-ams1.online.net/1000Mo.dat

二:Speedtest.net

  • wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
  • chmod +x speedtest-cli
  • ./speedtest-cli
  • ## 如果出现错误
  • /usr/bin/env: ‘python’: No such file or directory
  • ## 输入以下命令安装python
  • apt-get install python
方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门