docker_practice/advanced_network
Baohua Yang a3d8341e27 rewrite the fast_config and dns part of the advanced network chapter 2014-09-18 14:09:51 +08:00
..
README.md rewrite the introduction of advanced network chapter; redraw the figure 2014-09-18 13:07:31 +08:00
bridge.md Add the advanced network chapter 2014-09-05 15:52:56 +08:00
communication.md fix code formatting and rewrite part content 2014-09-17 19:23:52 +08:00
dns.md rewrite the fast_config and dns part of the advanced network chapter 2014-09-18 14:09:51 +08:00
docker0.md Add the advanced network chapter 2014-09-05 15:52:56 +08:00
example.md fix the terminologies, add more content 2014-09-17 16:31:25 +08:00
fast_config.md rewrite the fast_config and dns part of the advanced network chapter 2014-09-18 14:09:51 +08:00
how_connect.md minor fix 2014-09-17 23:25:32 +08:00
port_mapping.md rename images directory to _images 2014-09-17 14:52:55 +08:00
ptp.md fix the terminologies, add more content 2014-09-17 16:31:25 +08:00

README.md

#高级网络配置 本章将介绍Docker的一些高级网络配置和选项。

当Docker启动时会自动在主机上创建一个docker0虚拟网桥实际上是Linux的一个bridge可以理解为一个软件交换机。它会在挂载到它的网口之间进行转发。

同时Docker随机分配一个本地未占用的私有网段RFC1918中定义)中的一个地址给docker0接口。比如典型的172.17.42.1,掩码为255.255.0.0。此后启动的容器内的网口也会自动分配一个同一网段(172.17.0.0/16)的地址。

当创建一个Docker容器的时候同时会创建了一对veth pair接口(当数据包发送到一个接口时,另外一个接口也可以收到相同的数据包)。这对接口一端在容器内,即eth0;另一端在本地并被挂载到docker0网桥,名称以veth开头(例如vethAQI2QT。通过这种方式主机可以跟容器通信容器之间也可以相互通信。Docker就创建了在主机和所有容器之间一个虚拟共享网络。

Docker网络

接下来的部分将介绍在一些场景中docker所有的网络定制配置。linux的原生命令将调整、补充、甚至替换docker默认的网络配置。