How does the Host-Only Adapter work?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Emmanuel
Posts: 2
Joined: 5. Jun 2020, 09:56

How does the Host-Only Adapter work?

Post 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?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How does the Host-Only Adapter work?

Post 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
Emmanuel
Posts: 2
Joined: 5. Jun 2020, 09:56

Re: How does the Host-Only Adapter work?

Post 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.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: How does the Host-Only Adapter work?

Post 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.
Bill
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: How does the Host-Only Adapter work?

Post 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.
Post Reply