我有 Debian VM,无法在外部 ping 通它并在内部访问互联网。重要的要求是拥有 IP 地址来监听在 Debian 上运行的服务器。
默认情况下我的配置如下
我的主机ipconfig:
Ethernet adapter Local Area Connection 2:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Wireless Network Connection 4:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::a8b6:1fcc:cc1e:84d8%15
IPv4 Address. . . . . . . . . . . : 192.168.0.106
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
Ethernet adapter Local Area Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : ef.com
Ethernet adapter Bluetooth Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter VirtualBox Host-Only Network:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::1111:f5d3:1a86:f6b%19
Autoconfiguration IPv4 Address. . : 169.254.15.107
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :
Ethernet adapter VirtualBox Host-Only Network #2:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::3828:a1eb:e880:5f76%20
IPv4 Address. . . . . . . . . . . : 192.168.106.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
我在本地网络中为虚拟机添加了静态 IP。之后看起来如下:
但是,我仍然无法从虚拟机连接网络,也无法从主机 ping 此 IP。我是不是理解错了?只需在虚拟机设置中桥接,并在可用列表中设置 IP 就足够了