对上行(上传)限速:
iptables -t filter -I FORWARD -s 192.168.10.188 -j DROP
iptables -t filter -I FORWARD -m limit -s 192.168.10.188 --limit 100/s --limit-burst 100 -j ACCEPT
对下行(下载)限速:
iptables -t filter -I FORWARD -d 192.168.10.188 -j DROP
iptables -t filter -I FORWARD -m limit -d 192.168.10.188 --limit 100/s --limit-burst 100 -j ACCEPT
其中--limit 100/s是限制每秒数据包数量,一般情况下每个数据包可以按照1500个字节计算;
--limit
: Specifies the rate at what tokens get refilled into the bucket. 4/hour
means 4 tokens per hour (1 token every 15 minutes).
--limit
: 指定将令牌重新填充到存储桶中的速率。4/hour表示每小时4个令牌(每15分钟1个令牌)。
--limit-burst
: Specifies the maximum amount of tokens that can be filled in the bucket. (This is also the amount of tokens the bucket starts out with).
--limit-burst
: 指定存储桶中可以填充的令牌的最大数量。(这也是存储桶开始使用的令牌数量)。