Oracle VirtualBox – Configure Guest-VM network to communicate with Host network

This is going to focus on configuring an Oracle Virtualbox VM to do a few things:
-make it so the host, and local host network can see, ping, remote and use fileshares to the Oracle Box guest VM
-Enable the Oracle box VM to still use it’s own built in DHCP (in case you have your own domain)

*I take no liabilities in configuring any of this, I had to figure this all out with trial and error!

The Setup

Host: Ubuntu 18.04 “Bionic Beaver” release
Software: Oracle VirtualBox (version 5.2.42-dfsg-0-ubuntu 1.18.04.1)
VM: Microsoft Server 2016 Domain Controller

For the purpose of this entry, I’m skipping over the creation of a VM, domain configuration and DHCP. All that’s configured within the Guest-VM Operating System. I won’t go into that, but what I will provide is a problem, and solution.

Problem
How can we get a already existing VM running MS domain services, to use it’s already pre-configured DHCP Scope, and yet allow it to talk with the rest of the host network?

Solution (short explanation):
Create a second network adapter in ‘bridged mode’, keep the primary network adapter in ‘NAT’ mode. Configure firewall rules on the Guest-OS to allow access.

Solution (long, and drawn out):
To preface this problem, I had a pre-existing domain controller with it’s own DHCP server. DHCP itself was handing out a 10.0.150.1/24 series of IP’s.

My VM Host however is on my home network, we’ll say that’s a 10.0.0.1/24 network. So how do we configure our VM to have access to our home resources?

First, turn off your VM.

1.Create a second Network adapter! From VirtualBox Manager goto Settings…

Orade VM Virtu•IBox M •na%r 
New Settings 
DC01 
Running 
Show 
>ettings...<br />
Clone.<br />
denove„<br />
Show<br />
Eause<br />
Machine Tools<br />
Global Tools<br />
Ctrl•S<br />
ctrl-o<br />
lists all virtual machines and virtual<br />
mputer.<br />
represents a set Of tools Which<br />
n be opened) for the currently<br />
Of currently available tools check the<br />
right side Of the main tool bar<br />
indow. This list Will be extended With

2.Goto Network.

For this VM, I put in a NAT network. There’s dozens of different ways to do this, but for this example, I created a NAT with a specific scope to isolate my domain for testing purposes. Here’s the Oracle VirtualBox documentation.

DOI settings 
Network 
Adapter 1 Adapter 2 
@ gnable Network 
(2 
General 
System 
Dtsplay 
Storage 
Audio 
Network 
Serial Ports 
Shared Folders 
user Interface 
Attached to: 
Name: 
v Advanced 
Promiscuous Mode: 
MAC Address: 
NAT Network 
VNATOI 100150.0/24 
Deny 
@ Cable Connected 
Port rorwaldirg

3.Create a New Network Adapter. Configure as ‘Bridged Adapter‘. In layman’s terms, a Bridged Adapter just means it’s using the physical connection from your host, and the VM is filtering data from the host.

General 
System 
Dtsplay 
Storage 
Audio 
Netvvork 
Serial Ports 
(2 
Shared Folders 
user Interface 
DOI settings 
Network 
Adapter 1 Adapter 
@ gnable Network 
Attached to: 
Name: 
v Advanced 
Promiscuous Mode: 
Address. 
Bridged Adapter 
enp0s25 
MT Oes«oø 
Deny 
@ Cable Connected 
Port rorwaldirg

4.From the Guest-VM, configure the networking to the same as the Host. You will need a static address from your DHCP – likely your home router or otherwise.

Internet Protocol Version 4 (TCP/IPv4) Properties 
Guest VM properties 
You can get [P settngs assigned automatcally if pur neb,Nork supguyrts 
this capability. Otherwise, you need to ask your neb,Nork administrator 
for the appropriate [P settngs. 
C) Obtain an [P address automabcally Example IP config 
• use the following [P address: 
[P addr ass: 
Subnet mask: 
Default gateway: 
101 
255 
255 
255 
Obtain DNS server address automatcally 
• use the following DNS server addresses: 
Preferred DNS server: 
Alternate DNS server: 
[3 Validate settings upon exit

5.Configure the Guest-VM firewall rules to allow traffic from that specific subnet.

  • Goto Firewall settings (depending on your flavor of VM, this is a Windows VM so your mileage may differ), advanced settings -> Inbound rules.
  • Scope (local IP addresses): the IP of your Guest-VM
  • Scope (remote IP addresses): the IP, or range of your management workstations on your Host subnet

allow all 10.0.0.1/24 traffic Properties 
Programs and Services 
Remote Computers 
Protocols and Ports Scope Advanced local Principals Remote users 
Local IP address 
C) Any IP address 
VM-Guest Sample Rules 
@ These I P addresses 
1000101 
Ram ove 
Remote IP address 
@ Any IP address 
O These IP addresses

  • Protocols and Ports: I set mine to ANY. It’s up to you what you want to expose from your Guest-VM to your Host.

allow all 10.0.0.1/24 traffic Properties 
Programs and Services 
Remote Computers 
Protocols and Ports Scope Advanced local Principals Remote 
Protocols and ports 
Protocol type 
Protocol number 
local port 
Remote port 
VM-Guest Sample Rules 
Example 80. 443. 
Example 80. 443. 5000-5010 
Intemet Control Message Protocol 
(ICM P) settings 
Customize ..

Programs and Services: ALL. Again, it’s up to you what you want to expose.

allow all 10.0.0.1/24 traffic Properties 
Protocols and Ports Scope Advanced local Principals Remote Ll sem 
Programs and Services 
Remote Computers 
Guest-VM Sample Rules 
@ All meet the specified conditions 
C) This program 
Application P ackages 
Specify tha application packages to which 
this rule applies 
Specify the services to which this rule 
applies

6.Now Test the configuration from your Host or a management computer on the same Host subnet:

test-netconnection -ComputerName 10.0.0.101 -Port 3389 -InformationLevel Detailed

 

(you can use ping test too, but I like to see the specific port)

ComputerName 
. 10.0.0.101 
RemoteAddress 
. 10.0.0.101 
Remoteport 
. 3389 
. 10.0.0.101 
Matchi I es 
Networklsol ationcontext : 
Internet 
IsAdmi n 
False 
InterfaceAI as 
Sour ceAddress 
. 10.0.0.36 
NetRoute (NextHop) 
. o.o.o.o 
TcpTestSucceeded 
. True

Success! Connection to the RDP port 3389 works!

Now you can remote desktop to your VirtualBox Guest-VM from within your network. Also means you can continue deploying VM’s to that Virtual Domain Controller’s DHCP. Hope this helps the next person.

[ivory-search 404 "The search form 3350 does not exist"]