在两个接口上无法访问仅主机网络

在两个接口上无法访问仅主机网络

我正在尝试使用host-onlyVirtualBox VM 连接。我的 VM 已设置好,可以 ping 主机 ( 192.168.56.101) vboxnet0

如果我断开主机与本地网络(互联网访问)的连接,我可以毫无问题地 ping 虚拟机。但是我希望能够同时访问互联网和虚拟机。我的虚拟机如下所示ifconfig

enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.7.30  netmask 255.255.255.0  broadcast 10.0.7.255
        inet6 fe80::3e97:eff:fe2b:5d3e  prefixlen 64  scopeid 0x20<link>
        ether 3c:97:0e:2b:5d:3e  txqueuelen 1000  (Ethernet)
        RX packets 1468619  bytes 1793380003 (1.6 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 877021  bytes 94509833 (90.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xf2900000-f2920000  

vboxnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.101  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::800:27ff:fe00:0  prefixlen 64  scopeid 0x20<link>
        ether 0a:00:27:00:00:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6212  bytes 278937 (272.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

以下是 的输出route

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         gateway         0.0.0.0         UG    100    0        0 enp0s25
default         gateway         0.0.0.0         UG    101    0        0 vboxnet0
10.0.7.0        0.0.0.0         255.255.255.0   U     100    0        0 enp0s25
192.168.56.0    0.0.0.0         255.255.255.0   U     100    0        0 vboxnet0

192.168.56.66在我看来,我已经正确配置为使用这两个接口,但是,就像我说的,当我连接到 时,我无法 ping 虚拟机( ) enp0s25

相关内容