Grep 使用GRE隧道连接虚拟机-Openvswitch

Grep 使用GRE隧道连接虚拟机-Openvswitch,grep,sdn,tunneling,openvswitch,Grep,Sdn,Tunneling,Openvswitch,大家好,我是一个网络新手,所以我有点迷路了,请大家帮助我 我在接口中有两个具有相同配置的物理节点: # 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 我的节

大家好,我是一个网络新手,所以我有点迷路了,请大家帮助我

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

# 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的默认配置在每个节点上运行一个VM:
ubuntu001中的Vm:10.1.1.189
ubuntu002中的Vm:10.1.1.59

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

首先,我创建一个OVS桥接器:
#ovs vsctl添加br ovs-br0

第二步,我将网桥与其上行链路连接,在本例中,上行链路为eth0
#ovs vsctl添加端口ovs-br0 eth0

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

我为GRE隧道添加了一个端口:
#ovs vsctl添加端口ovs-br0 gre0——设置接口gre0 type=gre选项:remote_ip=158.42.104.139 #ovs vsctl添加端口ovs-br0 gre0——设置接口gre0 type=gre选项:remote_ip=158.42.104.129

当我使用ovs vsctl show时,我在另一个节点和本节目中也做了同样的操作:

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"

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

将此添加到
/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
以满足您的需要。此示例适用于实际NIC的mtu
1500时

remote_ip=158.42.104.139
应包含其他节点的ip。这在两个节点上是不同的

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

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

不要忘记将VMs的mtu设置为1462


本教程可能很有用:

将其添加到
/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
以满足您的需要。此示例适用于实际NIC的mtu
1500时

remote_ip=158.42.104.139
应包含其他节点的ip。这在两个节点上是不同的

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

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

不要忘记将VMs的mtu设置为1462

本教程可能有用: