X
Tech
Why you can trust ZDNET : ZDNET independently tests and researches products to bring you our best recommendations and advice. When you buy through our links, we may earn a commission. Our process

'ZDNET Recommends': What exactly does it mean?

ZDNET's recommendations are based on many hours of testing, research, and comparison shopping. We gather data from the best available sources, including vendor and retailer listings as well as other relevant and independent reviews sites. And we pore over customer reviews to find out what matters to real people who already own and use the products and services we’re assessing.

When you click through from our site to a retailer and buy a product or service, we may earn affiliate commissions. This helps support our work, but does not affect what we cover or how, and it does not affect the price you pay. Neither ZDNET nor the author are compensated for these independent reviews. Indeed, we follow strict guidelines that ensure our editorial content is never influenced by advertisers.

ZDNET's editorial team writes on behalf of you, our reader. Our goal is to deliver the most accurate information and the most knowledgeable advice possible in order to help you make smarter buying decisions on tech gear and a wide array of products and services. Our editors thoroughly review and fact-check every article to ensure that our content meets the highest standards. If we have made an error or published misleading information, we will correct or clarify the article. If you see inaccuracies in our content, please report the mistake via this form.

Close

How to connect to a VirtualBox virtual machine from your LAN

When you deploy a virtual machine from VirtualBox, you might find it unreachable from your network. Find out how to fix that.
Written by Jack Wallen, Contributing Writer
Reviewed by Min Shin
Woman working on laptop
Carlina Teteris/Getty Images

I use VirtualBox every day to test out new applications, new operating systems, how to configure, and even how to break things. 

I also use virtual machine technology to deploy servers that I use for various things, and if I don't configure them correctly, those servers won't be reachable from my network. When that happens, those servers are of zero use to me.

To ensure that a virtual machine is reachable from your Local Area Network (LAN), you must configure it properly. 

I want to show you how to do just that, so you can stop pulling out your hair and wondering why that new WordPress deployment is nowhere to be found.

Also: What are VirtualBox guest snapshots and how do you take them?

Thankfully, the configuration is actually quite easy to take care of. Let me show you what you need to do.

How to connect a VirtualBox virtual machine from your LAN

Requirements

To make this work, you'll need a running instance of VirtualBox and an available guest virtual machine. It doesn't matter what operating system you use as either the host or the guest, as the process is the same regardless. 

That's it. Let's configure networking.

It's all about the bridge

When you create (or configure) a virtual machine on VirtualBox, there's a Network section that includes tabs for each available network adapter. In most virtual machines, there'll only be one adapter, called Adapter 1. In that tab, you'll see a drop-down labeled Attached to. By default, that drop-down is set to NAT.

NAT stands for Network Address Translation and is the process of mapping an IP address to another by changing the header of IP packets while in transit via a router. If you use NAT as your network adapter for the virtual machine, you'll notice (when you boot the virtual machine) that the network on the guest is different than that of the host OS. For example, say your host machine has a network address of 192.168.1.62. If you leave your virtual machine set to NAT, it's likely the address for the guest will be something like 10.0.2.15. 

Also: How to create a Linux virtual machine with VirtualBox

Theoretically speaking, if set up properly, you could reach 10.0.2.15 from 192.168.1.62, but most often, that is not the case, and you won't be able to reach the 10.0.2.15 address from 192.168.1.62. However, you can reach 192.168.1.62 from 10.0.2.15. That's great if you only need to get out to the internet from the guest. But if your guest is a server and you need to be able to reach it from the LAN, you must change NAT to Bridge. Here's how.

1. Open VirtualBox

The first thing to do is open the VirtualBox application. If your guest OS is running, you'll need to shut it down. You can either shut it down completely or save the current running state.

2. Select your guest and open Settings

Select the guest operating system in the left sidebar and then click Settings in the top toolbar.

The VirtualBox main window.

Accessing the Settings window for a VirtualBox VM.

Image: Jack Wallen

3. Change NAT to Bridged Adapter

In the Attached to drop-down, select Bridged Adapter, which makes the guest operating system accessible from the LAN. Click OK and then start the guest. When the guest comes up this time, you should be able to now access it from the LAN. 

You'll need to locate the IP address for the virtual machine, which will vary depending on what operating system you're using. For example, if the guest is Linux, you can view the IP address with the command ip a

Also: How to change your IP address with a VPN (and why you should)

With that address in hand, you can access it because it now shares the same address scheme as the other machines on your LAN.

The VirtualBox Virtual Machine Settings window open to Networking.

Changing NAT to Bridged in the VirtualBox Settings window.

Image: Jack Wallen

And that's all there is to ensuring that your VirtualBox virtual machines are accessible from your LAN. Every time I set up a new virtual machine with VirtualBox, I make sure to change this setting so my VMs are always available to my network.

Editorial standards