也可能改变流量的优先级,允许与交互服务有关的 (如 与 telnet) 或只服务小量数据的封包优先处理。

    Debian 核心包括 QoS 必备的功能与相关的模块。这些模块提供多样服务,多半系供 IP 封包数组使用;这些数组行为包括多种可能的需求。

    文化 LARTC — Linux 高端路由与流量控制

    Linux 高端路由与流量控制 做法是一份包括网络服务品质的参考文档。

    10.3.2. 配置与应用

    经由 tc 命令 (由 iproute 软件包提供) 设置 QoS 参数。因为其接口较为复杂,建议使用高端的工具。

    10.3.2.1. 减少延迟:wondershaper

    配置网络接口后,运行 wondershaper *interface* *download_rate* *upload_rate*命令,设置流量控制。可以是 或 ppp0 接口,两者的速度均以每秒千位为单位。wondershaper remove *interface* 命令可以在特定接口停用流量控制。

    For an Ethernet connection, this script is best called right after the interface is configured. This is done by adding up and down directives to the file allowing declared commands to be run, respectively, after the interface is configured and before it is deconfigured. For example:

    例 10.9. Changes in the /etc/network/interfaces file

    In the PPP case, creating a script that calls wondershaper in /etc/ppp/ip-up.d/ will enable traffic control as soon as the connection is up.

    GOING FURTHER Optimal configuration

    The /usr/share/doc/wondershaper/README.Debian.gz file describes, in some detail, the configuration method recommended by the package maintainer. In particular, it advises measuring the download and upload speeds so as to best evaluate real limits.

    10.3.2.2. Standard Configuration

    • Normal-Service (0);

    • Minimize-Cost (2);

    • Maximize-Reliability (4);

    • Minimize-Delay (16).

    The ToS field can be set by applications that generate IP packets, or modified on the fly by netfilter. The following rules are sufficient to increase responsiveness for a server’s SSH service:

    1. iptables -t mangle -A PREROUTING -p tcp --sport ssh -j TOS --set-tos Minimize-Delay
    2. iptables -t mangle -A PREROUTING -p tcp --dport ssh -j TOS --set-tos Minimize-Delay