10

我正在建立一个概念证明来限制终端(客户端)的入口流量:

eth0 -> ifb0 -> htb -> filter by ip -> htb rate -> fq_codel+ecn

对于我想要限制的特定程序,我有 2 个源 ip。有问题的程序打开了一堆 tcp 连接(下载,因此入口限制),我想限制它使用的总入口带宽(完成)并在到相同 IP 地址的连接之间进行公平调度(这个问题)。

最后有 1 个附加速率的存储桶和 1 个fq_codel实例。

我有它的工作,但我有一些问题:

  • 肯定codel每个协议(tcp vs udp)都有单独的队列吗?
  • codel 每个源 ip 有单独的队列吗?
  • codel 每个 tcp 连接都有单独的队列吗?
  • 我必须手动分离/标记流吗?

每个互联网研究流 id 是“5 元组的哈希”,问题是,数据包的哪些元素是 5 元组的一部分?是否包括源端口和目标端口?

4

2 回答 2

1

至少在默认情况下,似乎包括源端口和目标端口:

http://lxr.free-electrons.com/source/net/core/flow_dissector.c#L655

655 /**
656  * __skb_get_hash: calculate a flow hash
657  * @skb: sk_buff to calculate flow hash from
658  *
659  * This function calculates a flow hash based on src/dst addresses
660  * and src/dst port numbers.  Sets hash in skb to non-zero hash value
661  * on success, zero indicates no valid hash.  Also, sets l4_hash in skb
662  * if hash is a canonical 4-tuple hash over transport ports.
663  */
664 void __skb_get_hash(struct sk_buff *skb)
于 2016-01-27T15:36:36.703 回答
0

根据http://mdh.diva-portal.org/smash/get/diva2:754020/FULLTEXT01.pdf(某人的博士论文):

通过从数据包中散列一个 5 元组值(默认为 src/dest 端口/ip 和协议)以及随机数来分隔流

除了默认位,很明显。

于 2016-02-05T08:07:42.693 回答