Hyper-V Default switch IP address range change. Ver 1809 Build 17763.1

Brass Contributor

Can one confirm IP address range changed to 192.168.X.Y Subnet 255.255.255.240 from 172.X.X.X

 

Also changes the subnet randomly on every Hyper-V services startup. 192.168.X.Y . X can change from 51 thru 180.

 

Although this is working on DHCP based IP assignment on guests, It is causing issues on static IP as it keeps changing after every boot

 

Regards,

Bala

135 Replies

@HotCakeX

"set the default network location for all known and uknown networks in Group Policy to private, no problem"

 

What happened with your previous statement "It's for easy networking and quick VM creation"? Editing group policies is not quick and easy.

 

"computers on a network using DHCP do NOT change their network locations when the DHCP server gives them a different IP address."

 

They do when the new IP address is in a different subnet.

 

And stop assuming that your way of working with Hyper-V is the only truth.

You don't wanna use other types of adapters so I said alright, if you want, here is the way.

if you use the group policy to change the network location for all known and unknown networks, meaning any future networks that appear will have the private location.

 

if you simply looked at my previous comments in the thread, you would know that it's not my way of thinking but many other people's. those links I mentioned are barely even 1%, there are lots of other proofs I can mention.

Also there is another way,
none of these is for people looking for easy networking but if you insist on using something that is made by default for people with little to no networking experience, then here it goes:

write a script, save it as a .bat file and the script should take the network adapter name and set it as private, use the Windows task scheduler to make it run at every startup.
I already have workarounds for that, np. The question was that the default switch for some reason is hardly usable in any scenario. It's not deletable, not configurable, not documented and changes it's own IP (as well as VM IP) address randomly. You can't use it outside of the very simple case - to have some simple internet inside VM for one session. In most scenarious it's just not enough no matter how skilled you are. Also it breaks other functionality like firewalls, access list, shared folders, streaming, NAT and all services inside VM which wants static address. And it means that any configuration is not reproducible and can't persist after a reboot. Every reboot you have to reconfigure VM services over and over. It's not the way software works in human world, it's just quirky MS implementation. And you have to pay for that's sad. I quit because it's not a discussion but more religious talk I guess.
DIXI
Default switch is not to be used for advanced VMs where static IP address is required.

default switch was introduced only recently. what do you think people used to do All those Years then? default switch was added for one purpose and I mentioned what it is.

@HotCakeX 

 

What will you say to yourself if MS fix this bug in future version ?

I don't think it's a bug in the first place

@HotCakeX 

 

Thank you for replying; I appreciate it.

 

I am using Windows 10 Version 1903, build 18362.329.

 

I'm in no way married to the Default Switch and am perfectly content to create another switch for my purposes. I simply need to meet the conditions described in my previous post.

 

The second configuration you suggest looks to be exactly what I want, and in fact, it's exactly what's described in the following blog post that @mlmathews cited earlier in the thread:

 

https://www.petri.com/using-nat-virtual-switch-hyper-v

 

 

This configuration does in fact function exactly the way I'd like, so I'm happy!

 

That said, I concur with @mlmathews that the Default Switch poses an annoyance now, for one specific reason: when I provision a virtual machine with Vagrant, I'm prompted which switch to use, because I now have more than one, whereas when only one switch exists, Vagrant chooses the only switch automatically and without prompting.

 

I've tried disabling the Default Switch in the Device Manager (which, of course, also causes it to be disabled in Control Panel\Network and Internet\Network Connections), but Vagrant still sees it as long as it's available in Hyper-V's Virtual Switch Manager.

 

In any case, I can live with this minor annoyance, as well as the fact that the Virtual Switch, despite it's un-intuitive behavior, may be working exactly as Microsoft intends. Whether or not that behavior is ill-conceived, short-sighted, and completely out of lockstep with that seen in competing products is another discussion in which I have far less interest than "just getting it working". ;)

 

And if the information offered in https://mikefrobbins.com/2018/11/08/managing-the-hyper-v-default-switch-in-windows-10-version-1709-a... has not changed substantially since its publication, removing the Default Switch sounds to be more trouble than it's worth.

 

Thanks again for all the help, everyone!

Thank you very much, appreciate the kind words,
It's good to know that it's working out for you, unfortunately I don't much experience with Vagrant myself but I think this is a great feedback that you provided about Hyper-V and Vagrant incompatibility over the default switch, I think Microsoft can fix this with Vagrant just like they cooperate with VMWare to make compatible features, I would definitely up vote it if you post it in the uservoice or Feedback Hub.

Thanks again, have a good one!

I realize that many of us have differing use-cases; some of us are software developers using Vagrant who want internal IP addresses, some of us are systems admins using Windows Server who want external IP addresses, and some of us are adamant about using the Default Switch whereas some of us don't care what switch we use as long as its IP address doesn't change.

 

For those who share my specific use-case (i.e., using Vagrant and impartial to the Default Switch), I wrote a comprehensive How-To, which you may find helpful:

 

https://superuser.com/a/1379582/176764

 

Hopefully, Vagrant and Microsoft can work together to eliminate all the hoop-jumping!

I'm wondering, The default switch has only been with us for 2 years now, it's fairly new, so what were the Vagrant users using before Default switch was even introduced?
Hyper-V itself is not new and people have been using it for Years, when it didn't have Default switch, but suddenly 2 years ago Microsoft introduced it for users with no networking experience and then all the professionals decides to use it too.

so yeah I'm wondering why not do the same thing that they were before Default switch was even in Hyper-V.
In my case, the only reason I'm trying to use Hyper-V now is that it's required if you want to user Windows containers / Docker Desktop on Windows 10. I'd much prefer to still be using VMware Workstation, but unfortunately VMware and Hyper-V can't co-exist (yet). So I've bitten bullet and moved to Hyper-V. I'm honestly really surprised how far behind Hyper-V is in capabilities and flexibility compared to VMware Workstation given how long Hyper-V has been around.
Could you name some of those missing capabilities that you're talking about?
for me the Only capabilities that Hyper-V is missing is tabbed VM session viewing, when working with multiple VMs at the same time. but that's the nature of it because of RDP and there are programs that have tabbed RDP session feature.

@HotCakeX 

 

I don't have time to list everything I've noticed, but I'll give you a couple of networking examples.

 

In VMware both the NAT and host-only networks have a virtual DHCP server that's configurable.

 

Another example is in VMware a bridged virtual adapter can be set to automatically select a physical adapter to bridge...so if you are developing on a laptop it will automatically switch between wifi and ethernet.

 

 

@Bala Sundaram put the following in a PowerShell script and add to task scheduler, then run at logon. Change the #staticIP to desired IP.

 

An alternative is to put the script in local group policy using a .bat file to kick it off. 

"powershell.exe -ExecutionPolicy Bypass -File "script.ps1""

 

 

#Sets a static IP on the HyperV default switch (Windows 10).
Set-ExecutionPolicy Bypass -Scope Process -Force

#wait for network to come up
while (-Not (Test-Connection -ComputerName 1.0.0.1 -Quiet))
{}

$staticIP = "172.18.79.1"
$hyperVnet = Get-NetIPAddress -InterfaceAlias "vEthernet (Default Switch)" | select InterfaceAlias,InterfaceIndex,AddressFamily,IPAddress,PrefixLength | where {$_.AddressFamily -match "IPv4"}

#Remove old IP address, otherwise there will be two IP addresses
Remove-NetIPAddress -IPAddress $hyperVnet.IPAddress -Confirm:$false

New-NetIPAddress -InterfaceIndex $hyperVnet.InterfaceIndex -IPAddress $staticIP -PrefixLength $hyperVnet.PrefixLength

 

 

 

@mlmathews The problem is not being able to destroy the old switch. How did you manage that?

@GlaucomaPredator  I have not found a way to permanently delete the Default Switch. I've been just ignoring it for now.

Guy, kudos for dragging this conversation for so long... And I see each has their own set of arguments.

 

But what @HotCakeX keeps forgetting is to tell the whole truth about his setup, and whole truth (and main issues) with DefaultSwitch.

 

Yes, DefaultSwitch is all fine for my granny to put a VM on her Win10 and put it online. But what is not ok is:

- that DefaultSwitch permanently grabs one ethernet connection for it's own purposes

- this connection may well be only one, for example, on workstation PC which isn't on WiFi, and doesn't have 2 LAN adapters

- cannot be removed

- prevents you from setting up second virtual switch / adapter on same interface as it is already binded to DefaultSwitch

- no workaround as DefaultSwitch keeps recreating itself on each reboot (so if you remove it, it will be there next reboot, if you disable it, it will be re-enabled, etc)

 

All is good, I have several clusters I can use to put VMs on them, with all dedicated connections, and all. But sometimes I just want/need to use a small VM on my PC, and I want it to KEEP the IP addresses same through reboots. There is simply NO REASON for it to be recreated every time, my local networks don't change, if 172.18.123.15 isn't conflicting on one reboot, it's not gonna conflict on next reboot. Yet - Win10 will still recreate it if I reboot, and with new IP range. There is also NO REASON for DefaultSwitch to be unremovable. We had Hyper-V before Default Switch, and on client PCs, and it worked just fine. Sure, make DefaultSwitch default config, my grandma really likes showing CentOS on her VMs from time to time, but give the option for REAL USERS (aka developers, sysadmins, etc) to remove/disable the DefaultSwitch garbage and use Hyper-V same way we've used it for years on our PCs. Instead, we have to keep Googling and hoping something will change with time. Or just endure the bad state of things, and use "real servers" just so we can have a small VM for whatever purposes we need it.

 

Btw, those that want to evaluate software sometimes want to make a small proof of concept on their workstation, without it requiring 2 more teams to allow you to a) put these VMs on their clusters b) create temporary networks for you to test something for a week or two.

 

Let me go back to the main thing that hurts a lot of people... @HotCakeX you said you have your whole setup with home router and cheap 20$ WiFi adapter... yet you are forgetting to tell people that you also have second built-in adapter that you have in same PC/laptop. One that DefaultSwitch grabbed and "polluted" forever, and then you are using a 20$ adapter as your external adapter. That's paying 20$ for Microsoft's decision to make DefaultSwitch UNREMOVABLE.

 

Anyway, thanks for again confirming that MS still didn't fix this properly (and will probably stay broken as is), I'll revisit this in a year or so again, just to check if I can finally get back to the functionality I had with Windows 7, without buying new adapters, setting up new test WiFi environments, laying down new cables or buying new switches, just so my workstation could have a VM with ... predictable IP.

Don't worry, I didn't forget anything.

I have 1 active network adapter and I connect that 1 network adapter to an external virtual network adapter and use it on my VM. no other adapter has connection. default switch never shows any error or prevent from creating an external network adapter and connect it to your only physical network adapter that has Internet.

if you don't want your IP to be reset every time, use the External virtual network adapter.