Windows Server 2019
The Internet Connection Sharing tab can be found by viewing the Ethernet Properties of a network connection. This can be used to select a Hyper-V virtual switch in order to enable a Hyper-V virtual switch of the “Internal” network style Internet access via the Hyper-V server.
But what if you’d like to have more than one lab network setup in this way? PowerShell to the rescue:
New-VMSwitch -SwitchName "lab10" -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.10.1 -PrefixLength 24 -InterfaceAlias "vEthernet (lab10)"
New-NetNAT -Name "lab10" -InternalIPInterfaceAddressPrefix 192.168.10.0/24
New-VMSwitch -SwitchName "lab20" -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.20.1 -PrefixLength 24 -InterfaceAlias "vEthernet (lab20)"
New-NetNAT -Name "lab20" -InternalIPInterfaceAddressPrefix 192.168.20.0/24
New-VMSwitch -SwitchName "lab30" -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.30.1 -PrefixLength 24 -InterfaceAlias "vEthernet (lab30)"
New-NetNAT -Name "lab30" -InternalIPInterfaceAddressPrefix 192.168.30.0/24
New-VMSwitch -SwitchName "lab40" -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.40.1 -PrefixLength 24 -InterfaceAlias "vEthernet (lab40)"
New-NetNAT -Name "lab40" -InternalIPInterfaceAddressPrefix 192.168.40.0/24