Guide

Create a NAT switch for a Wi-Fi host

Hyper-V cannot bridge most Wi-Fi cards to an External switch. Use an Internal switch and let the host pass its traffic out to the internet.

5 minutesOnly for hosts with no wired network card
What improves

VMs on a Wi-Fi-only host can reach the internet.

Why it matters

Hyper-V cannot bridge most Wi-Fi cards, so an External switch fails on a laptop or small PC.

How you do it

Create an Internal switch, give the host an address on it and add a NAT rule.

Every name, address and value in this guide is an example. Replace them with your own.

Create the switch and the NAT

Hyper-V host
New-VMSwitch -Name "CON-WAN" -SwitchType Internal
New-NetIPAddress -InterfaceAlias "vEthernet (CON-WAN)" -IPAddress 192.168.100.1 -PrefixLength 24
New-NetNat -Name "CON-WAN-NAT" -InternalIPInterfaceAddressPrefix 192.168.100.0/24
LineWhat it does
New-VMSwitchMakes a network the host and VMs share.
New-NetIPAddressGives the host 192.168.100.1, which becomes the gateway for that network.
New-NetNatSends traffic from that network out through the host's own connection.

Use it

There is no DHCP on this network. Give each VM on it a static address in 192.168.100.0/24 with gateway 192.168.100.1. A virtual firewall's WAN side is the usual tenant.

If VMs lose the internet after a host restart

The host can lose its address on the switch. Check, and put it back:

Hyper-V host
Get-NetIPAddress -InterfaceAlias "vEthernet (CON-WAN)" -AddressFamily IPv4
New-NetIPAddress -InterfaceAlias "vEthernet (CON-WAN)" -IPAddress 192.168.100.1 -PrefixLength 24
Get-NetNat
One NAT per host

Windows supports a single NAT network on a host. If New-NetNat fails, Get-NetNat shows the one already there.

Your progress is kept in this browser only.