0

I'm trying to use a host-only connection with my VirtualBox VM. My VM is set up and can ping the host (192.168.56.1) on vboxnet0.

If I disconnect the host from my local network (internet access) I can ping the VM no problem. However I would like to be able to access both the internet and the VM. This is what my ifconfig looks like:

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

Here's the output of 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

It appears to me I'm correctly configured to use both interfaces but, like I said, I can't ping the VM (192.168.56.66) while I'm connected on enp0s25.

0

1 Answer 1

1

For some reason you have two default gateways, and you need only one that goes via enp0s25.

Is your VM in the 192.168.56.0/24 network? If yes, then the second default gateway shouldn't affect connectivity.. In that case I don't know what is the issue here.

Not the answer you're looking for? Browse other questions tagged .