Forum Discussion
Hyper-V Default switch IP address range change. Ver 1809 Build 17763.1
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.
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.
- HotCakeXAug 07, 2019MVPSorry but I wasn't replying to you, i was replying to the OP, your problem might be different and i didn't consider your setup.
anyhow, I don't see how any of the things you mentioned can possibly take "hours" to setup. if you know the topology you're going to deploy beforehand then it can only takes few minutes to setup. btw you don't have to set anything in the host network adapters (virtual or not), everything happens in the guests.
if you want to set something that involves DHCP? like a Windows server DHCP? you still need external network adapter with static IP set inside the guest OS, as I said in my previous comment.- DanielNiccoliAug 07, 2019Steel ContributorSetting up the virtual switches takes a few minutes.
I don't have a test environment handy at all times. I certainly don't have one now. So I need to get a software firewall, download the iso, create a new VM, install the firewall and configure it. This takes a bit longer than a few minutes. But that is absolutely beside the point.
The point is, the Default Switch is broken.
> if you want to set something that involves DHCP? like a Windows server DHCP? you still need external network adapter with static IP set inside the guest OS, as I said in my previous comment.
An external network adapter inside the guest OS? Either that configuration or that terminology doesn't make any sense.- HotCakeXAug 07, 2019MVP
look for example in your guest OS/firewall etc you need to set up these few main parameters.
whether you do it using GUI or powershell, terminal etc it's not gonna take so long..
also is there any indication saying that the default switch in Hyper-V must give you an static IP address regardless of host reboot?
I meant making an external network adapter and connecting it to the guest OS.
that config would make sense in a nested virtualization.
- DeletedAug 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 staticI 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.