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

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

我正在尝试使用host-only与我的 VirtualBox 虚拟机的连接。我的 VM 已设置并且可以 ping 通主机 ( 192.168.56.1) 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.1  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

[user@localhost] : ~ $ route
Kernel IP routing table
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     0      0        0 enp0s25
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 通 VM ( ) enp0s25

相关内容