Forum Discussion
Hyper-V Default switch IP address range change. Ver 1809 Build 17763.1
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
- Neo BeumBrass Contributor
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...
- kazuo_yamauchiBrass ContributorI 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?
- Neo BeumBrass Contributor
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.
- Remon liCopper Contributor
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.
- Neo BeumBrass Contributor
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.
- 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.- DanielNiccoliSteel Contributor
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.
- sc-mleCopper Contributor
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.- You're welcome! 🙂
- Bala SundaramBrass Contributor
It appears to be very random.
Default switch again reverted back to 172.17.X.X .
Strange.
- Remon liCopper Contributor
Yes, I got same problem and can not find any answers to get a fixed ip for default switch.
- sn00pCopper Contributor
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.- sn00pCopper Contributor
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.
- GlaucomaPredatorCopper Contributor
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
- H3ALYCopper Contributor
Take a look at your Default Switch in Virtual Switch Manager, is it set to "External Network" with a defined controller or is it set to "Internal Network"?
- Bala SundaramBrass ContributorErratic IP address assignment issue is fixed in Build 17763. 134.
I am bit confused about the last post about checking in the VSM for External/Internal network that is association. We are talking about Default Switch supplied by MS for NATing from Configuration version >7.0. MS easy way of old fashioned internet connection sharing. It is always EXTERNAL. I am sorry not able to make any sense. We are not taking about a custom Switch that is associated with any network type (External/Internal/Private)- cbj4074Brass Contributor
Bala Sundaram is correct in that the Connection type cannot be changed for the Default Switch (all of the options are grayed-out), H3ALY , even with all VMs powered-off.
In any case, I have the same problem/question as Remon li . All I'm trying to do is assign a static IP address to a guest VM so that it doesn't change on me unexpectedly. I'd really like to satisfy the following requirements:
- Be able to specify the IP address to be used in the guest VM, e.g., 192.168.10.10.
- Be able to accomplish the above programatically, so that it can be done as part of an automated provisioning process (e.g., via Vagrant).
- Give Internet access to the guest VM via NAT (exactly as is done with the Default Switch). To be clear, I am amenable to using the Default Switch (instead of creating a new one), as long as its IP address does not change on me.
It sounds as though this is a two-part problem, and the first part is fixed in Build 17763.134, so at least the subnet will no longer change at random.
Bala Sundaram , when you say, "Erratic IP address assignment issue is fixed in Build 17763. 134", how many of the four octets are now "fixed"? The first three? In other words, do you now find that the address is predictably set to 192.168.XX, where XX never changes unexpectedly (nor the 192.168 part)?
Thanks for any clarification that you're able to provide!
- dwx101Copper Contributor
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 E 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
- DanielNiccoliSteel Contributor
So, is there a solution to this? I really would like my Default Switch to have a static IP configuration.
- __1373Copper ContributorMERY Chrismas
- To you as well!
- mooh-poohCopper Contributor
IP changed due to dynamic MAC. New MAC means new DHCP lease.
- So manually set a static MAC address for your Virtual network adapter.