You'll not be able to directly access your guest virtual machine in Oracle's Virtualbox if it's under a NAT network. This is because it's in a completely different private network than the host machine.
For this you'll need to forward traffic for a specific port from your local IP to a port on your VM. This will allow you to access your virtual machines from your host machine via protocols such as SSH or RDP.
To do this you'll need to configure port forwarding for your Virtualbox VMs that are in NAT network.
In this example, port 2202 in the host machine will forward to port 22 of the guest machine whereby 10.0.2.15 is the default IP for guest VM under NAT network.
It's more convenient to leave the Host IP field blank which will default to 127.0.0.1 and Guest IP defaults to whatever the IP address is assigned to the guest VM. This simplifies the configuration and avoid the issue of the Guest IP changing.
[email protected]:~ $ ssh -p2222 [email protected] Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts. [email protected]'s password: Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-20-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Wed Sep 5 16:52:59 +08 2018 System load: 0.0 Processes: 91 Usage of /: 18.8% of 8.80GB Users logged in: 1 Memory usage: 6% IP address for enp0s3: 10.0.2.15 Swap usage: 0% 138 packages can be updated. 72 updates are security updates. Last login: Wed Sep 5 16:47:16 2018 from 10.0.2.2 To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. [email protected]:~$
The above example uses SSH as an example and SSH by default runs on port 22. In this case the host's port 2222 forwards to the guest's port 22.
Comment anonymously. Login not required.