Monday, 24 August 2015

Setting up a NAT network on VirtualBox

VirtualBox is available as a free download from Oracle.

It can be set up in various ways.  New in the latest version is something called "NAT network" - essentially allowing you to run several virtual machines that share a virtual network, and NAT through the host machine's network card.

Set-up comprises:
1. Create virtual machines
2. Create virtual network - this affectively sets up the router (which was the bit I didn't realise)
3. Add the virtual machines to the network

Create the virtual network by going to File - Preferences - Network - NAT networks
Add a new one, call it whatever you like, then go into the settings for it and set the network CIDR - by default this is a class A network with a single subnet.  If you're going to run a DC on this network with DHCP, untick the "Supports DHCP" option on the NAT network.  Essentially, this page is setting up the (virtual) gateway router that sits between the guest VMs (either client or server) and the host (which, to the VMs, is equivalent to the internet).  Port forwarding is not required for standard applications.

Having set up the NAT network, all the VMs have to be configured to use it - this is the virtual equivalent of plugging the cable in.  Right-click on a VM and choose "Settings", then Network.  Click the "Attached to:" drop down and choose "NAT Network".  If there is only one NAT network configured, it will be chosen by default.  Repeat for all VMs on the same network.

All that remains is to fire up the server VM and set up a static IP address in the same range, and a DHCP scope.  Any client VMs can be set up to use DHCP.

No comments:

Post a Comment