Tech Community Live: Windows edition
Jun 05 2024, 07:30 AM - 11:30 AM (PDT)
Microsoft Tech Community

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

This has been the case for quite some time - and is not isolated to 17763, and stretches to 10240.

(Though earlier issues weren't this exact problem)

 

The "Hyper-V Virtual Ethernet Adapter" that appears in device manager that appears as "vEthernet (Default Switch)" in Network and Sharing Centre is being deleted and reinstalled each time you shutdown and boot.

 

You can also check the registry to see the abundant keys that are created and never removed and just linger in HKLM\System\CurrentControl\Services\

 

If you're suffering from this issue - you should see a ton of {GUID} just under .NETFramework, and  a whole bunch more in the VM services section... vmsmp, vmsp, vmsfsf, etc.

VMSMP\parameters\SwitchList contains the current 'Default Switch'

 

Those GUID under the .NETFramework Key, when expanded will have Tcpip keys for previous switches...

Hyper-Fail.PNG.jpg

I confirmed that the pair of rules of reception of "DNS Server Forward Rule TCP - XXXXXXXXXXXXXXXX - 0" and "DNS Server Forward Rule UDP - XXXXXXXXXXXXXXXX - 0" increases forever with the influence that the Default Switch is recreated. The "XXXXXXXXXXXXXXXX" is GUID of port of Default Switch that was recreated. If we do not delete wasted rules, will one day overflow?

Do you have any idea how to get this ip fixed ? Maybe we can run powershell script to change it after reboot ?

 

---------------------

Just tried to update IP on reboot with powershell script, it's ok to keep same IP , but the network doesn't

work for VMs.This is not way.

@Remon li 

 

Not at the moment - because there may be changes upcoming to Hyper-V for 1903 - so anything we do now will be made redundant for the next upgrade.... which is very similar to what has been happening since 1511.

 

The Virtual Machine connected to the Default Switch will also be connecting to 'New' networks for the first time, each time both the Host and Virtual machine boots... changing to a static IP only solves the problem temporarily - as changes to the default switch IP will result in the VM losing connectivity.

The work around I had where I created a new 'custom default switch' and keeping the original default switch along side it worked best, as I just told all the Virtual Machines to ignore the original default switch and just use the custom switch that I configured.

The only thing that breaks this is major build upgrades - example: 1511 - 1607 - 1703 - 1803

As well as anything relating to having to reset your network configuration using the Settings UI aka ImmersiveShell.

 

@Remon li 

 

I haven't actually played around with all of my VM's yet. However - 1903 has fixed one of the Hyper-V Default Switch problems:

 

The Default Switch would always be set as a public network - this can be disruptive to other connected networks - as I don't trust that the MS Engineers did a good job with how Domain/Private/Public interact.

 

With 1903  - the Default Switch is not assigned a Network Category. Which is how it should have been to begin with.

 

It is always going to be a private network - as VM's can only use it to interact with other VM's on the Host and to the Host itself.. an Internal Network. Like I said... I don't trust the engineers to have done the network categories correctly, until now. Took 4 years.

Anyhow, I'm in the middle of updating the VM's on my laptop to 1903 and see what I can do in the Guest Machine.

 

Finally-Internal.jpg

@かずお 山内 

@Bala Sundaram 

@Remon li 

 

pseudoInternal-Bridge.PNG

 

Host (Right Screen):  vEthernet (Main Internal) - 10.0.0.1

Guest (Left Screen)- Static IP. Gateway is Host's Main Internal Switch IP.

IP: 10.0.0.2

Subnet: 255.255.255.0

Gateway: 10.0.0.1

 

If you need Internet connectivity on the Guest - you need to bridge your Host Machine's Main Internal Switch to an Internet Connection... Highlight Both, Right Click and Bridge. Easiest way to do it.

 

(Main Internal) Static IP addresses persist through Reboot and Shutdown.

Guest Machines connecting to (Main Internal) will need a Static IP set and these also persist thought Reboot and Shutdown. You will need to host a DHCP server if you don't want to use static.

 

Nested VM ... you can go 3 deep with Hyper-V.

The Hyper-V Server that will host DHCP will need to spoof Mac-Address. If you don't you'll end up with the same set of IP addresses each time.

 

Here's better screenshot... NB-TECH and NB-G751JY will always connect to each other after reboot, and vEthernet (Default Switch) is never used.

Guest-Internal.jpg

 

Host-Internal.jpg

This thread is about the default switch, not a new switch you create with a fixed IP address.

@Bala Sundaram Dont want to be that guy, but...172.x.x.x is a class B (16 bit) 

Class C address is the one I believe your referring too as in 192.168.x.x

 

Basically -

Class A goes from  0 upto 127 - ex. 10.10.10.1

Class B goes from 128 upto 191  (hence the 172.16.x.x as i too have that anomaly in my vEthernet

Class C goes from 192 upto 223 - common ex. 192.168.1.1

then you get Class D and also but these are reserved special purposes.  Class D for multicast and E for experimental.

Class D goes from 224 upto 239

Class E goes from 240 upto 255

 If you knew this then ignore this reply.

I hope you sorted out the issue. I dont see any resolution at the end of this thread. Let me know if you did.

All the best.

Danny

 

So, is there a solution to this? I really would like my Default Switch to have a static IP configuration.

I've been working a lot with Hyper-V and I gotta tell you that the default switch is NOT meant for static IP addressing. in any tutorial or YouTube video you watch you'll see than none of them choose the default switch for static IP addressing.
if you want static IP and never changes, you should make a new virtual network adapter and make it EXTERNAL, then connect it to your PHYSICAL network adapter (all done in Hyper-V switch manager), it will make a bridged connection in your host Windows. then inside your guest OS (VM) you can give a static IP to your OS and it will stay that way and never changes.

IMO default switch is for those who want a quick setup and get a VM up and running fast without any additional settings.

@HotCakeX wrote:
if you want static IP and never changes, you should make a new virtual network adapter and make it EXTERNAL, then connect it to your PHYSICAL network adapter (all done in Hyper-V switch manager), it will make a bridged connection in your host Windows. 

While others in this thread have provided this information it was the concise nature of your post that provided the eureka moment for me.

Thank you.

 


@HotCakeX wrote:
I've been working a lot with Hyper-V and I gotta tell you that the default switch is NOT meant for static IP addressing. in any tutorial or YouTube video you watch you'll see than none of them choose the default switch for static IP addressing.
if you want static IP and never changes, you should make a new virtual network adapter and make it EXTERNAL, then connect it to your PHYSICAL network adapter (all done in Hyper-V switch manager), it will make a bridged connection in your host Windows. then inside your guest OS (VM) you can give a static IP to your OS and it will stay that way and never changes.

IMO default switch is for those who want a quick setup and get a VM up and running fast without any additional settings.


I've been working a lot with Hyper-V, too. The default network adapter is not meant to change IP address ranges with every reboot. Once an IP address is set, it should be immutable. Throwing around with workaround does not remove the issue at hand.

 

Your described way to get a static IP is fine. However, this doesn't work when I have to test something that involves DHCP. Sure, I can install a NAT with 2 vNICs, one on one external switch and the other on a private switch, but that involves additional hours to setup correctly.

 

With the built-in network address translation of the Default Switch, this problem is already solved. And for testing purposes it would be perfectly fine, were it not for the non-intended behaviour that the address range randomly changes between reboots of the host computer.

Sorry but I wasn't replying to you, i was replying to the OP, your problem might be different and i didn't consider your setup.
anyhow, I don't see how any of the things you mentioned can possibly take "hours" to setup. if you know the topology you're going to deploy beforehand then it can only takes few minutes to setup. btw you don't have to set anything in the host network adapters (virtual or not), everything happens in the guests.
if you want to set something that involves DHCP? like a Windows server DHCP? you still need external network adapter with static IP set inside the guest OS, as I said in my previous comment.
Setting up the virtual switches takes a few minutes.

I don't have a test environment handy at all times. I certainly don't have one now. So I need to get a software firewall, download the iso, create a new VM, install the firewall and configure it. This takes a bit longer than a few minutes. But that is absolutely beside the point.

The point is, the Default Switch is broken.

> if you want to set something that involves DHCP? like a Windows server DHCP? you still need external network adapter with static IP set inside the guest OS, as I said in my previous comment.

An external network adapter inside the guest OS? Either that configuration or that terminology doesn't make any sense.

@Daniel Niccoli 

look for example in your guest OS/firewall etc you need to set up these few main parameters.

InkedAnnotation 2019-08-07 205656_LI.jpg

 

whether you do it using GUI or powershell, terminal etc it's not gonna take so long..

 

also is there any indication saying that the default switch in Hyper-V must give you an static IP address regardless of host reboot?  

 

I meant making an external network adapter and connecting it to the guest OS.

that config would make sense in a nested virtualization.

@Daniel Niccoli

 

Hi.

 

I'm totally new to Hyper-V but not quite new to networking and virtualization and this random selection of private subnets really baffles me. This looks more like a fallback function and no the main one. I can understand the following reasoning: If the Hyper-V user doesn't enter a proper subnet or the subnet they entered is invalid, generate a random one (things have to work one way or another, right?) The problem is that the main function doesn't seem to exist so we get this random mess.

 

As I said, I have worked a bit in networking so I looked for a simple way to know exactly which IP addresses were used after the host operating system reboots. What I do is open a Command Line Prompt (doesn't need to be Admin) and type: arp -a. (no dot at the end) I look for the interface that I know isn't mine as in the IP address wasn't configured by me. Once I get that, the pattern is as follows:

 

The interface IP address is the address of the Host (duh!) which is the gateway IP address for the VMs. In the Physical Address column the ff-ff-ff-ff-ff-ff MAC address corresponds to the broadcast IP address for the subnet the VMs use. The rest of the IP addresses in this subnet belong to the VMs. Like so:

 

Interface: 172.18.61.97 --- 0x1c
Internet Address Physical Address Type
172.18.61.108 00-15-5d-0a-0d-00 static
172.18.61.111 ff-ff-ff-ff-ff-ff static

 

I have one VM which apparently got the 172.18.61.108 IP address this time around. Maybe there's a way to automate such "inventory check" with a script or something else.

 

I hope some will find the above tip useful. :)

 

Cheers.

I'm a Linux guy but have to use Windows10 now. Don't want to use VirtualBox or Vagrant as I have HyperV licensed. But I can't make it work sadly. Also additional hypervisor breaks a lot of things in windows10 which requires additional time to make workarounds.  

Default vSwitch keeps changing IP address on reboot. There is no DHCP server included so no way to assign a static address to my VM.

Workarounds are not helpful too. 

- tried adding new virtual switch and NAT it via PowerShell. It works until reboot only. There is no GUI for that? ok. 
- ICS is not working after reboot too, I have to manually reenable it.  Adding registry key is not working.

- tried to add external linux vm to route all the traffic, still need ICS which is not working after reboot. 

- tried third-party software, it's okay but requires additional payments.

All that bugs persists through ages, seriously? Very disappointed, want my money back.  

You can use the External vSwitch on Hyper-V VM instead of the default switch.
then inside your VM OS (guest), set a static IP address.
how? well your VM guest will get an IP address anyway, just copy it and make it static. easy

also how come your network doesn't have DHCP? you must be getting internet from somewhere. a router or DSL modem, they must have DHCP in them.

none of them you mentioned are bugs. you just have to know where to use what.

@HotCakeX it's definitely bugs, network switch can't change IP address randomly if assigned statically. As simple as that. No other network software do this thing, but MS virtual switch. 
Also that aged thing with ICS not working after reboot is a nasty bug too. 
NAT is hardly working too, sometimes it's ok, sometimes it's not. Probably arp related, idk. 
In conclusion there is no simple setup which allows you to use host internet inside hyperV VM.
Not to mention there are no shared folders so on.  

I can't use external networks because of this, I have to mount it as samba share (technology from 20 years ago okay). And how to work with VM if there is no external switch with dhcp like on a jet board? It's laptop with windows10, not a server inside infrastructure. 
VirtualBox does this sharing in two simple clicks. But Windows10 core denies all other hypervisors with every update.