Windows ping 不通虚拟机里面的docker

ぶぽめつせ
  • 1
新手上路,请多包涵
|----------------------------------------|
|                                        |
|   |--------------------------------|   |
|   |                                |   |
|   |    docker(CentOS) 172.18.0.2   |   |
|   |--------------------------------|   |
|                                        |
| Virtual Machine(CentOS) 192.168.27.143 |
|----------------------------------------|

         Windows 192.168.137.123

Windows 可以 ping 虚拟机

虚拟机 可以 ping Windows

虚拟机 可以 ping docker

Docker 可以 ping 虚拟机

Docker 可以 ping Windows

但是 WINDOWS 不可以 PING DOCKER(request time out)

在虚拟机ifconfig

[root@docker ~]# ifconfig
br-fff1cd703408: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 172.18.255.255
        inet6 fe80::42:7bff:fe3f:7669  prefixlen 64  scopeid 0x20<link>
        ether 02:42:7b:3f:76:69  txqueuelen 0  (Ethernet)
        RX packets 5  bytes 378 (378.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 18  bytes 1480 (1.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:b6:b4:25:97  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.27.143  netmask 255.255.255.0  broadcast 192.168.27.255
        inet6 fe80::5634:e3d1:16db:c070  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:ee:e9:81  txqueuelen 1000  (Ethernet)
        RX packets 434  bytes 41635 (40.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 289  bytes 32577 (31.8 KiB)
        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 1000  (Local Loopback)
        RX packets 3  bytes 312 (312.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3  bytes 312 (312.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vethdd8e4ad: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::e467:dcff:fe56:3d24  prefixlen 64  scopeid 0x20<link>
        ether e6:67:dc:56:3d:24  txqueuelen 0  (Ethernet)
        RX packets 5  bytes 378 (378.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 18  bytes 1480 (1.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

在docker ifconfig

[root@master /]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.18.0.2  netmask 255.255.0.0  broadcast 172.18.255.255
        ether 02:42:ac:12:00:02  txqueuelen 0  (Ethernet)
        RX packets 31  bytes 2530 (2.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 18  bytes 1428 (1.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker commit -m "hadoop" -a "hxp" def8faf07d6b hxp/hadoop:1.0

docker network create --driver=bridge --subnet=172.18.0.0/16 hadoop-net

docker run -itd -h master --name master --network hadoop-net --privileged -v /opt/docker:/opt/docker --ip 172.18.0.2 -p 50070:50070 -p 8088:8088 hxp/hadoop:1.0 /usr/sbin/init

我尝试了在Windows route add ,但是还是不行

route add 172.18.0.0 mask 255.255.0.0 192.168.27.143

回复
阅读 401
1 个回答

ping使用ICMP协议需要双向通信,你还需要在docker里面添加访问windows网络的路由。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
你知道吗?

宣传栏