Forum Discussion
Hyper-V Default switch IP address range change. Ver 1809 Build 17763.1
I totally understand your situation, sometimes you have to switch between WiFi and Ethernet because it's a laptop, portable and so on.
you can still create persistent routes in the Window's routing table and make the default virtual network adapter's IP address stick even after reboots.
Btw, you Don't have to change anything in the Guest OS if you change your active network adapter from WiFi to Ethernet. all you need to do is to go to Hyper-V's virtual switch manager, go to the external adapter and change the external network from the drop down list. the guest OS shouldn't need any further changes if it has already given a static IP address from the same subnet.
I figured out how to create a new NAT internal switch with a static IP. It can be done via Powershell: https://www.petri.com/using-nat-virtual-switch-hyper-v
These are the commands I used to re-create the 192.168.5.X NAT network like I had in VMware Workstation:
New-VMSwitch -SwitchName “NATSwitch” -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.5.1 -PrefixLength 24 -InterfaceAlias “vEthernet (NATSwitch)”
New-NetNAT -Name “NATNetwork” -InternalIPInterfaceAddressPrefix 192.168.5.0/24
I knew there must be a way since my scenario is very common in software development. There's just no way to do it in the Hyper-V Switch Manager GUI.
I have no use for the Default Switch now, but it doesn't appear to be remove-able...at least not without some registry hacking.