【发布时间】:2023-03-08 22:17:02
【问题描述】:
TL;DR
从虚拟机上运行的 docker 容器中,我可以 ping 我的所有主机 IP(例如 10.10.10.1 和 172.24.185.209),但我无法 ping 10.0.75.1。我的猜测是,一旦我弄清楚为什么我无法访问 10.0.75.1 网络适配器,共享问题就会得到解决。
我已经通过this post 描述了同样的问题并尝试了各种建议但没有成功。我尝试了以下方法:
- 使用以下命令将 Docker 接口设置为私有:
- Set-NetConnectionProfile -interfacealias "vEthernet (DockerNAT)" -NetworkCategory Private
- Telnet 成功到 10.0.75.1 445
- 共享 C 盘并检查是否可以从 \10.0.75.1\c 访问它
- 关闭了“域”、“公共”、“私人”的防火墙
- 我尝试为“vEthernet (DockerNAT)”卸载“Microsoft 网络的文件和打印机共享”(按照某人的建议重新安装)但收到错误:0x80071779
- 然后我取消选中“vEthernet (DockerNAT)”的“Microsoft 网络的文件和打印机共享”,单击“确定”,然后重新选中。
- 我也为 Windows 重新安装了 Docker 几次
我正在使用以下内容:
- Windows10 版本 1803(操作系统内部版本 17134.285)
- Docker CE 版本 18.06.1-ce-win73 (19507),频道:稳定
更新日期:2018 年 9 月 27 日
我试图连接到虚拟机并四处寻找,但它不能 - 它一直说“视频远程处理已断开”。但是在https://docker-saigon.github.io/post/Docker-Beta/#private-registries:ebf9573d6838c40027746e9d7482622a 之后,我在虚拟机上运行了一个容器并通过它访问了虚拟机。我正在使用以下内容运行容器,因此我可以完全访问来宾网络 (--net=host)
docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh
我在主机上有以下适配器:
PS C:\WINDOWS\system32> ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : consilins2
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter Ethernet 5:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : PANGP Virtual Ethernet Adapter #2
Physical Address. . . . . . . . . : 02-50-41-00-00-01
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Ethernet adapter vEthernet (Default Switch):
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
Physical Address. . . . . . . . . : 2C-15-60-80-CD-1B
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Ethernet adapter vEthernet (Default Switch) 2:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
Physical Address. . . . . . . . . : 02-15-9F-19-92-4C
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::1d6e:1706:ba33:33a8%31(Preferred)
IPv4 Address. . . . . . . . . . . : 172.24.185.209(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.240
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 520099165
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-22-97-33-8D-9C-B6-D0-EC-24-55
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Disabled
Ethernet adapter vEthernet (DockerNAT):
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #3
Physical Address. . . . . . . . . : 00-15-5D-12-B3-04
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 10.0.75.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
Wireless LAN adapter Local Area Connection* 2:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
Physical Address. . . . . . . . . : 9E-B6-D0-EC-24-55
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Wireless LAN adapter Local Area Connection* 3:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2
Physical Address. . . . . . . . . : AE-B6-D0-EC-24-55
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Killer Wireless-n/a/ac 1535 Wireless Network Adapter
Physical Address. . . . . . . . . : 9C-B6-D0-EC-24-55
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::504d:580b:1452:d100%29(Preferred)
IPv4 Address. . . . . . . . . . . : 10.10.10.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Wednesday, September 26, 2018 4:35:28 PM
Lease Expires . . . . . . . . . . : Friday, September 28, 2018 6:28:00 AM
Default Gateway . . . . . . . . . : 10.10.10.254
DHCP Server . . . . . . . . . . . : 10.10.10.254
DHCPv6 IAID . . . . . . . . . . . : 127710928
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-22-97-33-8D-9C-B6-D0-EC-24-55
DNS Servers . . . . . . . . . . . : 10.10.10.254
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter Bluetooth Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
Physical Address. . . . . . . . . : 9C-B6-D0-EC-24-56
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
PS C:\WINDOWS\system32>
从 docker 容器中可以看出,我有以下适配器:
docker0 Link encap:Ethernet HWaddr 02:42:DE:73:21:B4
inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0
inet6 addr: fe80::42:deff:fe73:21b4/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:348 (348.0 B)
eth0 Link encap:Ethernet HWaddr 02:50:00:00:00:01
inet addr:192.168.65.3 Bcast:192.168.65.255 Mask:255.255.255.0
inet6 addr: fe80::383b:a8ff:fe9f:2902/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:1978 (1.9 KiB)
hvint0 Link encap:Ethernet HWaddr 00:15:5D:12:B3:03
inet addr:10.0.75.2 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::215:5dff:fe12:b303/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2896 errors:0 dropped:57 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:550086 (537.1 KiB) TX bytes:3128 (3.0 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:34 errors:0 dropped:0 overruns:0 frame:0
TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:3228 (3.1 KiB) TX bytes:3228 (3.1 KiB)
从虚拟机上运行的 docker 容器中,我可以 ping 我的所有主机 IP(例如 10.10.10.1 和 172.24.185.209),但我无法 ping 10.0.75.1。我的猜测是,一旦我弄清楚为什么我无法访问 10.0.75.1 网络适配器,共享问题就会得到解决。
我希望这可能是一个更好定义的问题来解决。再次感谢任何帮助。
谢谢,
阿米特
【问题讨论】:
-
当容器未运行但虚拟机仍处于活动状态时,您可以在 10.0.75.1 和 10.0.75.2 之间 ping 吗?
标签: docker networking firewall hyper-v docker-for-windows