宿主机
#ifconfig
//docker 默认分配
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
inet6 fe80::42:40ff:fe28:8f83 prefixlen 64 scopeid 0x20<link>
ether 02:42:40:28:8f:83 txqueuelen 0 (Ethernet)
RX packets 736 bytes 57444 (56.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 711 bytes 96398 (94.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
//docker overlay
docker_gwbridge: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.18.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
inet6 fe80::42:5cff:fedd:deea prefixlen 64 scopeid 0x20<link>
ether 02:42:5c:dd:de:ea txqueuelen 0 (Ethernet)
RX packets 1054 bytes 367783 (359.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1054 bytes 367783 (359.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
//本地
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.26.11.221 netmask 255.255.255.0 broadcast 172.26.11.255
inet6 fe80::250:56ff:feae:5cc4 prefixlen 64 scopeid 0x20<link>
ether 00:50:56:ae:5c:c4 txqueuelen 1000 (Ethernet)
RX packets 1480090 bytes 1890922152 (1.7 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 657568 bytes 54366452 (51.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 1054 bytes 367783 (359.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1054 bytes 367783 (359.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
veth84b93c8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::94d4:3aff:feef:b633 prefixlen 64 scopeid 0x20<link>
ether 96:d4:3a:ef:b6:33 txqueuelen 0 (Ethernet)
RX packets 37 bytes 3165 (3.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 44 bytes 3230 (3.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vethed0f348: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::9437:6fff:fefb:a487 prefixlen 64 scopeid 0x20<link>
ether 96:37:6f:fb:a4:87 txqueuelen 0 (Ethernet)
RX packets 21 bytes 1482 (1.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 82 bytes 6716 (6.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
docker 容器:
#ifconfig
//docker overlay
eth0 Link encap:Ethernet HWaddr 02:42:0A:00:00:05
inet addr:10.0.0.5 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::42:aff:fe00:5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1450 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:648 (648.0 b) TX bytes:648 (648.0 b)
//docker 默认分配
eth1 Link encap:Ethernet HWaddr 02:42:AC:12:00:03
inet addr:172.18.0.3 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:acff:fe12:3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:22 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1622 (1.5 KiB) TX bytes:1609 (1.5 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
//docker容器
#route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.18.0.1 0.0.0.0 UG 0 0 0 eth1
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
10.0.0.0,172.18.0.0 都走网关 172.18.0.1 (docker_gwbridge) //docker overlay
//宿主机
#route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.26.11.254 0.0.0.0 UG 100 0 0 eth0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker_gwbridge
172.26.11.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
172.17.0.0 ,172.18.0.0 ,172.26.11.0 (docker0,docker_gwbridge,eth0 都走网关172.26.11.254)