Connect Docker via Openvswith on GIC Cloud Host

Source: Internet
Author: User
Tags openvswitch

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.