Forum Discussion
Bala Sundaram
Sep 24, 2018Brass 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...
DanielNiccoli
Aug 07, 2019Steel Contributor
HotCakeX wrote:
I've been working a lot with Hyper-V and I gotta tell you that the default switch is NOT meant for static IP addressing. in any tutorial or YouTube video you watch you'll see than none of them choose the default switch for static IP addressing.
if you want static IP and never changes, you should make a new virtual network adapter and make it EXTERNAL, then connect it to your PHYSICAL network adapter (all done in Hyper-V switch manager), it will make a bridged connection in your host Windows. then inside your guest OS (VM) you can give a static IP to your OS and it will stay that way and never changes.
IMO default switch is for those who want a quick setup and get a VM up and running fast without any additional settings.
I've been working a lot with Hyper-V, too. The default network adapter is not meant to change IP address ranges with every reboot. Once an IP address is set, it should be immutable. Throwing around with workaround does not remove the issue at hand.
Your described way to get a static IP is fine. However, this doesn't work when I have to test something that involves DHCP. Sure, I can install a NAT with 2 vNICs, one on one external switch and the other on a private switch, but that involves additional hours to setup correctly.
With the built-in network address translation of the Default Switch, this problem is already solved. And for testing purposes it would be perfectly fine, were it not for the non-intended behaviour that the address range randomly changes between reboots of the host computer.
Deleted
Aug 11, 2019
Hi.
I'm totally new to Hyper-V but not quite new to networking and virtualization and this random selection of private subnets really baffles me. This looks more like a fallback function and no the main one. I can understand the following reasoning: If the Hyper-V user doesn't enter a proper subnet or the subnet they entered is invalid, generate a random one (things have to work one way or another, right?) The problem is that the main function doesn't seem to exist so we get this random mess.
As I said, I have worked a bit in networking so I looked for a simple way to know exactly which IP addresses were used after the host operating system reboots. What I do is open a Command Line Prompt (doesn't need to be Admin) and type: arp -a. (no dot at the end) I look for the interface that I know isn't mine as in the IP address wasn't configured by me. Once I get that, the pattern is as follows:
The interface IP address is the address of the Host (duh!) which is the gateway IP address for the VMs. In the Physical Address column the ff-ff-ff-ff-ff-ff MAC address corresponds to the broadcast IP address for the subnet the VMs use. The rest of the IP addresses in this subnet belong to the VMs. Like so:
Interface: 172.18.61.97 --- 0x1c
Internet Address Physical Address Type
172.18.61.108 00-15-5d-0a-0d-00 static
172.18.61.111 ff-ff-ff-ff-ff-ff static
I have one VM which apparently got the 172.18.61.108 IP address this time around. Maybe there's a way to automate such "inventory check" with a script or something else.
I hope some will find the above tip useful. 🙂
Cheers.