Friday, April 19, 2019

Set up A Hyper-v virtual switch using a NAT network from power shell

This blog totally  inspire from https://www.thomasmaurer.ch/

You can find more info here.

https://www.thomasmaurer.ch/2016/05/set-up-a-hyper-v-virtual-switch-using-a-nat-network/

I am not good to understand the IP address world so just making a simple note for my self and other guys like me.

Please follow the below steps to get the internet access in your VM machine

1. Create a new Hyper-V Virtual Switch

      New-VMSwitch –SwitchName "ViaMonstraNAT" –SwitchType Internal

2.  Configure the NAT Gateway IP Address

     New-NetIPAddress –IPAddress 172.21.21.1 -PrefixLength 24 -InterfaceAlias "vEthernet (ViaMonstraNAT)"

3. Now you can configure the NAT rule

     New-NetNat –Name ViaMonstraNATNetwork –InternalIPInterfaceAddressPrefix 172.21.21.0/24

     Use IP Address in VM host namchine from 172.21.21.2-172.21.21.254.

Here is IP address configuration we apply in VM host machine

    Host Machine, running Windows 10 1703 build
    IP Address – 172.21.21.1
    Subnet Mask – 255.255.255.0

Host VM, running Windows Server 2012 R2



   IP Address – 172.21.21.2
   Subnet Mask – 255.255.255.0
   Default Gateway – 172.21.21.1
   Preferred DNS Server – 8.8.8.8



Prefer IP Address Example:




No comments:

Post a Comment