0

大家好,我真的是网络新手,所以我有点迷路了,希望有人能帮助我......

我在接口中有两个具有相同配置的物理节点:

# The primary network interface
#auto eth0
#iface eth0 inet dhcp

auto br0
    iface br0 inet dhcp
    bridge_ports eth0
    bridge_fd 9
    bridge_hello 2
    bridge_maxage 12
    bridge_stp off

我的节点有以下公共 ip:
ubuntu001: 158.42.104.129
ubuntu002: 158.42.104.139

我使用 libvirt 的默认配置在每个节点中运行一个虚拟机:
ubuntu001 中的虚拟机:10.1.1.189
ubuntu002 中的虚拟机:10.1.1.59

我想通过“使用 OVS 的 gre 隧道”在虚拟机之间进行 ping,所以我做了下一个,但它没有用:

首先我创建一个OVS桥:
#ovs-vsctl add-br ovs-br0

其次,我将我的网桥与它的上行链路连接起来,在这种情况下是 eth0
# ovs-vsctl add-port ovs-br0 eth0

第三,我在每个节点上运行一个虚拟机(分别为 ubuntu001:10.1.1.189 和 ubuntu002:10.1.1.59)

第四,我为 GRE 隧道添加一个端口:
# ovs-vsctl add-port ovs-br0 gre0 -- set interface gre0 type=gre options:remote_ip=158.42.104.139 # ovs-vsctl add-port ovs-br0 gre0 -- set接口 gre0 类型=gre 选项:remote_ip=158.42.104.129

我在另一个节点上做了同样的事情,当我使用 ovs-vsctl 显示这个节目时:

root@ubuntu001:~# ovs-vsctl show
    41268e02-3996-4caa-b941-e4fe9c718e35
    Bridge "ovs-br0"
       Port "ovs-br0"
          Interface "ovs-br0"
              type: internal
       Port "gre0"
          Interface "gre0"
              type: gre
              options: {remote_ip="158.42.104.139"}
       Port "eth0"
          Interface "eth0"
       ovs_version: "2.0.2"

root@ubuntu002:~# ovs-vsctl show
    f0128df4-1a89-4999-8add-b5076ff055ee
    Bridge "ovs-br0"
       Port "ovs-br0"
          Interface "ovs-br0"
              type: internal
       Port "gre0"
          Interface "gre0"
              type: gre
              options: {remote_ip="158.42.104.129"}
       Port "eth0"
          Interface "eth0"
       ovs_version: "2.0.2"

我做错了什么或遗漏了什么?

4

1 回答 1

2

将此添加到/etc/network/interfaces

auto br-ovs=br-ovs
iface br-ovs inet manual
    ovs_type OVSBridge
    ovs_ports gre1 gre2
    ovs_extra set bridge ${IFACE} stp_enable=true
    mtu 1462

allow-br-ovs gre1
iface gre1 inet manual
    ovs_type OVSPort
    ovs_bridge br-ovs
    ovs_extra set interface ${IFACE} type=gre options:remote_ip=158.42.104.139 options:key=1

auto br1
iface br1 inet manual# (or static, or DHCP)
    mtu 1462   

我不知道如何使用命令来做到这一点。

我认为eth0不应该在ovs-vsctl show.

stp_enable=true是可选的,我认为在 2 个节点的情况下不需要。

设置mtu以满足您的需求。此示例适用于实际 NICmtu为 1500 的情况。

remote_ip=158.42.104.139应该包含另一个节点的 IP。它在 2 个节点上是不同的。

options:key=1也是可选的,它可用于标记 2 个 GRE 网络(例如,第二个网格将具有key=2等)。

您可以添加虚拟机br1,它们将能够相互 ping 通。

不要忘记将虚拟机设置mtu为 1462。

本教程可能有用:https ://wiredcraft.com/blog/multi-host-docker-network/

于 2016-10-20T06:05:02.950 回答