Openwrt内SR-IOV网卡桥接问题

Openwrt直通SR-IOV网卡,然后与另一个网卡桥接,桥接正常,但是网络DHCP不通,踩了很多坑,最后发现SR-IOV的网卡软桥接会有问题,功能不支持。
Intel官方就描述了相关的问题。

from — https://forum.proxmox.com/threads/communication-issue-between-sriov-vm-vf-and-ct-on-pf-bridge.68638/

Maybe not as uncommon as I thought it would be, the Intel DPDK documentation is even describing exactly that us case.

The problem I\’m having is that VMs from the left side (via VF driver) cannot talk to VMs on the right hand side (via bridge of PF). Both can talk to the PF itself and outside hosts.


from — https://www.kclouder.cn/sriov-vm/

[问题描述]

环境是带有openvswitch的KVM, VMs和openvswitch部署在同一台服务器上,使用的INTEL网卡。一个vm使用VF,另一个vm使用virtio, VF和网桥都是由同一个PF创建的,VMs网络不可访问,不能相互通信。下面是简要的配置方法和拓扑。

  1. 启用虚拟化,在x710的端口1上创建VF,并将VF附加到VM1。
  2. 使用systemctl命令检查OvS正在运行,并使用命令OvS -vsctl add-br br0创建OvS桥接器。
  3. 使用以下命令将x710的端口1添加到桥上:ov -vsctl Add -port br0 port_name
  4. 使用命令vs-vsctl showvs-vsctl list-ports br0检查配置。
  5. 使用虚拟机管理器GUI在虚拟机的“虚拟硬件细节”窗口中将桥接接口作为虚拟网络接口附加到VM2。从“网络源”下拉菜单中选择OvS网桥,并指定“源模式”网桥。‘设备模型’应该是virtio。”
  6. 应用配置并启动这两个虚拟机。
  7. 在每个VM中,将已连接的接口(VF或网桥)设置为“up”。向每个接口添加一个ip。如VM1:ip link set dev ens9 up,后面跟着ip address add 10.10.10.1/24。例如VM2:ip link set dev eth0 up后面跟着ip address add 10.10.10.2/24

【测试结果】

以下是测试结果的总结。

  1. 两个虚拟机都使用VF,可以相互通信。
  2. 两个虚拟机都使用桥接接口,可以相互通信。
  3. 如果一个VM使用VF而另一个使用网桥接口(VF和网桥来自同一个PF),那么VM就不能彼此通信。
  4. 对于第3项,如果VF和bridge来自不同的PF,则vm可以相互通信。
  5. 两个VM都使用DHCP,在上述4种场景中,VM可以从DHCP服务器获得IP地址并访问外部网络,说明VM的网卡工作正常。

【故障原因】

经与Intel确认,SR-IOV Virtual Functions不能发送或接收同一物理端口上的虚拟nic之间的流量,也不能在Linux软件桥接器上的模拟连接和使用SR-IOV VFs的连接之间发送或接收流量。要解决此问题可以使用支持802.1Qbg (VEPA)的外部交换机设备。

其他资料: https://superuser.com/questions/1619515/is-it-possible-for-a-macvtap-interface-to-behave-exactly-like-a-linux-bridge-whe

https://www.sealingtech.com/blog/sr-iov-and-promiscuous-mode/

https://forums.unraid.net/topic/103323-how-to-using-sr-iov-in-unraid-with-1gb10gb40gb-network-interface-cards-nics/

https://docs.nvidia.com/networking/pages/viewpage.action?pageId=19801751#SingleRootIOVirtualization(SRIOV)-EthernetVirtualFunctionConfigurationwhenRunningSR-IOV

https://www.reddit.com/r/networking/comments/gv78ui/sriov_networking_and_ovs_intervm_isnt_working/

https://forum.proxmox.com/threads/communication-issue-between-sriov-vm-vf-and-ct-on-pf-bridge.68638/

https://enterprise-support.nvidia.com/s/article/howto-set-virtual-network-attributes-on-a-virtual-function–sr-iov-x

上一篇
下一篇