Creating NAT in Hyper-V

Creating new virtual switch with command line

my host network configuration is ip address would be 192.168.0.105 subnet mask 255.255.255.0 default gateway 192.168.0.1

default dns 192.168.0.1

New-VMSwitch -SwitchName LabSwitch -SwitchType Internal

Get-NetAdapter

New-NetIpAddress -IPAddress 10.0.0.1 -PrefixLength -InterfaceIndex 21

New-NetNat -Name LabNet -InternalIPInterfaceAddressPrefix 10.0.0.0/24

now set the static ip address in vm’machines ..

ip address would be 10.0.0.12 subnet mask 255.255.255.0 default gateway 10.0.0.1

default dns 10.0.0.1

always turn of firewall before pinging on host and guest operating systems

https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/setup-nat-network

Next