NAT Virtual Network on Hyper-V
Quickly set up NAT virtual network on Hyper-V and forwarding physical port traffic into Ubuntu VM
Setup NAT Network
New-VMSwitch -SwitchName "NATSwitch" -SwitchType Internal
Get-NetAdapter
New-NetIPAddress -IPAddress 172.16.0.1 -PrefixLength 24 -InterfaceIndex 50
New-NetNat -Name NATnetwork -InternalIPInterfaceAddressPrefix 172.16.0.0/24
Configure VM Ubuntu
/etc/netplan/*.yaml
network:
ethernets:
eth0:
dhcp4: true
# keep other lines as is...
eth1:
dhcp4: false
addresses: [10.10.10.123/24] # 123=x varies among guests
sudo netplan apply
Port Fowarding
netsh interface portproxy add v4tov4 listenport=80 listenaddress=127.0.0.1 connectport=80 connectaddress=172.16.0.2