VirtualBox: make host and guest OS talk between each other

Solution 1:

Rather than a "bridged" adaptor from what I can tell what you need to set up is a "host-only" adaptor.

The bridged adaptor will cut out your host entirely and forward all data via your physical network card, even bypassing the NAT mode that is used by default. I expect this is most useful if you want to host a network-wide service on a virtual machine.

The "host-only" adaptor on the other hand sets up a mini dhcp server (for your guest to get an IP) and passes data only between the host and guest.

You would set up the host-only connection in the same way as any other connection, using ifconfig and dhcpcd.

Solution 2:

Ref: https//blogs.oracle.com/fatbloke/entry/networking_in_virtualbox1

VM -> Settings -> Network

Set the first adaptor as Host-Only

  • The host OS gets 192.168.56.1 and the guests get 192.168.56.101/254

Set the 2nd adaptor with e.g. NAT

  • This will allow the guest OS to talk to the outer world
  • Every guest OS gets 10.0.2.15
  • Each guest OS can set its own port forwarding
  • to Of course, the same host ports should not be used for different guests