Implemented by:
1. Create GIC Cloud Host (CENTOS7):
Public network IP 114.112.62.75,
Private network IP 192.168.1.4, private network network card ens224
2. Install Openvswitch, I refer to the Openvswitch 2.5.x documentation, after making the RPM package, yum localinstall rpm package.
3. Install Docker,
Yum Install Docker
Service Docker start
4. Create a network Bridge
Ovs-vsctl ADD-BR HelloWorld
5. Add the private network card to the bridge and give the bridge an IP address
Ovs-svctl Add-port HelloWorld ens224
IP addr Add 192.168.1.100/24 dev HelloWorld brd 192.168.1.255
6. Install Nsenter to see the network namespace for Docker
Yum Install util-linux.x86_64
7. Creation of two Docker
Docker Pull CentOS
Docker RUN-ITD--name=container1--net=none Centos/bin/bash
Docker RUN-ITD--name=container2--net=none Centos/bin/bash
View two Docker's PID
Docker Inspect--format "{{. State.pid}} "Container1
5522
Docker Inspect--format "{{. State.pid}} "Container2
5413
Operate two Docker namespace via Nsenter, such as:
Nsenter-t 5522-n IP Addr
8. Connect two Docker to a bridge
Ovs-docker add-port helloworld eth0 container1--ipaddress 192.168.1.101/24
Ovs-docker add-port helloworld eth0 container2--ipaddress 192.168.1.102/24
At this time, two Docker and private network completely opened.
The configuration of the second host in the diagram is similar and will not be described.
Connect Docker via Openvswith on GIC Cloud Host