加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 限制传入流量的速率

发布时间:2020-12-13 18:39:31 所属栏目:Linux 来源:网络整理
导读:我从未完全理解是否可以对传入流量进行速率限制.我意识到没有直接的方法来控制远程服务器发送数据包的速率(除非你控制两个端点),但考虑到这个限制,下载管理器究竟是如何让我成功设置下载速度限制的? TCP slow-start和速率限制传入流量之间是否有任何链接?
我从未完全理解是否可以对传入流量进行速率限制.我意识到没有直接的方法来控制远程服务器发送数据包的速率(除非你控制两个端点),但考虑到这个限制,下载管理器究竟是如何让我成功设置下载速度限制的?

TCP slow-start和速率限制传入流量之间是否有任何链接?是否可以使用慢启动描述的方法人为地限制发送方的发送速率?

另外需要注意的是,我想要实现流量整形的服务器本身建立PPPoE连接,并充当网络其余部分的路由器.

更新:到目前为止的答案已经对我提出的问题进行了公平的概述,但我仍然不知道下载管理器如何能够限制传入流量,更具体地说,是否可以实现类似的策略. Linux网关盒.

解决方法

下载管理器最有可能按照 trickle paper中的说明工作.

A process utilizing BSD sockets may perform its own rate limiting.
For upstream limiting,the application
can do this by simply limiting the
rate of data that is written to a
socket. Similarly,for downstream
limiting,an application may limit the
rate of data it reads from a socket.
However,the reason why this works is
not immediately obvious. When the
application neglects to read some data
from a socket,its socket receive
buffers fill up. This in turn will
cause the receiving TCP to advertise a
smaller receiver window (rwnd),
creating back pressure on the
underlying TCP connection thus
limiting its data flow. Eventually
this “trickle-down” effect achieves
end-to-end rate limiting. Depending on
buffering in all layers of the network
stack,this effect may take some time
to propagate.

如果您偶尔需要对UNIX系统上的单个程序进行速率限制,那么简单的解决方案就是trickle.真正的流量整形就像您在网关上执行一样,可以使用tc完成.这在Linux Advanced Routing& Sons的Chapter 9. Queueing Disciplines for Bandwidth Management中有记载.交通管制HOWTO.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读