It confuses me about NAT networking, but I can use VMware and Parallels Desktop to do that.
I knew NAT how it works, just need an explain about this situation.
The following is from official documents. Why HOST can't connect GUEST with NAT.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
If you want to connect to the guest machine from the host, using NAT Network:
First, create a NAT Network - create the network in the VirtualBox Manager, File -> Preferences -> Network, and give it a name.
Assign that named NAT Network to each of the guest machines in their Network configurations in VirtualBox.
Make a note of what IP address is assigned to your guest machines when you run them. It will be something like 10.0.2.15 or 10.0.2.4. In Posix systems, run "ifconfig" and see what ip addresses show up for em0. Make a record of which address goes to which guest machine.
Edit the NAT Network's port forwarding. In VirtualBox manager, go to File -> Preferences -> Network and click the edit button for the NAT Network you are using. Click on Port Forwarding. Add rules that forward ports on your host machine to ip address + port on the guests (You don't need to set the IP address for your host machine, that's optional).
I know this is old, but the topic is relevant still, and I don't think I've seen this response yet, so here goes... I came to this thread with the same question. Then I thought about it for a bit and realized an ideal solution that is easy to implement.
Add a second interface!!
One is the NAT interface for the VM to talk to the Internet. The other is a host-only interface. In my case, I'm installing a CentOS guest OS. The new interface shows up, both get their IPs on the respective networks. The host-only doesn't establish a default route, so no conflicts. It just works. I access the guest OS openly from the host using the IP on the host-only network that is defined within VirtualBox.