码迷,mamicode.com
首页 > 其他好文 > 详细

docker 实战---多台物理主机的联网,容器桥接到物理网络

时间:2018-05-10 19:33:00      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:容器桥接到物理网络

docker 默认的桥接网卡是docker0

它只会在本机桥接所有的容器网卡,举例来说容器的虚拟网卡在主机上看一般叫做veth***  而docker只是把所有这些网卡桥接在一起,如veth2a4c51b:

[root@docker1 ~]# brctl show

bridge name   bridge id           STP enabled     interfaces

br0        8000.0050562539b9      no          ens33

[root@docker1 ~]# systemctl start dockeer

Failed to start dockeer.service: Unit not found.

[root@docker1 ~]# systemctl start docker

[root@docker1 ~]# brctl show

bridge name     bridge id            STP enabled     interfaces

br0           8000.0050562539b9       no           ens33

docker0        8000.02427091b8df       no

[root@docker1 ~]# docker ps -a

CONTAINER ID    IMAGE         COMMAND       CREATED      STATUS              PORTS                     NAMES

6ceaacf4f8d6  registry   "/entrypoint.sh /etc/"   2 weeks ago  Exited (1) 8 days ago   0.0.0.0:5000->5000/tcp       backstabbing_mclean

[root@docker1 ~]# docker start 6ceaacf4f8d6 

6ceaacf4f8d6

[root@docker1 ~]# brctl show

bridge name     bridge id          STP enabled     interfaces

br0          8000.0050562539b9       no          ens33

docker0        8000.02427091b8df      no          veth2a4c51b

[root@docker1 ~]# ip a s

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

       valid_lft forever preferred_lft forever

    inet6 ::1/128 scope host 

       valid_lft forever preferred_lft forever

2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP qlen 1000

    link/ether 00:50:56:25:39:b9 brd ff:ff:ff:ff:ff:ff

    inet6 fe80::250:56ff:fe25:39b9/64 scope link 

       valid_lft forever preferred_lft forever

5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000

    link/ether 00:50:56:25:39:b9 brd ff:ff:ff:ff:ff:ff

    inet 10.0.0.10/24 brd 10.0.0.255 scope global br0

       valid_lft forever preferred_lft forever

    inet6 fe80::250:56ff:fe25:39b9/64 scope link 

       valid_lft forever preferred_lft forever

6: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 

    link/ether 02:42:70:91:b8:df brd ff:ff:ff:ff:ff:ff

    inet 172.17.0.1/16 scope global docker0

       valid_lft forever preferred_lft forever

    inet6 fe80::42:70ff:fe91:b8df/64 scope link 

       valid_lft forever preferred_lft forever

8: veth2a4c51b@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP 

    link/ether 72:b4:21:83:04:b4 brd ff:ff:ff:ff:ff:ff link-netnsid 0

    inet6 fe80::70b4:21ff:fe83:4b4/64 scope link 

       valid_lft forever preferred_lft forever





docker 实战---多台物理主机的联网,容器桥接到物理网络

标签:容器桥接到物理网络

原文地址:http://blog.51cto.com/sf1314/2114974

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!