Port Forwarding And Networking Basics To Access Virtualbox Guest Applications

Ashok Raja
Technology Specialist
August 6, 2018
Rate this article
[Total: 1    Average: 4/5]
Views    150

If your Virtualbox guest OS doesn’t have a GUI installed, then understanding the basics of Virtualbox networking and Port Forwarding helps to easily access Guest machine’s applications from Host Machine or from any device within the network.

This article helps to decide the networking approach to be taken in certain common scenarios and when to perform port forwarding in Virtualbox.

If you are new to Virtualbox, refer this article to learn more on installing and configuring an OS in Virtualbox.

NAT Network

Network Address Translation (NAT) in Virtualbox allows communication between Guest Machines running within the Virtualbox network. This Network adapter doesn’t allow the virtual machines to be accessed from Host Operating System. This is the default networking option and in most cases, this would be sufficient for standalone OS with GUI.

Virtualbox can also act a DHCP server. IP address assignment to Guest OS can be controlled by having appropriate configuration in DHCP settings of Virtualbox.  To enable this option, navigate to File => Preferences => Network in Virtualbox menu. Then click the “+” button to add the DHCP settings. Refer the below image to create a NAT network with 10.0.2.X series of IPs.

Nat Network

Port Forwarding can also be enabled at this level. But let’s do it at machine level, which is explained in a sub section below.

Bridged Adapter

Bridged connection enables access from Host OS and this networking approach is mandatory to access Guest OS applications directly from Host OS or from any other machine in the network. Both NAT and Bridged Adapter can also be enabled in a Guest OS. This results in 2 different IP addresses assigned to the Guest OS by respective network adaptors. IP generated by NAT network adaptor can be accessed within Virtualbox network and IP generated by Bridged Adapter can be accessed from both networks internal and external of Virtual Box. Follow the sequence of steps marked in the below image to configure Bridge Adapter. Ensure that correct “Adapter Type” is selected based on the connection (Name). In most scenarios, the default adapter type works without any issues.

Bridge Adapter

Bridge Network won’t work in a portable Virtualbox instance. In such cases, NAT network combined with Port Forwarding is the only option available to access Guest OS applications from Host.

Port Forwarding

If NAT is the only network option available in your Virtualbox, then port forwarding is the only alternative to expose the Guest OS applications to Host OS. To configure port forwarding, enable NAT Network by navigating to Network Settings (Settings => Network) of respective Guest OS.

Expand the “Advanced” Section and click the “Port Forwarding” button and add the list of ports that needs to be forwarded to Host Operating System. Refer the below image for the sequence of steps that has to be performed to enable port forwarding.
Port Forwarding

Ensure that the ports that you have mapped in Host OS is free and available for handling the data from Guest OS. It is not necessary to have the same port number in Host OS. It can be mapped to any valid available port.
Subscribe To Our Newsletter

Leave a comment