VirtualBox Network Settings: NAT + Host-only Adapter

By default VirtualBox use NAT to let guest machine access public network, but the problem is that host machine and guest machine cannot communicate with each other by NAT. Here is a trick to fix this by adding anther Host-only network adapter.

First,VirtualBox > Preferences > Network, add a “Host-only Network” – vboxnet0, with following configs:

Screen Shot 2015-01-24 at 23.45.26

Then activate the “Host-only adapter” in “Devices – Network – Network Settings …” for the guest machine.  Right now we have two network adapters:

Check adapters in the guest machine by these commands

Then edit the network config:

Enable eth1:

Disable eth1:

In host machine map the static ip address “192.168.56.7” to local domain “ant

Note that eth0 will get a default gateway from dhcp, but eth1 has no default gateway specified.

Leave a Reply

Your email address will not be published. Required fields are marked *