zoukankan      html  css  js  c++  java
  • 使用 wondershaper 在 Linux 中限制网络带宽使用

    wondershaper 实际上是一个 shell 脚本,它使用 tc 来定义流量调整命令,使用 QoS 来处理特定的网络接口。外发流量通过放在不同优先级的队列中,达到限制传出流量速率的目的;而传入流量通过丢包的方式来达到速率限制的目的。

    事实上, wondershaper 的既定目标不仅仅是对一个接口增加其带宽上限;当批量下载或上传正在进行时,wondershaper 还试图去保持互动性会话如 SSH 的低延迟。同样的,它还会控制批量上传(例如, Dropbox 的同步)不会使得下载“窒息”,反之亦然。

    在 Ubuntu Debian 及其衍生发行版中安装 wondershaper:

    sudo apt-get install wondershaper

    在 Fdora 或 CentOS/RHEL (带有 EPEL 软件仓库) 中安装 wondershaper:

    sudo yum install wondershaper

    wondershaper 的基本使用如下:

    sudo wondershaper <interface> <download-rate> <upload-rate>

    举个例子, 将 eth0 的最大下载/上传带宽分别设定为 1000Kbit/s 和 500Kbit/s:

    sudo wondershaper eth0 1000 500

    你也可以通过运行下面的命令将速率限制进行消除:

    sudo wondershaper clear eth0

    假如你对 wondershaper 的运行原理感兴趣,你可以阅读其 shell 脚本源文件(/sbin/wondershaper)。

    PS:

    http://www.linuxidc.com/Linux/2015-03/115538.htm

  • 相关阅读:
    Adobe Photoshop 常用快捷键及下载
    自定义定制排序
    requests之肯德基座位爬取
    requests之网页采集器
    requests实战之破解百度翻译
    爬虫基础知识笔记
    pymysql之模块增删该查
    pymysql模块之基本使用
    pymysql模块之sql注入
    mysql 知识点
  • 原文地址:https://www.cnblogs.com/phpdragon/p/5111680.html
Copyright © 2011-2022 走看看