我的宿主机是MAC OS。在Virtualbox中,我创建了一个名为“vboxnet0”的主机专用网络,适配器IPv4地址为192.168.56.1/24,IPv6禁用和DHCP服务器禁用。
我有一个Ubuntu服务器虚拟机,为该虚拟机启用了2个网络适配器。适配器1使用eth0的NAT,适配器2使用eth1的主机专用网络“vboxnet0”。在/etc/network/interfaces中,我添加了以下命令:
我有一个Ubuntu服务器虚拟机,为该虚拟机启用了2个网络适配器。适配器1使用eth0的NAT,适配器2使用eth1的主机专用网络“vboxnet0”。在/etc/network/interfaces中,我添加了以下命令:
auto eth1
iface eth1 inet static
address 192.168.56.50
netmask 255.255.255.0
network 192.168.56.0
broadcast 192.168.56.255
从主机上,我可以ping虚拟机;但是我无法从虚拟机ping主机。
主机的路由表
Destination Gateway Flags Refs Use Netif Expire
default 192.168.0.1 UGSc 38 0 en1
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 9 169482 lo0
169.254 link#5 UCS 0 0 en1
192.168.0 link#5 UCS 0 0 en1
192.168.0.1/32 link#5 UCS 1 0 en1
192.168.0.1 84:94:8c:91:1a:f2 UHLWIir 40 25 en1 1194
192.168.0.15/32 link#5 UCS 0 0 en1
192.168.56 link#11 UC 2 0 vboxnet
192.168.56.1 a:0:27:0:0:0 UHLWIi 1 76 lo0
192.168.56.50 8:0:27:9d:5:77 UHLWI 0 5 vboxnet 1084
虚拟机的路由表:
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.0.2.2 0.0.0.0 UG 0 0 0 eth0
10.0.2.0 * 255.255.255.0 U 0 0 0 eth0
192.168.56.0 * 255.255.255.0 U 0 0 0 eth1
虚拟机的 ARP 表:
Address HWtype HWaddress Flags Mask Iface
192.168.56.1 ether 0a:00:27:00:00:00 C eth1
10.0.2.2 ether 52:54:00:12:35:02 C eth0
192.168.56.1的MAC地址与主机上的配置相同。这个信息表示ARP工作正常。
在主机上启动Wireshark以监听接口“vboxnet0”,可以看到主机收到了ARP和ICMP数据包。 ICMP数据包显示:“Expert Info(Warn / Sequence):未在第14帧中看到对ICMP请求的响应”(由于声望不足,我无法放置截图)