How to run Virtualbox on bridged and host-only networks?

Solution 1:

Figured it out. I was following this tutorial and I was putting in eth1 instead of eth2. I had to use eth2 because host-only was 'adapter 3' in the VB settings-network (using VB's GUI). Now I am able to run both bridged and host-only!

For /etc/hosts: On the host machine I put: 'host-only-IP' 'servername' On the guest VB I put both the host-only and the bridged IP's with the same servername. Doesn't seem to cause an issue.

So to summarize; I have 3 adapters on the VB instance

  1. Bridged
  2. Nat
  3. Host-only.

I have the host file on my host machine configured to use the host-only IP and my desktop host file is configured to use the bridged IP address. This way I can take out my laptop off the network and still be able to ssh into my VirtualBox server without changing any settings. Then I can turn the NAT network adapter on and the VirtualBox can use my hosts network for the internet away from my home network.