Page 1 of 1

How does the Host-Only Adapter work?

Posted: 5. Jun 2020, 10:28
by Emmanuel
Hi, I have been trying out the different networks in VirtualBox and I came across a behavior that I hope someone would be able to explain.

I have the 2 set ups:
1. VM using Host-Only network
2. VM using NAT Network

In both cases I am trying to send ICMP packets from the VM to the host via the Host-Only network adapter (An IP is assigned to it and I attempt to ping the IP). Both of them results in a ICMP reply.

In setup 1, The ping packets can be picked up by a packet sniffer listening on the Host-Only network adapter, which made sense. However, in setup 2, the ping packets cannot be detected on the Host-only network adapter. The packets seems to have been found on the loopback interface instead.

I don't quite understand the following:
1. Why is it still possible to ping the Host-Only network adapter when the VM is not connected to the Host-Only network
2. Why did the packet go to the loopback adapter instead?

I figured that I am unable to understand this primarily because I do not understand how the virtual Host-Only adapter function. Could anyone help me with this?

Re: How does the Host-Only Adapter work?

Posted: 5. Jun 2020, 23:05
by scottgus1
I'm not sure about the ping packet thing, but you can look at the various Virtualbox networks here: Virtualbox Networks: In Pictures

Re: How does the Host-Only Adapter work?

Posted: 8. Jun 2020, 03:28
by Emmanuel
Thank you so much scottgus1, really appreciate it. :)

The post was helpful, but I guess I still don't understand why the problem exist. Do you happen to know how the Host-only adapter functions when it is not being utilized by the VM? After all these adapters still exist in the Window's network configuration page even when VirtualBox does not have any virtual machine running.

Re: How does the Host-Only Adapter work?

Posted: 8. Jun 2020, 04:26
by BillG
Yes, the interface is always present in the host whether the vm is running or not. So are all the other network interfaces in the host, but they don't do anything until something is connected to them.

I would imagine that the host only interface on the host is in fact some sort of loopback interface. The traffic should never leave the host environment, and that is pretty much the definition of a loopback adapter. The traffic should never be forwarded by the host to any other device.

Re: How does the Host-Only Adapter work?

Posted: 8. Jun 2020, 23:06
by fth0
Emmanuel wrote:In both cases I am trying to send ICMP packets from the VM to the host via the Host-Only network adapter (An IP is assigned to it and I attempt to ping the IP). Both of them results in a ICMP reply.
Just to be sure: Are you talking about the IP address of the Host-only adapter, or the IP address that is assigned to the guest network adapter?

If you still have questions, please explain your 2nd setup describing more details: host network interfaces and IP configuration, VirtualBox network configuration, guest network interfaces and IP configuration, ping command.