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 It seems you are right, I'm sorry... But it seems that Microsoft still has a related bug, as I had (and have) the same issue on multiple PCs, and looking at Microsoft forums, I'm not alone.

 

There are several errors when trying to create External adapter, in my case, always on newer Win10 with Default Switch present (Windows 10 version 1709 or newer), so I (maybe mistakenly?) believe these to be related.

 

First error:

"the operation was passed an invalid parameter"

Complementary error (from Powershell's New-VMSwitch commandlet):

"Adapter is already bound to the Microsoft Virtual Switch protocol"

Proposed solutions:

https://social.technet.microsoft.com/Forums/azure/en-US/3272e5cc-e3d7-44a9-8da8-1a50a80afdf0/externa...

 

Network and Sharing (Win7)/Network (Win 10)
Change adapter settings/options
Right-click Local Area Connection
Go to Properties
Scroll to the bottom of the list
Uncheck "Hyper-V Extensible Virtual Switch" option

 

Alternative:

 

The nuclear option that works with Windows Core is using netcfg to wipe out all your networking settings and re-initialize the network card drivers.

#WARNING! DANGER! THIS WILL DELETE ALL YOUR NETWORKING SETTINGS!
netcfg -d

 


Second error, after I did uncheck Hyper-V from my physical NIC and rebooted:

Tried to create External switch via PowerShell again

 

New-VMSwitch -Name "External VirtualSwitch" -NetAdapterName "Ethernet" -AllowManagementOS $True

 

Error:

"bind failed: {Access Denied} A process has requested access to an object, but has not been granted those access rights"

Proposed solutions:

https://social.technet.microsoft.com/Forums/windowsserver/en-US/84f413dc-2da0-44c0-928d-70b7a6c0404b...

Hi, I solved this by: In PowerShell type: netcfg -d This WILL DELETE all network adapters AND network SETTINGS! Physical adapters will NOT be LOST. Then i restored my network settings and created new External Virtual Switches.

 

So since both errors proposed "netcfg -d" I did that, rebooted, naturally now I have two Default Switches that I will just need to ignore, but now I can create External Switch without errors (both in GUI and PoSh), and use them as usual (pre-Win10/1709 times).

 

I do still stand by the fact that a) Default Switch should be OPTIONAL (can be setup as default behavior, but should have option to be removed) and b) that Microsoft somehow at the same/similar time introduced related bugs that provoke issues with creation of External switches.

 

I'm kinda happy now that I have my External switch running again, and will just have to live with the unneeded default switches lingering there in the background forever. Maybe you didn't have issues for a mix of reasons (maybe you did not upgrade all the way from initial Win10, or maybe you have other inactive adapters that are poluted by this bug but you don't use them so never noticed, or - you're just lucky).

 

Hopefully the links to two threads and the copied proposed solutions will help someone somewhere when they pop onto this thread through web search, if it helps just one more person I'll be happy.

 

Cheers!

Good to know you found a solution, even though it's not that pleasant.
i agree default switch should be optional, not everyone want to use the quick VM creation of Hyper-V.

@HotCakeX Here I had another chance on completely unrelated PC (different hardware, different location, different networking settings and environment, different users, not in domain, etc.) Same set of initial errors.

 

Trying to create external switch in GUI:
"Error applying Virtual Switch Properties changes
Adding ports to the switch 'External Switch' failed
The operation was passed a parameter that was not valid."

 

Trying via PowerShell command ("New-VMSwitch -Name "External VirtualSwitch" -NetAdapterName "Killer e2200 GbE NIC" -AllowManagementOS $True"):
"New-VMSwitch : Failed while adding virtual Ethernet switch connections.
External Ethernet adapter 'Killer e2200 Gigabit Ethernet Controller #2' is already bound to the Microsoft Virtual Switch protocol."

 

So I tried "easy" solution first, and in NIC Properties unchecked option:
"Hyper-V Extensible Virtual Switch"
(And rebooted PC)

 

Luckily, on this PC when I tried to create external switch in GUI after reboot everything went ok. Didn't have to use the "nuke" option this time.

 

But still, quite annoying. And (at least in my case) on PCs that I regularly use I have all of them throwing this or that error. I love MS, but sometimes I hate it as well...

 

Cheers!

Thanks for the useful info, btw i also got the Killer e2200 GbE NIC
anyway, yeah Hyper-V has it's own issues. I recently got bored and switched to VMware workstation pro 15.5 (latest ver) and I had so many problems configuring it.
I had to turn off Windows defender application guard, Windows Sandbox, Core isolation in Windows defender and literally lots of compromise in order to only install it.

after that I had problem with Windows 10 Enterprise x64 IoT version when i tried installing VMware tools on it, i was getting error that prevented me to install it.

so i eventually uninstalled it, turned on all of those security features again and continued using Hyper-V. i know it's not perfect but the alternative is a lot worse, at least for me.

I just hope Microsoft hear us and apply the changes we are asking to the way Hyper-V handles virtual network adapters.

@HotCakeX 

I have another silly problem with this default switch. Since it changes its parameters all the time, my antivirus every time thinks it is a new network, and asks me what to do with it. It causes distractions, but the worst part is that it blocks all network on boot until I answer, causing network disks to not mount, which causes unrelated apps to not load properly and so on.

 

I am trying to figure it out with AV support, but I doubt they will resolve it soon, so I will have to use less optimal antivirus on my PC.

Hi,
Try using External virtual adapter instead of the default switch if you can 🙂

@HotCakeX 

 

Using anything will not make Default Switch to disappear. It confuses my AV even when no virtual machines are running.

Well I have the best AV, Kaspersky Internet security, with bunch of virtual switches including the default switch, everything is working perfectly.

you should contact your AV website and tell them this problem of yours.

my suggestion is to use an AV that is the best and doesn't have these problems.

https://www.youtube.com/channel/UCKGe7fZ_S788Jaspxg-_5Sg

https://www.youtube.com/watch?v=UDkllzL1gqo

@HotCakeX 

kasp - durak.png

Every time I boot, launch anything related to Hyper-V or sneeze.

@HotCakeX 

Very informative thread for this newb.  Like many, I'd consider the behavior of the default switch a bug and not an enhancement. 

1) Installed automatically (not optional).
2) Can't be removed.

3) Can't be modified.
4) No persistent state except unconfigured.
5) Defaults to "Public" on a Domain machine and reconfiguration of state doesn't stick.

VBox and VMWare user attempting to learn Hyper-V and decipher the lack of logic in the above configuration.

Because it's "Public" or doesn't allow the option of a network type selection the Default Switch kills PowerShell WinRM and MS Admin Center on my domain, even when all VMs are using a second manually configured external switch and there is nothing using it - it's still in the registry in the default default configuration after reboot and PowerShell DSC is useless with the Default Switch registering.

I've read the arguments that it's "for amateurs" etc and there to make networking easy.  My experience is exactly the opposite, that it's inexplicably configured to keep professionals from accomplishing their work. It breaks workflows that would otherwise be successful and that is a substantive meaning of a 'bug' in the software.

I've temporarily gone back to VMWare, which works flawlessly managing my virtual lab because default switch just doesn't work in my situation. 

If someone can, please help me find workarounds to the 5 points above I'd greatly appreciate both your time and the knowledge.  Very frustrating to have a simple configuration be this difficult to get working. 

FYI - problems listed above are on 1909.

Thanks

I think the best thing that should be done is to send feedbacks using any way, preferably Feedback hub, then share it with others who have the same problem to upvote it so that Microsoft will change that behavior on their end in future Windows 10 releases.

IP changed due to dynamic MAC. New MAC means new DHCP lease.

So manually set a static MAC address for your Virtual network adapter.

If you just need to access resources on your guest from the host, you could just have a powershell script that you can run on the host after launching the VM.

 

Replace 'BryanDev' with the name of your VM and replace "weirdalvm.3-gis.com" with your desired url you want to access the resource with.

 

Run as administrator

 

$result = get-vm -Name BryanDev | Select -ExpandProperty Networkadapters | Select IPAddresses | ft -hidetableheaders | Out-String
$result = $result.Split(",")[0].Trim().Replace("{", "").Replace("}", "")


function setHostEntries([hashtable] $entries) {
    $hostsFile = "$env:windir\System32\drivers\etc\hosts"
    $newLines = @()

    $c = Get-Content -Path $hostsFile
    foreach ($line in $c) {
        $bits = [regex]::Split($line, "\s+")
        if ($bits.count -eq 2) {
            $match = $NULL
            ForEach($entry in $entries.GetEnumerator()) {
                if($bits[1] -eq $entry.Key) {
                    $newLines += ($entry.Value + '     ' + $entry.Key)
                    Write-Host Replacing HOSTS entry for $entry.Key
                    $match = $entry.Key
                    break
                }
            }
            if($match -eq $NULL) {
                $newLines += $line
            } else {
                $entries.Remove($match)
            }
        } else {
            $newLines += $line
        }
    }

    foreach($entry in $entries.GetEnumerator()) {
        Write-Host Adding HOSTS entry for $entry.Key
        $newLines += $entry.Value + '     ' + $entry.Key
    }

    Write-Host Saving $hostsFile
    Clear-Content $hostsFile
    foreach ($line in $newLines) {
        $line | Out-File -encoding ASCII -append $hostsFile
    }
}

$entries = @{
    'weirdalvm.3-gis.com' = $result
};

setHostEntries($entries)

 

Thanks, but Hyper-V VMs with enhanced session allow drag and drop between guest and host.

or is the script for a specific situation only?

@HotCakeX I'm talking about accessing a url that is hosted inside the guest.

 

If doing development you could do remote debugging on your host while having your environment on your guest.

Thank you! i'll save it in my notes