09-24-2018 10:19 AM
09-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
09-04-2019 06:33 AM - edited 09-04-2019 06:38 AM
When you do a route print, you will see that the default vSwitch is not creating a persistent route but rather a temporary one. it's not a bug, it's intentional and the way Microsoft made it.
you can request a feature change through Feedback hub app.
the norm is that when people are running professional servers in their Hyper-V, they set external vSwitch as the network adapter for their VMs, it provides more functionality.
there is also another case when the host is connected to a VPN, if the guest VM use default vSwitch, it will have access to the same VPN as the host. but if the guest VM uses an external vSwitch, it will continue using the Direct Internet connection Even though the host is connected to the VPN. now if the default vSwitch was to get a static IP address forever, it would cause conflicts with host VPN and other scenarios where the subnet of the default gateway on the host changed.
with non-persistent routes like this, default gateway first examines and evaluates the network topology and then based on the available networks and subnets, chooses an IP address.
so again this is Not a bug, it's just how it's made.
I have a normal home router, my Windows 10 is connected wirelessly to it. in my Hyper-V I created an external virtual network adapter and connected all my VMs to that same external vSwitch. I run 3 Windows server 2019 and one of them is a VDI host (yes Nested Virtualization). all of these with a 20$ wireless network adapter and a simple normal home router. it can't be any simpler and easier than that.
I've worked with VirtualBox and VMware Workstation 15 as well, but still Hyper-V is the best.
09-04-2019 11:08 AM
@HotCakeX NAT is not about routes, it's about network address translation. And that switch is for NAT isn't it? But it's black-boxed and the only configuration parameter opened (static IP address) is simply broken, changing randomly every time you boot your computer. Why? No clues, nobody does this except MS. And documentation either not complete or it's just a bug.
Again, switch is not allowed to change it's own address randomly if configured statically. If MS made it intentionally, they should fire their developers and hire professionals.
This scenario is a dead horse. It's usable only in few cases. Again, all other virtualization software do things right in few clicks but not MS. Why? No clues.
Windows costs money. And the thing you have to buy yet another software to make it works is just bad. Because it's working pretty weird out of the box and workarounds are broken too.
09-04-2019 11:15 AM
09-11-2019 06:51 AM
@sn00p The recreation of the Default Switch with a new subnet on every host reboot is definitely a bug. I'm migrating from VMware, where I use a virtual NAT network for all my VM's. I knew going in to the migration that Hyper-V has limited capabilities compared to VMware, but I didn't expect the networking to be so limited. Here's the issues I've run in to:
* - Default switch reconfigures on every host restart and there is no way to prevent it.
* - Default switch is the only way to have VM's on a virtual NAT...it's not possible to create a Internal Switch with NAT (correct?) that doesn't get reconfigured on every host restart
* - External switch must bridge to a specific host NIC. My host is a laptop that is sometimes docked and connected via ethernet and sometimes connected via wifi.
I'm new to Hyper-V (but not new to working with VMs and networking), so please correct me if I've overlooked solutions to any of the above.
09-11-2019 07:05 AM
09-11-2019 07:19 AM
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.
09-11-2019 08:51 AM
09-11-2019 10:16 AM
09-11-2019 11:54 AM
09-11-2019 02:08 PM
I figured out how to create a new NAT internal switch with a static IP. It can be done via Powershell: Using a NAT Virtual Switch with Hyper-V
These are the commands I used to re-create the 192.168.5.X NAT network like I had in VMware Workstation:
New-VMSwitch -SwitchName “NATSwitch” -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.5.1 -PrefixLength 24 -InterfaceAlias “vEthernet (NATSwitch)”
New-NetNAT -Name “NATNetwork” -InternalIPInterfaceAddressPrefix 192.168.5.0/24
I knew there must be a way since my scenario is very common in software development. There's just no way to do it in the Hyper-V Switch Manager GUI.
I have no use for the Default Switch now, but it doesn't appear to be remove-able...at least not without some registry hacking.
09-12-2019 01:05 AM
In that same article:
"the end result is that (to begin with) that virtual machines on the internal virtual switch can talk to the host, but they cannot talk to the network that the host is connected to."
That's totally useless for me.
I want my Virtual machine to be able to talk to the host network and be accessible from the Internet or in case of a server, it host websites on ISS, provide VPN server connections to outside clients over the Internet.
my host is already behind a phyiscal router, putting my VMs on yet another NAT with different subnets makes things worse and impossible.
with External Virtual Swtich in Hyper-V, i can give an IP address (v6 or v4) to my VM and then put that VM's IP address in my physical router's DMZ so it can be accessible from the Internet.
that's how servers operate. Hyper-V does a great job by letting VMs directly be involved with the real network.
09-12-2019 07:04 AM
@HotCakeX The VM can connect to the network using an internal switch if it's set up with a virtual NAT firewall. My local server VM can connect to Microsoft Update (and the rest of the local network + internet). However, only the host (my laptop) can initiate connections to the VM...which is perfect for a development testing scenario. There are other servers (vSphere VMs) that the code is pushed to when it's time to make it available to other people for testing and production.
09-12-2019 07:34 AM
09-12-2019 08:28 AM
@HotCakeX I'm not intending to argue with you and what I'm about to say is not directly related to the original topic of this thread, but you might be surprised at what's being done in "real-life" networking scenarios these days. The reason I switched from VMware to Hyper-V on my dev machine is because I need to work with Window Containers and Docker Desktop, which requires Hyper-V. Currently Hyper-V and VMware cannot coexist, but that is about to change. In the container world, VM's are just hosts for containers and usually many containers. For example IIS would not run directly on a server VM, but in a container. In larger scale systems like I work with, everything is redundant and disposable. For example, the web application I work on has many instances in production all sitting behind a reverse proxy (which itself is in a container). If one instance dies for some reason, no big deal, another is spun up to replace it. The containers are all behind a Hyper-V internal switch with NAT. Anyway, it you want to learn more about containers in the Windows world, here's a good place to start: About Windows containers
09-12-2019 08:36 AM
09-28-2019 08:18 AM
10-04-2019 12:45 PM - edited 10-04-2019 12:50 PM
@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?