How To Configure Windows Server And Guest Machines With Internal Connection And The Internet Access

Tech

Do you use VirtualBox and want to know how to set up virtual machines to communicate with one another while allowing them to connect to the Internet? Then you should read this blog. I’m setting up NAT and Host-only adapters on each virtual machine as a workaround so that we can establish connections.

Sponsored links

Environment

Only two virtual machines of Windows Server and the guest machine are installed below for the sake of simplicity. With several virtual computers, though, you can use the exact same parameters to establish connections.

  1. Windows Server 2019 (DC-1)
  2. Windows 10 (Win10-1)

What you need in short

  1. Host-only adapter on all the virtual machines
  2. NAT adapter on all the virtual machines
  3. Static IPv4 configuration on Host-only adapter (Ethernet 2)
  4. Disable firewall on Host-only adapter (Ethernet 2)

How to configure

  • Step1
    Power off the virtual machines

    It is necessary to turn off the virtual machine’s adapters before configuring their settings.

    Click to View
  • Step2
    Create a Host-only network adapter
    1. Go to File, and click “Host Network Manager
    2. Click “Create
    Click to View
    Click to View
  • Step3
    Set an IPv4 address for Host-only adapter (internal network)

    Choose “Properties” from the menu. Enter your preferred IPv4 address for the internal network (it will be used for the host-only adapter later). Choose an IP that isn’t in use right now. Choose an IP that is currently not in use. Click “Apply”.

    If you choose, you can configure the address automatically, but manually configuring it will give you more control over your network. In addition, I did not check the option for enabling the DHCP Server since I will later set it up manually but it is up to you.

    Click to View

    Please keep this address range in mind because we’ll need it later when setting up static IPv4 on virtual machines.

  • Step4
    Enable two adapters on VMs (NAT & Host-only)

    Choose the virtual machine that needs setting up. Either choose “Settings” from the menu when you right-click the virtual machine or click the gear icon as displayed.

    Click to View

    Select “Network,” then add two adapters below. You must do this for each virtual machine you are configuring.

    1. Click [Adapter 1] and enable “NAT”. This is for the Internet connection.
    2. Click [Adapter 2] and enable “Host-only Adapter”. This is for the internal network.
    Click to View
  • Step5
    Power on the virtual machines

    Once you configure the adapters on all the virtual machines, power them on.

  • Step6
    Set a static IP address for Host-only Network (Ethernet 2)

    Go to Network Connections and select Ethernet 2 (Host-only adapter) to configure IPv4 (you can uncheck Ipv6). Assign a static IPv4 from the address range you set in Step4 (.2 to .254, and .1 is used as a default gateway address). We will only be configuring the IPv4 for the Ethernet 2 (Host-only adapter) and the NAT property will not be configured. Please configure static IPv4 from the address range on all the virtual machines making sure they all have the same default gateway address.

    Click to View
    Click to View
  • Step7
    Disable firewall on Host-only adapter (Ethernet 2)

    Go to Firewall setting:

    1. Click “Windows Defender Firewall Properties
    2. Go to “Customize
    3. Uncheck Ethernet 2 to disable the firewall on the Host-only adapter on all the profile – [Domain] [Private] [Public]
    4. Do the same for all the virtual machines you are interconnecting.
    Click to View

  • Step8
    Run a ping test to verify the connections

    In the example below, I’m pinging a Windows 10 (192.168.10.3) system from a Windows Server computer. The first ping demonstrates that ping will fail if Step 7 of deactivating the firewall on the Host-only adapter is not configured.

    1st Ping: [Firewall enabled] ping failed
    2nd Ping: [Firewall disabled] ping successful
    3rd Ping: Verified successful access to the Internet (google.com)

    Click to View

    I have also tested ping from Windows 10 to Windows Server and it was successful.

Check the following again if your ping is unsuccessful and you are unable to connect to either the internal network or the Internet:

  • Did you configure IPv4 using the same default gateway and address range for the host-only adapter that you set in Step 3?
    • Check Step6 for IP configuration
  • Did you turn off the firewall on the Ethernet 2 host-only adapter?
    • Check Step7 for firewall settings

Summary

For all virtual machines to communicate with one another while connected to the Internet via NAT, it is necessary to enable two adapters (NAT and Host-only adapter), configure static IP addresses for the host-only network, and then turn off the firewall on the host-only network.

Comments

Copied title and URL