Many virtual machine programs come with a special "bridge" or "filter" driver which attaches to existing network interfaces and allows the program to send and receive packets (Ethernet frames) directly. For VirtualBox on Linux, this is done by vboxnetflt
kernel module when you choose "Bridged networking" in VBox settings. With this mode, the guest will be in the same IP network as the host.
Another equally common function is NAT – this works at a higher level and without any drivers. Whenever the guest attempts to start a TCP handshake, VirtualBox simply opens a TCP connection as if it were an ordinary program. (Similar for UDP and to a certain level ICMP.) VirtualBox even responds to the guest's DHCP requests.
VirtualBox does have its own virtual network interfaces like VMWare – they can be created in "Host-only networking" mode, and are usually named vbox*
. This again needs a kernel driver, vboxnetadp
on Linux.