You'll not be able to directly access your guest virtual machine in
Virtualbox if it's under
You'll have to first configure port forwarding on
Virtualbox to access your virtual machines from your host machine via protocols such as
Virtualbox's main interface and make sure the virtual machine that you want to configure is powered off.
Settingsicon on the top toolbar. Alternatively, right click on the virtual machine and click
Advancedtext at the bottom of the window.
+icon on the upper right to add new port forwarding rule in
Port Forwarding's main interface.
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
Host IP field blank will default to
Guest IP defaults to whatever the IP address is assigned to the guest VM.
[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
Comment anonymously. Login not required.