Hyper-V Network Configuration

I will give an example of creating virtual switches, configuring network and NAT in Hyper-V.

Open PowerShell from the menu or by running the command in the command line (as administrator):


Let’s see a list of existing network adapters:


Let’s see the existing NAT networks:


Let’s see the existing IP addresses:


I will give examples of creating new switches with the network type “Internal”, “Private”, “External”:

New-VMSwitch -SwitchName "IXNFO_COM_Switch" -SwitchType Internal
New-VMSwitch -name PrivateSwitch -SwitchType Private
New-VMSwitch -name ExternalSwitch -NetAdapterName Ethernet -AllowManagementOS $true

Examples of adding a gateway to a new switch:

New-NetIPAddress -IPAddress -PrefixLength 24 -InterfaceIndex 38
New-NetIPAddress -IPAddress -PrefixLength 24 -InterfaceAlias "vEthernet (IXNFO_COM_Switch)"

NAT setup:

New-NetNat -Name "vNAT" -InternalIPInterfaceAddressPrefix

Example for removing NAT network and gateway:

Get-NetNat | Remove-NetNat
Remove-NetIPAddress -IPAddress -InterfaceIndex 44
Remove-NetIPAddress -IPAddress -InterfaceAlias "vEthernet (IXNFO_COM_Switch)"

Example of removing a virtual switch:

Remove-VMSwitch -SwitchName "IXNFO_COM_Switch"

You can also manage virtual switches through Hyper-V Manager > Virtual Switch Manager.

See also my articles:

Leave a comment

Leave a Reply