转自:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/4/html/Installation_and_Configuration_Guide/Configuring_Open_vSwitch_tunnels.html
13.4.4. Configure Open vSwitch Tunnels
Tunneling with Open vSwitch allows you to encapsulate network traffic between physical Networking hosts. This enables VLANs to span multiple physical hosts and consequently permits instances to communicate as if they‘re on the same layer 2 network. Open vSwitch supports tunneling with the VXLAN and GRE encapsulation protocols.
GRE configuration example
?
Figure 13.2. Example GRE Tunnel
This diagram represents two instances running on two separate hosts connected by a GRE tunnel. Also illustrated are the required supporting physical and virtual components. This example steps through the creation of a GRE or VXLAN tunnel between two OVS running on separate Networking hosts.
?
Procedure 13.9. Tunnel configuration steps
- Each host participating in the network will required a virtual bridge named
br-int
; created using theovs-ctl
command on each host:ovs-vsctl add-br OVS-BR0
- With each bridge created, you are now able to create the tunnel, and create links between the two OVS-BR0 virtual bridges created above.
Run the ovs-vsctl command on HOST1 to create the tunnel and link it to the bridge on HOST2
GRE tunnel command:
ovs-vsctl add-port ovsbr0 gre1 -- set Interface gre1 type=gre options:remote_ip=192.168.1.11
For a VXLAN tunnel:
ovs-vsctl add-port ovsbr0 vxlan1 -- set Interface vxlan1 type=vxlan options:remote_ip=192.168.1.11
- Run the ovs-vsctl command on HOST1 to create the tunnel and link it to the bridge on HOST2
GRE tunnel command:
ovs-vsctl add-port ovsbr0 gre1 -- set Interface gre1 type=gre options:remote_ip=192.168.1.10
VXLAN tunnel command:
ovs-vsctl add-port ovsbr0 vxlan1 -- set Interface vxlan1 type=vxlan options:remote_ip=192.168.1.10
Successful completion of these steps results in the two instances sharing a layer-2 network between separate hosts.