The topology diagram is as follows:
host1:10.20.10.70
host2:10.20.10.71
Create a OvS switch on Host 1 and Host 2, respectively:
Ovs-vsctl add-br OVS0IP Link set ovs0 up
Add a port (br0 on the same network segment) for OVS0, respectively:
Ovs-vsctl Add-port Ovs0 Br0
Create a GRE tunnel to Host2 in Host 1:
Ovs-vsctl add-port ovs0 gre0--set interface gre0 Type=gre options:remote_ip=10.20.10.71
Create a GRE tunnel to host1 in Host 2:
Ovs-vsctl add-port ovs0 gre0--set interface gre0 Type=gre options:remote_ip=10.20.10.70
Start a container on Host 1 (use pipework to hang the container on Br0 and assign an IP address of 192.168.2.10):
./ldocker.sh
Start a container on Host 2 (use pipework to hang the container on Br0 and assign an IP address of 192.168.2.11):
./ldocker.sh
Go to the container on Host 1 and Ping the container on host 2:
Can ping through ...
Configuration succeeded
The ldocker.sh code on the host1 is as follows (the reason for the repeated trial, to be soft, so use a simple script):
#!/bin/shdocker run-itd--name=test1 hochikong/erbuntu:v1pipework br0 test1 192.168.2.10/24
For information on how to enter the container operation Ping, see my other blog post: http://my.oschina.net/hochikong/blog/369036
Summary: Such a scheme allows the container of the same network segment to communicate across machines, enabling flexible deployment of applications. In addition, my topology and this architecture (http://www.sdnlab.com/8236.html) Implementation of the function is the same, you can refer to, but I am bridge and OvS mixed, but also can implement VLAN on the OVS0, there is no big problem.
In addition I try to configure IP for OVS0, two OVS0 Configure the same network segment IP (such as 10.0.0.1 and 10.0.0.2), the network can also communicate, remove also no problem.
Next I'm going to try to create more than one of these networks on two hosts, and the test results are a bit late.
#DDBMS # Build a simple Docker network