How to Access Host Services From a Virtualbox Guest OS

In this tutorial, I will show you how to access host services from a virtualbox guest OS.

A Bit of Background Knowledge

Open the settings dialog of your virtual machine and select Networking on the left pane.

virtualbox NAT networking mode

You will see that the default networking mode is set to NAT. The NAT mode enables guest machines to browse the Internet.  A virtual router(Virtualbox networking engine) resides between host machine and each guest machine. If you create two guest machines, then there will be two virtual routers. So a guest machine can browse the Internet through virtual router but guest machines can not talk to each other and they can not directly talk to host machine.

Find the IP Address of Virtual Router

To be able to access host services from within a guest, first you need to find out the IP address of the virtual router between host and guest. Open up a terminal in the guest OS ( I assume your guest is Linux) and run the following command.

ip route show

Look at the first line of output, the address after “default via” is the IP address of virtual router. In this case, is the IP address of virtual router.

find default gateway on linux

Access Host Services From a Virtualbox Guest

Let’s say you installed a Apache Web server on the host and you want to access your local website from within the guest, all you need to do is to fire up a browser on the guest and enter the IP address of virtual router in the address bar. You will be able to view your site.

virtualbox guest access host service

To SSH into your host, just run this command in the guest:

ssh [email protected]

I had also configured a Shadowsocks socks5 proxy on the host and I want to use the shadowsocks proxy from within my guest. Although I could setup another shadowsocks proxy in the guest, but that requires more work.

So all I need to do is to open the proxy configuration dialog of Firefox in the guest and enter the IP address of virtual router in the SOCKS Host field. Enter the port number of Shadowsocks proxy. Check SOCKS v5 and Remote DNS. Save settings.

firefox proxy configuration

Now I can use Shadowsocks proxy to bypass the Great Firewall within the guest and the best part is I don’t have to install any software in the guest.


Rate this tutorial
[Total: 0 Average: 0]

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here