V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Recommended Services
Amazon Web Services
LeanCloud
New Relic
ClearDB
GjriFeu
V2EX  ›  云计算

关于网卡 bonding mode 4

  •  
  •   GjriFeu · 2018-05-16 01:04:31 +08:00 · 2947 次点击
    这是一个创建于 2143 天前的主题,其中的信息可能已经有所发展或是发生改变。

    对网络方面的知识有所欠缺,光看网卡 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 发送数据还会经过哈希规则么,为什么?

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

    交换机这边也在 hash 啊,根据 mac 或 ip 地址 hash,当然会落到其他网卡上面。lacp 需要在系统侧和交换机侧同时配置才会生效。
    GjriFeu
        8
    GjriFeu  
    OP
       2018-05-16 12:28:14 +08:00
    @tempdban 应该是有的
    GjriFeu
        9
    GjriFeu  
    OP
       2018-05-16 12:32:39 +08:00
    @vuuv 感谢回复,明白了一些
    tempdban
        10
    tempdban  
       2018-05-16 14:24:39 +08:00 via Android   ❤️ 1
    @GjriFeu 你收到的包 是交换机发出的 所以你觉得是有分发的,你发出的报文因为没有过 bond,所以不会有 hash
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5431 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 08:46 · PVG 16:46 · LAX 01:46 · JFK 04:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.