关于网卡 bonding mode 4

2018-05-16 01:04:31 +08:00
 GjriFeu

对网络方面的知识有所欠缺,光看网卡 bond 文档对与 mode 4 的机制和数据流向不太清晰

IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.
Slave selection for outgoing traffic is done according to the transmit hash policy, which may be changed from the default simple XOR policy via the xmit_hash_policy option, documented below. Note that not all transmit policies may be 802.3ad compliant, particularly in regards to the packet mis-ordering requirements of section 43.2.4 of the 802.3ad standard. Differing peer implementations will have varying tolerances for noncompliance.
Prerequisites:
Ethtool support in the base drivers for retrieving the speed and duplex of each slave.
A switch that supports IEEE 802.3ad Dynamic link aggregation.
Most switches will require some type of configuration to enable 802.3ad mode.

这里写传出流量选择是根据传输哈希策略完成的

但是如果我使用某个 slave 网卡的 sr-iov 的 vf 发送数据还会经过哈希规则么,为什么?

2975 次点击
所在节点    云计算
10 条回复
tempdban
2018-05-16 01:17:10 +08:00
用的是什么 bond ? OVS 还是内核带的?
tempdban
2018-05-16 01:34:31 +08:00
我就当作内核提供的 bond 功能。
这个端口选举一般的网卡由软件来做,所以如果你在 vf 上配了 bond,这个 hash 是一定做的。
但是如果你 bond 配的是 pf, 用 vf 来发包,那就不会 hash。
实际上内核的 Bond 实际上就是一个网络设备驱动,当流程走到 bond 的 hard_start_xmit 时,他就 hash 一下 找到下一步实际应该发出的口,再调用对应设备的 hard_start_xmit
ryd994
2018-05-16 04:59:04 +08:00
应该不经过
vf 可以是作为独立的 PCI 设备使用的
你这里的 hash 规则是软件部分
vuuv
2018-05-16 09:24:11 +08:00
lacp 是需要交换机支持的。
意思就是你配置了几个网口的 bond,则所接的交换机接口也配置了 bond。即便你用了 vf,交换机肯定不支持 vf,是视作 bond 流量还是无视处理?
如果视作 bond,那么可能从其他接口返回数据,然后就没有然后了。
以上均为个人猜测,并无实践证明。
GjriFeu
2018-05-16 11:44:34 +08:00
@tempdban 内核提供的 bond,bond 配的是 pf
@ryd994
@vuuv
在宿主机抓包
使用 tcpdump 无法抓到 vf 的包
如果在宿主机能抓到 icmp reply 的包(此时 vf 是不能 ping 通的),表示这个包落到另一个网卡上了(即不是 vf 所属的 pf 网卡)。
请教一下交换机处做了什么,为什么 reply 的包会落到另一个网卡上
tempdban
2018-05-16 12:09:06 +08:00
你这种情况是没有 hash 的
交换机是不是有 lacp
vuuv
2018-05-16 12:26:24 +08:00
@GjriFeu tcpdump 有指定网卡的参数。你的 vf 网卡并不是物理网卡的 slave,所以没法看到,因为对于内核而言,这是两个不相关的设备。但是如果你在对端抓包,则可以看到 vf 的包。(因为走同一根网线了。)

交换机这边也在 hash 啊,根据 mac 或 ip 地址 hash,当然会落到其他网卡上面。lacp 需要在系统侧和交换机侧同时配置才会生效。
GjriFeu
2018-05-16 12:28:14 +08:00
@tempdban 应该是有的
GjriFeu
2018-05-16 12:32:39 +08:00
@vuuv 感谢回复,明白了一些
tempdban
2018-05-16 14:24:39 +08:00
@GjriFeu 你收到的包 是交换机发出的 所以你觉得是有分发的,你发出的报文因为没有过 bond,所以不会有 hash

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/455136

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX