Installing and Configuring Network Address Translation (NAT) on your Host Computer to connect Virtual Machines running on an internal Hyper-V Virtual Switch

Home > Blogs > Windows Server 2012 > Installing and Configuring Network Address Translation (NAT) on your Host Computer to connect Virtual Machines running on an internal Hyper-V Virtual Switch

Installing and Configuring Network Address Translation (NAT) on your Host Computer to connect Virtual Machines running on an internal Hyper-V Virtual Switch

1 7 Rick Trader
Added by December 19, 2014

If you are running your virtual machines in an internal network and you need to provide them with internet or connectivity to your corporate network there are a couple different solutions.   One solution is to use your host computer as a router.  In this blog I will discuss how to configure your host as the solution.

If the Virtual Machines are using an Private Virtual Network check out this blog on how to configure a NAT on a virtual machine to provide the access to your corporate network and the internet.

Note:  Before configuring the Host computer to provide network connectivity there are a few networking prerequisites that have to be completed.

I have not configured any virtual networks  yet.  Figure 1 shows that I only have the host’s physical network card available in Network Connections pane.

001-connecting-Virtual-Machines-running-on-an-internal-Hyper-V

Figure 1.

Use the Hyper-V Manager to create an External and an Internal virtual network.

  1. Click on Virtual Switch Manager .
    002-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. With External highlighted click on Create Virtual Switch.
    003-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. Replace New Virtual Switch Name your desired name and press OK.
    004-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. Click Yes to the Apply Network Changes dialog box.
    005-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. Click on Virtual Switch Manager .
    006-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. With Internal highlighted click on Create Virtual Switch.
    007-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. Replace New Virtual Switch Name your desired name and press OK.
    008-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. Network Connections on the host machine will now show 3 network adapter cards.
    009-connecting-Virtual-Machines-running-on-an-internal-Hyper-V

Note that the cards names will include the names you used when you created them in Hyper-V.

Using Hyper-V Manager configure the virtual machines to connect their Network card to the newly created Internal Virtual Network.

  1. Select the appropriate Virtual Machine and Click on Settings…
    010-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
    011-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. In the Settings window select Network Adapter in the hardware pane and then select the appropriate network from the drop down Virtual switch menu in the right hand pane and click OK.
    012-connecting-Virtual-Machines-running-on-an-internal-Hyper-V

 

Configure the Virtual Machines NIC with an IP Address from the Internal virtual network.

  1. Start the Virtual Machine if Required.
  2. Logon to the Virtual Machine.
  3. Using the Properties of the network adapter set an IP Address from the Internal network. I will be using 172.16.0.10/24 with Gateway of 172.16.0.1 and a DNS server address of 8.8.8.8.

Configure the Host Computer Internal NIC with an IP Address from the Internal virtual network.

  1. Using the Properties of the network adapter identified as Internal, set an IP Address from the Internal network. I will be using 172.16.0.1/24 with no Default Gateway or DNS server addresses.

The computer’s network prerequisites have been completed.  It is now time to configure the host computer to provide connectivity to the corporate network and the internet.

Install Routing and Remote Access on the Host computer.

  1. Open Server Manager, select Add roles and features.
    013-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. On the Before you begin click Next.
  2. On the Select installation type, ensure Role-based or feature-based installation is selected, click Next.
  3. On the Select destination server, ensure the proper server is selected, click Next.
  4. On the Select server roles, select Remote access.
    014-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. On the Add Roles and Feature Wizard, click Add Features then click Next.
    015-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. On the Select features, click Next.
  2. On the Remote Access, click Next.
  3. On the Select role services, select Routing, click Next.
  4. On the Web Server Role (IIS), click Next.
  5. On the Select role services, click Next.
  6. On the Confirm installation selections, select Restart the destination server automatically if required, click Yes to prompt, click Install.

WARNING:  Server will restart after installation is complete.

016-connecting-Virtual-Machines-running-on-an-internal-Hyper-V

        13. If the server restarts, Logon. On the Installation progress, click Close.

017-connecting-Virtual-Machines-running-on-an-internal-Hyper-V

Configuring Routing and Remote Access as a Network Address Translation(NAT) server.

  1. Open Server Manager, Select the Tools drop down menu, select Routing and Remote Access.
    018-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. Right click on the server and select Configure and Enable Routing and Remote Access.
  2. On the Welcome screen, click Next.
  3. On the Configuration page, select Network address translation (NAT), click Next.
    019-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. On the NAT Internet Connection, select which Interface is your external interface (Public), click Next.
    020-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. On the Name and Address Translation Service, select I will set up name and address services later, click Next.
    021-connecting-Virtual-Machines-running-on-an-internal-Hyper-V
  1. On the Complete the Routing and Remote Access Server Setup Wizard, click Finish.
  2. If a prompt appears saying unable to open VPN Ports click OK to acknowledge.
  3. Nat is now installed.

Your Virtual Machines now have access to the internet and your corporate network.

Until next time, RIDE SAFE!

Rick Trader
Windows Server Instructor – Interface Technical Training
Phoenix, AZ

Videos You May Like

Agile Methodology in Project Management

0 154 0

In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management

Subnetting a TCP/IP Network using the Magic Box Method

0 1662 5

See our class schedule for complete Course Schedule Training. Classes are held in Phoenix, AZ and can be attended online from anywhere in the world with RemoteLive™. Instructor: Rick Trader  Video Transcription: One of the things that we might have to do in our corporate network is to take a class of IP addresses and then subnet that into … Continue reading Subnetting a TCP/IP Network using the Magic Box Method

Detailed Forensic Investigation of Malware Infections – April 21, 2015

4 608 5

How does an investigator hunt down and identify unknown malware? In this recording of our IT Security training webinar on April 21, 2015, Security expert Mike Danseglio (CISSP / CEH) performed several malware investigations on infected computers and identify symptoms, find root cause, and follow the leads to determine what’s happening. He demonstrated his preferred … Continue reading Detailed Forensic Investigation of Malware Infections – April 21, 2015

Write a Comment

See what people are saying...

  1. Avatar Db

    Thank Mr. Rick, this was very helpful to me. I’ve been watching your videos on Lynda for a little long now, I can say that you’re one of the best.

    Thank you Sir for your contribution to the science.

  2. Avatar Sascha

    also works in server 2016 with hyper v , after configuration of routing and it doesn´t works direct for the vm maschine, restart server or restart the routing services in server

    tutorial is very helpful

    explanation very good , step by step with pictures well done , thx!

  3. Avatar Torsten

    World class explanation – works like a charm!
    Thanks!

  4. Avatar JG

    You have saved my day.
    Thank you.

  5. Avatar Hafiz

    Very helpful. Thank you so much.

  6. Avatar mercury

    Genial very good.!!!
    it’s unbeliavable that Virtualbox supports NAT & NAT Netowork smoothely and MS not

  7. Avatar Tom

    Very good post, thanks!

Share your thoughts...

Please fill out the comment form below to post a reply.