0

I'm running a Centos 7 host with VirtualBox 6.1. I have a Centos 7 guest too. I want to be able to ping back and forth between the guest and the host.

In the VirtualBox Manager -> File -> Host Network Manager I have a network (it's the default) named vboxnet0 with 192.168.56.1/24 as the address.

In the guest Settings -> Network:

Adapter 1, Attached to: NAT

Adapter 2, Attached to: Host-only Adapter, Name: vboxnet0

The host ifconfig is:

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 28  bytes 2064 (2.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 28  bytes 2064 (2.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:c6:9c:7c  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.11  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::2bc1:a2d1:4bcd:c3ff  prefixlen 64  scopeid 0x20<link>
        ether 38:ba:f8:fa:5f:64  txqueuelen 1000  (Ethernet)
        RX packets 1318482  bytes 1822389690 (1.6 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 440532  bytes 78704767 (75.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The guest ifconfig is:

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::a00:27ff:fe52:a4bd  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:52:a4:bd  txqueuelen 1000  (Ethernet)
        RX packets 502  bytes 40521 (39.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 664  bytes 51094 (49.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.10  netmask 0.0.0.0  broadcast 255.255.255.255
        inet6 fe80::e7ac:941e:79fa:15bd  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:da:7b:e0  txqueuelen 1000  (Ethernet)
        RX packets 19  bytes 3546 (3.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 110  bytes 17546 (17.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 13896  bytes 48543578 (46.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13896  bytes 48543578 (46.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

If I go guest TO host, this is the terminal output:

$ ping -c 4 192.168.0.11
PING 192.168.0.11 (192.168.0.11) 56(84) bytes of data.
64 bytes from 192.168.0.11: icmp_seq=1 ttl=63 time=2.70 ms
64 bytes from 192.168.0.11: icmp_seq=2 ttl=63 time=0.513 ms
64 bytes from 192.168.0.11: icmp_seq=3 ttl=63 time=0.638 ms
64 bytes from 192.168.0.11: icmp_seq=4 ttl=63 time=0.466 ms

--- 192.168.0.11 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 0.466/1.079/2.700/0.938 ms

Yay!

If I try to go host TO guest, I cannot connect:

$ ping -c 4 192.168.56.10
PING 192.168.56.10 (192.168.56.10) 56(84) bytes of data.
From 192.168.56.1 icmp_seq=1 Destination Host Unreachable
From 192.168.56.1 icmp_seq=2 Destination Host Unreachable
From 192.168.56.1 icmp_seq=3 Destination Host Unreachable
From 192.168.56.1 icmp_seq=4 Destination Host Unreachable

--- 192.168.56.10 ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3000ms
pipe 4
[dogzilla@localhost ~]$ ping -c 4 10.0.2.15
PING 10.0.2.15 (10.0.2.15) 56(84) bytes of data.

--- 10.0.2.15 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 2999ms

I know there are a number of topics on this but there's no Windows in the mix... I'm using both CentOS 7 for both the host and the guest. Both firewalls are disabled for troublehsooting. Guest to host is working. How can I get host to guest working?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.