简体   繁体   English

VM 中的 Open vSwitch 网桥不通过端口发送流量

[英]Open vSwitch bridge in VM does not send traffic over port

I'm trying to run the Pike release OpenStack Kolla with Open vSwitch in a VM as a part of a test / dev environment.作为测试/开发环境的一部分,我正在尝试在 VM 中运行带有 Open vSwitch 的 Pike 版本 OpenStack Kolla。 I feel like I am missing something obvious, but I just figure it out.我觉得我错过了一些明显的东西,但我只是弄明白了。

In the VM, Open vSwitch in a docker container.在 VM 中,在 docker 容器中打开 vSwitch。

The version in both the VM and host is: VM 和主机中的版本均为:

openvswitch-switch/xenial-updates,now 2.8.1-0ubuntu0.17.10.2~cloud0 amd64 [installed] I create the bridge using: openvswitch-switch/xenial-updates,now 2.8.1-0ubuntu0.17.10.2~cloud0 amd64 [installed]我使用以下方法创建网桥:

ovs-vsctl add-br br-ex ovs-vsctl add-port br-ex ens3 ip addr flush ens3

I run the same commands on a bare-metal server and it works just fine.我在裸机服务器上运行相同的命令,它工作得很好。 In the VM, the MAC address for br-ex doesn't match the MAC of the NIC.在 VM 中,br-ex 的 MAC 地址与 NIC 的 MAC 不匹配。 They MACs match on the bare-metal instance.它们的 MAC 在裸机实例上匹配。

If I delete the bridge ovs-vsctl del-br then traffic flows normally through the ens3 interface.如果我删除网桥ovs-vsctl del-br ,则流量会正常流经 ens3 接口。

While the bridge is active, ovs-system is listed as a capability on the nic.当网桥处于活动状态时,ovs-system 被列为 nic 上的一项功能。

ovs-vsctl show
<snip>
    Bridge br-ex
        Port "ens3"
            Interface "ens3"
        Port br-ex
            Interface br-ex
                type: internal

The main difference that I can see is that the ens3 in the VM is using the.net-virtio driver.我看到的主要区别是 VM 中的 ens3 使用的是 .net-virtio 驱动程序。 I don't see why this would make a difference.我不明白为什么这会有所作为。

Ubuntu 16.04.4 is the operating system for both the host and vm. Ubuntu 16.04.4 是主机和虚拟机的操作系统。 Using a typical KVM, QUEMU, and libvirt setup compute nodes.使用典型的 KVM、QUEMU 和 libvirt 设置计算节点。

I still don't know why this behaves differently in a VM than on bare-metal. 我仍然不知道为什么它在VM中的行为不同于裸机。 Setting the MAC on the bridge to match the network interface resolved this issue. 在网桥上设置MAC以匹配网络接口可以解决此问题。

ovs-vsctl add-br br-ex -- set bridge br-ex other-config:hwaddr=\"ff:ff:ff:ff:ff:ff\"'

Thanks a lot for your clarification, I was getting crazy myself.非常感谢您的澄清,我自己也快疯了。 When you create the bridge it assigns a different MAC address than the one that the ens3 has and from that moment the dhclient wont work, but following your advice, and assigning the ens3 MAC to the bridge, dhclient worked and I was able to have the traffic going through the bridge to the outside world.当您创建网桥时,它分配的 MAC 地址与 ens3 所拥有的 MAC 地址不同,从那时起 dhclient 将无法工作,但按照您的建议,并将 ens3 MAC 分配给网桥,dhclient 可以工作,我能够拥有通过桥与外界的交通。

sudo ovs-vsctl add-br br77 -- set bridge br77 other_config:hwaddr=ff:ff:ff:ff:ff:ff

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM