22, "5 minutes a day to play Docker container technology" Learning--flannel network Internal structure

Source: Internet
Author: User
Tags docker run etcd

I. Introduction to the Environment

Second, the environment construction

Environment construction here will not repeat, please refer to the previous article!

http://blog.51cto.com/hostman/2103503

Here we start by configuring flannel information into the database

Create a file Flannel-config.json, write the following:

Cat >> Flannel-config.json <<eof

{

"Network": "10.10.0.0/16",

"Subnetlen": 24,

"Backend": {

"Type": "Vxlan"

}

}

EO F

Network The IP pool that defines the network is 10.10.0.0/16.

Subnetlen Specifies that each host is assigned a subnet size of 24 bits, or 10.10.X.0/24.

Backend to be The type of communication. Vxlan, that is, between the host through Vxlan communication, the following will also discuss HOST-GW.

Etcdctl--endpoints=192.168.56.131:2379 Set/docker-test/network/config < Flannel-config.json

Booting the flannel network on Docker01 and DOCKER02 hosts

flanneld-etcd-endpoints=http://192.168.56.1 to : 2379-iface=en S33 -etcd-prefix=/docker-test/network

Do not close the terminal window here

Third, the current network environment

1, the network structure after the installation is complete

Docker01 host adds a network card for 10.10.10.0 network segment FLANNEL.1

DOCKER02 host adds a network card for 10.10.58.0 network segment FLANNEL.1

Can see no netns, from the above information can be obtained, flannel is currently a virtual network card

You can see that we are only doing "Install etcd--Install Flannel--flannel Association ETCD", but the Docker host does not have a flannel network associated with it, do the following:

Specify Flannel_subnet segment and FLANNEL_MTU Maximum transmission unit in Docker Daemon (Docker hosts with flannel network need to be configured)

--bip--MTU

Docker01 Host

Docker02 Host

View Docker host current network conditions

As you can see, the address of the DOCKER0 default bridged NIC is the address of the BIP that we configured in Docker daemon

The current network structure is as follows:


Iv. Create a flannel-driven network in the container, the container layout is as follows:

Docker RUN-ITD--name Xbox1 BusyBox

Docker RUN-ITD--name Xbox2 BusyBox


Docker RUN-ITD--name Xbox3 BusyBox

Docker RUN-ITD--name xbox4 BusyBox

V. Network analysis (Container--host) taking Docker01 as an example

1. Container Info

Docker exec xbox1 IP link show

Docker exec xbox1 IP addr Show

Docker exec xbox1 IP route show

You can see that there is an LO port and another network port in our container, and the flannel network only generates one network card

2. Host Info


In the container: 5: [Email protected] Host: 6: [email protected] is a pair of vnet_pair, and the bridge is connected to the Docker0 bridge

can communicate with the external network, traceroute can see 10.10.10.1 Jump to 192.168.56.2


Communication with host, direct access

The communication structure is as follows


Cross-host communication, everyone hands-on test!

22, "5 minutes a day to play Docker container technology" Learning--flannel network Internal structure

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.