Forum Discussion
Bala Sundaram
Sep 24, 2018Copper Contributor
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 5...
mlmathews
Sep 11, 2019Copper Contributor
With VMware, I could configure my virtual NAT network subnet...I had it set to 192.168.5.X and the host and guest IP addresses on the subnet where static. So no matter where I happened to be working, my VM's were isolated on a NAT network with static IP addresses (which is important for the type of work I do)
With the Hyper-V Default Switch changing the subnet on every reboot, I'm having to log in the to my main VM (Windows Server 2016) and tell it that the "new network" that it is now connected to is a private network.
cbj4074
Oct 04, 2019Copper Contributor
mlmathews It sounds as though our respective use-cases may be similar.
(Edit to add: I had missed your most recent reply, as I failed to notice page 2; I will look into the PowerShell-based solution! Thank you!)
I'm a web developer who works primarily with VMs running GNU/Linux. I work in a Windows-driven, corporate ecosystem, though, so my primary development machine runs Windows 10 with Hyper-V.
I have many different VMs that I spin-up on a regular basis, oftentimes freshly-provisioned (that is, built dynamically and booted for the first time on each use). The provisioning process is 100% automated, which I mention only to make clear that there is no room for "manual tweaking" nor GUI configuration in my workflow; any networking configuration has to be automated during provisioning.
Further, I have many VM configurations in which one VM needs to communicate with one or more other VMs on the same subnet, which requires that each source VM knows any potential destination VM's IP address (a hostname could work, too, if hostname resolution was configured correctly, which I haven't yet attempted with Hyper-V).
More importantly, I need this subnet to be completely isolated from my physical NIC so that there is zero possibility of another machine on my LAN communicating with any of the VMs running in Hyper-V.
But I also need for the VMs to be able to connect to the Internet.
So, here's where I'm stuck:
1.) Default Switch: IP address assigned to VMs changes at random on host system reboot, so without hostname resolution across multiple VMs on VLAN, this configuration is untenable.
2.) External Network: This makes my VMs visible on our corporate LAN, which is a no-go.
3.) Internal Network: My VMs cannot obtain IPv4 addresses for some reason; only IPv6. No idea why this is.
4.) Private Network: Doesn't allow VMs access to internet, so not viable.
HotCakeXDo you have a clever solution that will meet my requirements?
- HotCakeXOct 18, 2019MVPGood points
- mlmathewsOct 18, 2019Copper Contributor
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.
- HotCakeXOct 18, 2019MVPCould 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. - mlmathewsOct 17, 2019Copper ContributorIn 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.
- HotCakeXOct 16, 2019MVPI'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. - cbj4074Oct 16, 2019Copper Contributor
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!
- HotCakeXOct 08, 2019MVPThank 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! - cbj4074Oct 08, 2019Copper Contributor
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-and-higher-with-powershell/ 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!
- HotCakeXOct 05, 2019MVPI don't think it's a bug in the first place
- HotCakeXOct 05, 2019MVPDefault 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. - sn00pOct 05, 2019Copper ContributorI 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 - HotCakeXOct 05, 2019MVPAlso 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. - HotCakeXOct 05, 2019MVP
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.
- DanielNiccoliOct 05, 2019Steel Contributor
"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.
- HotCakeXOct 05, 2019MVP
Nope,
attach your VM to the virtual network adapter, no problem, set the virtual network adapter Inside the VM to private, no problem, set the default network location for all known and unknown networks in Group Policy to private, no problem.
instead of talking about imaginary things about me, please stay on topic and Don't be rude.
so again,
1. use group policy, the local one, not the group policy management, to change network locations.
2. if you change the virtual network adapter INSIDE the VM, it WON'T change after reboot of the host.
computers on a network using DHCP do NOT change their network locations when the DHCP server gives them a different IP address. - DanielNiccoliOct 05, 2019Steel Contributor
HotCakeX How is it "advanced networking" if I just wanna attach a computer to a network, but need it to be designated a private network so the firewall just works.
At this point you're just defending your own point of view. You can't make a statement anymore where you don't feel personally attacked. It's become very tedious. Just let go.
- HotCakeXOct 05, 2019MVPIt's for easy networking and quick VM creation, anything in particular and more advanced feature you need you have to use other types of virtual network adapters.
- HotCakeXOct 05, 2019MVPNot me.
you talked about another subject so I tried to stick to the topic and do not deviate. if you wanna talk about other subject you can open another topic. - DanielNiccoliOct 05, 2019Steel ContributorIt's also annoying that you have to switch your network from public to private every time the IP range changes for no reason.
A fixed range that changes only if there's a collision with the host's network would be enough. There is absolutely no need to randomize the IP range every time the host reboots. - sn00pOct 04, 2019Copper ContributorWell. HyperV doesn't have innate shared folders. Would you be so kind as to describe a procedure for sharing folders with Linux VM on the default switch?
It's not possible in the current implementation. There are hundreds of details you didn't take into account saying
"Default switch is usable in Every scenario except those that require static IP addresses such as servers".
It's not true, you can't even share folders. You can't use firewalls, you can't use ACLS or another wide used technics. It requires different third party software (all premium) and hours of configuring to be usable. Just compare it to simple two clicks in virtualbox before advocating weird and buggy MS implementation of the simplest thing ever widely available in every other similar software. - HotCakeXOct 04, 2019MVPThe reality is something else, I'm sorry that you feel it's a bug but the fact is different. you're free to have your opinion.
Default switch is usable in Every scenario except those that require static IP addresses such as servers.
the majority of the computer users/home users in the world use dynamic IP address, ISPs all around the world give their subscribers dynamic IP addresses, they only lease static IP address only to those clients that pay more and explicitly ask for it.
there is no win or loss, it's not a race, the correct way is shown, now if someone decides to go the wrong way, then it's their fault. - sn00pOct 04, 2019Copper Contributor
HotCakeX It's not a documentation. It's just a tech blogs with workarounds for an extremely buggy software.
The default switch is not usable in almost every scenario except 2 minutes demo session and I bet it could fail even in this case.
It's like a car moving randomly in every direction possible no matter the actual driver wants to drive.
And the thing that you have to add more objects to make it works doesn't make it a feature, it's still a bug. And even more, it's completely undeletable.
Please try Linux or simply VirtualBox so you could compare a MS mess and working solution from other vendors. Few hours for MS to make it work and few clicks on VB or few lines of configuration on Linux really makes a difference and MS is not a winner here. - HotCakeXOct 04, 2019MVP
you said stop speaking for MS (Microsoft),
ok sure, of course, why not.
here is what Microsoft says, Not me:
Hyper-V has a Default Switch for easy networking
Does a professional user who wants to setup a Virtual Server for serious work use something that is made for easy network? if he/she does then he/she is No longer called professional, but amateur. and for amateurs, Microsoft created the Default switch.
- mlmathewsOct 04, 2019Copper ContributorTrue, but I have to re-disable it after every boot.