Sep 24 2018 10:19 AM
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
Dec 02 2019 06:15 AM
@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:
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:
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!
Dec 02 2019 09:34 AM
Dec 08 2019 12:09 PM
@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!
Dec 08 2019 12:39 PM
Dec 27 2019 04:30 AM
Dec 27 2019 08:39 AM
Dec 29 2019 06:59 PM
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.
Dec 29 2019 11:38 PM
Dec 31 2019 02:46 PM
Using anything will not make Default Switch to disappear. It confuses my AV even when no virtual machines are running.
Dec 31 2019 10:26 PM
Jan 01 2020 02:40 AM
Jan 01 2020 02:45 AM
Feb 03 2020 05:45 PM
@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
Feb 03 2020 11:55 PM
Feb 04 2020 08:27 AM
IP changed due to dynamic MAC. New MAC means new DHCP lease.
Feb 04 2020 11:05 AM
Feb 27 2020 06:50 AM
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)
Feb 27 2020 07:09 AM - edited Feb 27 2020 07:10 AM
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?
Feb 27 2020 07:13 AM
@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.
Feb 27 2020 07:24 AM