OVS GRE tunnels connecting VMs

This document describes how to use the Open vSwitch in different host allows two virtual machines communicate via the GRE tunnel based on the port.

Note :

This guide describes the steps required to GRE tunnel configuration. Any other tunneling protocol may be used to configure the same method Open vSwitch supports.

Here Insert Picture Description

set up

This guide is assumed that the configuration environment as follows.

Two physical networks

  • Transport network
    Ethernet network for communication between hosts running tunnels of OVS. Tunneling protocol (as used herein GRE) depends on being used, may need to modify some of the physical configuration of the switch (e.g., the need to adjust the MTU value). The physical configuration of the switching device is not within the scope of this discussion.

  • Network Management

    Strictly speaking, this network is not required, but it is an easy way to provide remote access to the physical host IP address, because the IP addresses can not be directly assigned as a member of the OVS bridge the physical interface.

Two physical hosts

The current environment is assumed that two named host1and host2hosts. Open vSwitch two hosts are running a hypervisor. Each host has two NIC, eth0and `eth1``, configuration is as follows:

  • eth0Connected to the transmission network. eth0IP address for communicating with the host 2 through the transmission network.

  • eth1Connected to the management network. eth1The IP address used to reach the physical host management.

Four virtual machines

Each host will run two virtual machines (VM). vm1And vm2running on the host host1, while vm3and vm4run host2.

Each virtual machine has a display device for Linux (e.g., on a physical host tap0) single interface.

Note :
For Xen / XenServer, VM interfaces in the form of Linux device, similar to the name vif1.0. Other Linux systems may treat these interfaces appear as vnet0, vnet1and so on.

Configuration Steps

Before you begin, you need to make sure to know the distribution host1and host2the eth0IP address of the interface, as you will need during the configuration process.

In host1the following configuration.

# Create OVS Bridge:

   $ ovs-vsctl add-br br0

Note :

  你不需要添加`eth0`到OVS网桥下.

# Start host1on the host vm1and vm2if these two virtual machines do not automatically associated with the OVS, relating them to the OVS bridge you just created (the following command assumes that tap0correspond vm1and tap1correspondence vm2) ::

   $ ovs-vsctl add-port br0 tap0
   $ ovs-vsctl add-port br0 tap1

# Add a GRE tunnel port:

   $ ovs-vsctl add-port br0 gre0 \
       -- set interface gre0 type=gre options:remote_ip=<IP of eth0 on host2>

Using the same basic steps in host2creating a mirror disposed on the host:

# Create OVS bridge, but the bridge is not adding any physical interfaces:

   $ ovs-vsctl add-br br0

# Start host2on the host vm3and vm4, if you need to add them to the OVS interface bridge (again, tap0corresponding to vm3and tap1corresponds to vm4) ::

   $ ovs-vsctl add-port br0 tap0
   $ ovs-vsctl add-port br0 tap1

# In host2Create a GRE tunnel interface, this time at a specified remote_iptime Remote IP address, use host1the `` IP address eth0` interface:

   $ ovs-vsctl add-port br0 gre0 \
     -- set interface gre0 type=gre options:remote_ip=<IP of eth0 on host1>

test

Regardless of whether the virtual machine running on the same host or on different hosts, four virtual machines directly to the PING operation should be working properly.

Use ip route show(or equivalent command), running inside a virtual machine operating system's routing table should not display any information used by hosts IP subnet, IP subnets configured to display only the virtual machine operating system. To help illustrate this point, it is best to use the host system is completely different IP subnets in the guest virtual machine.

Troubleshooting

If the connection between virtual machines on different hosts does not work, check the following items:

  • Ensuring host1and host2by eth0(NIC connected to the transport network) connection to the network. This may require additional or IP routing IP routing rules.

  • To ensure that host1the gre0point host2on eth0and host2the gre0point on the 'host1' of eth0.

  • Make sure that all virtual machines are assigned IP addresses on the same subnet; this configuration does not require IP routing function.

Guess you like

Origin blog.csdn.net/sinat_20184565/article/details/94408810