How to Access Your Guest OS from Host OS in Virtualbox 6.1

Virtualbox is a very important desktop software for any person in IT. It allows us to spin up environments and run tests on operating systems without the fear of making a mistake or loosing anything. In the world of Virtualbox, the guest OS is the operating system that you run inside the virtual server while the host OS is the operating system of your computer – where Virtualbox itself is installed. Many a times, you may want to connect to your guest OS from your host. Here we will look at how you can achieve that.

Environment Setup

• Host OS is Ubuntu 20.04
• Guest OS is Debian based ProxMox Mail Gateway
• Virtualbox version used is 6.1.8

I installed ProxMox Mail Gateway on Virtualbox and want to access it via my host OS, as my browser is on the host OS. The idea is to set up a Host Only Network and connect the virtual server to it. This is how you do it.

1. Ensure your virtual server is powered off first.

2. On Virtualbox, click File>>Host Network Manager or simply Ctrl+H

3. Click Create icon on your top left. A new network called vboxnet0 will be created.

4. Click on DHCP Server.

5. Under DHCP Server, check Enable Server. You can then fill in the lower and upper addresses as desired and the Server Address though the default ones should work just fine

6. Click Apply and Close

7. Back to Virtualbox, Click on the virtual server you want to connect from your host OS and click Settings

8. Go to Network>>Adapter 2

9. Under Attached to, select Host-only Adapter then under Name, select vboxnet0 then click Ok

Now, Start the virtual server and login using your credentials

Run ifconfig or ip addr command to view the network interfaces and the IP assigned to your virtual server.

Note: If the IP address is not visible on the network interfaces of your virtual server, run the commands below on your virtual server to assign an IP to the a network interfaces. Replace enp0s8 with your network interface name.

$ ip link set dev enp0s8 up
$ dhclient -v  enp0s8

At this point, you should be able to reach your guest OS from your host. You can test this using ping or simply access the application you intended to access from the guest OS.

Note: For some applications that use custom ports, such as Proxmox Mail Gateway which uses port 8006, please ensure that the ports are allowed on the firewalls of Guest and Host OS

Leave a Reply

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