t7e*_*t7e 5 virtualbox ping hosts host-only guest
我有以下设置:
\n主机 Windows:
IPv4 Address. . . . . . . . . . . : 192.168.0.103\n Subnet Mask . . . . . . . . . . . : 255.255.255.0\n Default Gateway . . . . . . . . . : 192.168.0.1\nRun Code Online (Sandbox Code Playgroud)\nVirtualBox 中的虚拟机 Ubuntu:
\n2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000\n link/ether 08:00:27:01:85:e3 brd ff:ff:ff:ff:ff:ff\n inet 192.168.33.3/24 brd 192.168.33.255 scope global dynamic enp0s3\n valid_lft 359sec preferred_lft 359sec\n inet6 fe80::a00:27ff:fe01:85e3/64 scope link\n valid_lft forever preferred_lft foreve\nRun Code Online (Sandbox Code Playgroud)\nVirtualBox 仅主机以太网适配器:
\n Connection-specific DNS Suffix . :\n Link-local IPv6 Address . . . . . : fe80::1454:89c9:eb7c:9d6d%37\n IPv4 Address. . . . . . . . . . . : 192.168.33.1\n Subnet Mask . . . . . . . . . . . : 255.255.255.0\n Default Gateway . . . . . . . . . :\nRun Code Online (Sandbox Code Playgroud)\n虚拟机 DHCP:
\nServer 192.168.33.2\nMask 255.255.255.0\nLower addr 192.168.33.3\nUpper addr 192.168.33.254\nRun Code Online (Sandbox Code Playgroud)\n我可以轻松地ping从主机 Windows 到来宾:
ping 192.168.33.3\n\nPinging 192.168.33.3 with 32 bytes of data:\nReply from 192.168.33.3: bytes=32 time<1ms TTL=64\nReply from 192.168.33.3: bytes=32 time<1ms TTL=64\nReply from 192.168.33.3: bytes=32 time<1ms TTL=64\nRun Code Online (Sandbox Code Playgroud)\n否则它对我不起作用。也就是说,我无法从来宾 Ubuntu ping 到主机 Windows:
\nping 192.168.0.103\nping: connect: Network is unreachable\nRun Code Online (Sandbox Code Playgroud)\nPS 我什至尝试将客户机的地址修改为 192.168.0.3 以匹配主机的网络,实际结果是相同的:
\n我无法从客户机 Ubuntu ping 到主机 Windows 计算机192.168.0.103。
但是,来宾 (Ubuntu) 可以 ping VirtualBox 仅主机以太网适配器:
\nping 192.168.33.1\nPING 192.168.33.1 (192.168.33.1) 56(84) bytes of data.\n64 bytes from 192.168.33.1: icmp_seq=1 ttl=128 time=0.378 ms\n64 bytes from 192.168.33.1: icmp_seq=2 ttl=128 time=0.430 ms\nRun Code Online (Sandbox Code Playgroud)\nVirtualBox 有这个表:
\n https://www.virtualbox.org/manual/ch06.html
Host-only:\nVM\xe2\x86\x92Host +\nVM\xe2\x86\x90Host +\nVM1\xe2\x86\x94VM2 +\nVM\xe2\x86\x92Net/LAN -\nVM\xe2\x86\x90Net/LAN -\nRun Code Online (Sandbox Code Playgroud)\n这是正常的 VirtualBox 行为吗?(我看到人们可以在这种模式下从访客 ping 到主机的线程)。
\n我错过了什么?
这对于 Virtual Box 中的 Host Only 模式来说是正常的。
VirtualBox 仅主机适配器还可以充当 DHCP 服务器,为 VirtualBox 虚拟机分配 IP 地址。然后,主机(以及其他虚拟机,如果有)可以使用这些 IP 地址通过 ssh 或 sftp 连接到虚拟机(前提是虚拟机上运行着 ssh 服务器)。
这确实意味着使用 Host-Only 的虚拟机无法访问外界,但特别是,主机应该能够使用 ssh 登录虚拟机(运行 ssh 服务器)并使用 sftp 在主机之间传输文件和虚拟机。
如果您希望互连,请考虑使用桥接或 NAT 模式。那可行。
| 归档时间: |
|
| 查看次数: |
21414 次 |
| 最近记录: |