Although it’s been around for a while, the Hyper-V Default Switch is often misused or not given the credit it actually deserves. Let’s take a quick look at what it does, how it works and when you should use it.
Starting with the Windows 10 Creators Update (build 1709), Hyper-V includes a special virtual switch — the Default Switch. It’s called this because it’s the only switch installed automatically… ummm…. by ‘Default’. This was done to bring Hyper-V (kinda) in-line with simple NAT network sharing offerings from competing virtualization platforms like VirtualBox. This is not something you need to set up (you can’t, actually) or install — it’s just available and ready for you to use.
How it works (briefly)
The Default Switch leverages Internet Connection Sharing (ICS) and gives it a whole new purpose. It creates a dynamic private address space for any connected VMs, provides a rudimentary DHCP server to automatically assign addresses within that space and then NATs traffic to and from connected VMs so they can share your host’s physical network card. Pretty cool, right? In other words, it turns you host machine into a very very very simple router and allows the VMs to access the host and the internet.
Interestingly, it also carries forward a few other features from the old ICS days, namely the hosts
Top 3 Drawbacks
Although this feature is pretty great, it does have some drawbacks.
1. Dynamic IP assignment
The built-in pseudo DHCP server that assigns addresses definitely makes life easier in many cases, however, it cannot be disabled and cannot be customized. You have no control over the assigned address and cannot set a static IP on your VM. This is detrimental if you wanted to set up a server or something else that requires a predictable address for port forwarding.
2. Fixed domain assignment
I know, you thought mshome.net was dead… I know I certainly hoped it was. But, in this case, it’s very much alive. While it’s very cool that you can fire up a VM and access it by name seconds later via this mshome.net domain name, it really sucks that you cannot change that domain name! This spells trouble for situations where you have domain-specific test-setups, providing domain services, certificates, and so many many other issues.
3. Port forwarding does not work
This is, if you think about it, a natural extension of point 1 above. If you have a dynamic address, how would you
When to use the Default Switch
Briefly: Use the default switch whenever the above 3 drawbacks don’t apply to your usage scenario! Seriously, the Default Switch is super simple and such a quick way to provide internet/network access to your VM. Really, anytime that the domain name doesn’t matter to you and you do not need to forward ports, the Default Switch is a great candidate for quick setup. If you need control over the network in question, the assigned IP address or the domain name, then set up a dedicated NAT network (I did an article on how to do that with just 3 PowerShell commands!) and save yourself a ton of time and head-scratching.
I could go much more in-depth into this issue, but I think this covers the main points. As long as you keep the 3 points outlined in this article in mind, you should have no problem deciding when you can save time and use the Default Switch versus when it’s worth the extra effort to set up your own NAT network in Hyper-V. Thanks for reading my techie-thoughts on this issue. Have any comments? Suggestions? Want to add your tips? Things you want me to cover in a future article? Comment below!