Resolving VMs not getting a DHCP address from a DHCP server VM.
I’ve been slacking in keeping the blog updated, I’ve started several new projects and work has gone from 25-30 hour weeks to constant 40s. I’ve taken some time for self-enrichment by setting up a PowerEdge Server as a virtualized test lab using Hyper-V Manager and SCVMM 2012 on Server 2008 R2. I am trying to get away from using Small Business Server and actually work on breaking out the server services to dedicated virtual servers. The first one, by necessity of wanting to use workstations in a real-life use case, was a DHCP server on a Server 2003 R2 Standard VM.
WARNING: I am a pre-MCSA know-nothing with regards to virtualization. My first time messing with Hyper-V was about two weeks ago, so if this is common sense to most of you, that’s why.
It appeared to be functioning properly, but I had a problem. If my workstation VM’s NIC was pointing to an External virtual network, it would not get a lease. If I set the IP statically, it could surf the Web and do all the stuff it needed, but if I set it to get a dynamic IP it would never contact the DHCP server. If I set it to an Internal virtual network, it would get a lease, but couldn’t get online. If I added a 2nd NIC and made one Internal and one External, I was no better off as I still had to set the External IP statically.
The issue lies in how the virtual NICs work in relation to the hierarchy of virtualization. When you create an External vNIC, it unbinds everything from the physical NIC but the VM NIC platform, and creates a new NIC on the Hyper-V server. This is important, because that External vNIC is what determines the connectivity of any VMs that try to use it. The DHCP server is virtualized, and also using that External NIC. Once I set up DHCP Server on the host machine, and set the External vNIC to get a dynamic IP, the workstation was able to get a lease, see the other computers, join the domain, and so forth.
If I get really bored in my testing, I will set up a DHCP Server VM with it’s own Hyper-V server and build a workstation on it, and see if it can get a lease that way, to prove whether it’s a hierarchical problem or, more likely, an error in my network configuration.
This could also likely be resolved by assigning the DHCP server its own NIC, but I only have 2 NICs on the server right now and this setup will work on a one NIC configuration.