How to connect to a VirtualBox VM desktop remotely – and why you should

How to connect to a VirtualBox VM desktop remotely - and why you should

If you have ever used VirtualBox, chances are that you have encountered the following problem. You created a VM in VirtualBox and then wanted to access the VM desktop from another computer/OS (for example, your laptop) or remotely via SSH (or something else). If you are using Linux as the host OS, this process is easy and well-documented in the VirtualBox manual (however, it also works under Mac OS X and Windows). If you are using Windows as the host OS, there was no easy solution until now.

 Step 1: Networking

Configure the guest machine by adding your hostname, domain name (optional), static IP settings, network mask, gateway IP address, DNS servers, and search domains. The settings vary depending on the networking requirements of your LAN. Refer to the documentation that came with VirtualBox for more information. Most people will just want to configure them as an Unspecified interface with DHCP.

 Step 2: RDP

Once the RDP is setup, make sure the auto-login feature is enabled so that Windows can automatically log in for you when the system boots up. Setting up your auto-login password helps avoid any issues that may arise if someone else has physical access to your computer. This same password can be applied to other passwords in Windows by following these instructions. Be sure not to share your password with anyone who may have access to it because there’s no way of telling who will end up with your data once it leaves your machine!

 Step 3: Creating an SSH tunnel

Run the following command in terminal, substituting username with your SSH username, with the IP address of your server, and 3000 with any available port on the server that is not being used: ssh username@ -NfL 3000:localhost:22 Open ports 3000 on your local computer’s firewall by running this command in terminal (again substituting username with your SSH username): sudo ufw allow 3000 If connecting to port 22 causes errors on your remote computer, try disabling Secure Shell Protocol 2 (SSHv2) which can cause connectivity issues due to its increased security measures, as SSHv1 is an older protocol that has less latency.

 Step 4 (optional): X forwarding

To do this, press CTRL+SHIFT+ALT+F1. That will prompt the user login and password of the virtual machine. Once that is done, type in this command into the remote terminal: export DISPLAY=localhost:0 ̶ then hit enter.

A window with that virtual machine’s remote desktop should now appear on your own local computer. Press CTRL+SHIFT+ALT+F7 to disconnect from that session when you’re done accessing it remotely

 Step 5 (optional): Connecting to other VMs

If you want to know how to connect to another VM, just follow the same steps as before: right-click on your newly created VM in VirtualBox, go Settings, then click Network. Click on the tab marked Adapter 2 (assuming your remote connection has been given adapter number 2). Click on Enable Network Adapter if it isn’t already. Choose an IP address from one of the private ranges that won’t conflict with any of your other VMs, like for instance. Fill in this new IP’s subnet mask and gateway (if applicable), then enter the name for this device along with its domain name server(s) and hit OK when done.

Leave a Reply

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