Linux 上的传入(入口)流量整形 - bw 低于预期

and*_*kop 4 linux traffic-shaping iproute2

我想限制 Linux box 的传入(下载)速度。

配置的盒子和流量源(HTTP服务器)都连接在同一个交换机上,如果没有配置整形,下载速度为30MBps

我根据http://lartc.org/lartc.html使用 tc

########## downlink #############
# slow downloads down to somewhat less than the real speed  to prevent 
# queuing at our ISP. Tune to see how high you can set it.
# ISPs tend to have *huge* queues to make sure big downloads are fast
#
# attach ingress policer:

/sbin/tc qdisc add dev $DEV handle ffff: ingress

# filter *everything* to it (0.0.0.0/0), drop everything that's
# coming in too fast:

/sbin/tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
   0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
Run Code Online (Sandbox Code Playgroud)

但是,有效下载速度远低于配置。这是我的实验结果

设置速率, KBps :实际速率, KBps

  • 32 KBps:30 KBps
  • 64 KBps:50 KBps
  • 128 KBps:106 KBps
  • 256 KBps:160 KBps
  • 512 KBps:210 KBps
  • 1024 KBps:255 KBps

对于小带宽整形效果很好,但在 1024 KBit 上,有效比特率比预期低 75%。

是否可以有效地限制传入带宽?

poi*_*ige 5

体重低于预期

我认为你也必须burst相应地增加。

是否可以有效地限制传入带宽?

我会说你肯定可以达到类似的效果,丢弃数据包,而不是接收它们。对于像 TCP 这样具有带宽自调整机制的 protos,它会有效地工作。看看http://www.linuximq.net/faq.html

  • 谢谢!如果在服务器和/或客户端上设置了限制,则突发更大(Tc=125 毫秒)我将 HTTP 下载速度配置为 88%。[一些信息](http://networklessons.com/quality-of-service/qos-traffic-shaping-explained/)关于burst和Tc (3认同)