Hyper-v assigns auto-configuration IP for virtual network


My server has two static IPs (one NIC with two ports). When I create a virtual external network in Hyper-v manager (named External1) and assign it to port 1, it works until I reboot, at which point Windows assigns it an auto-configuration IP address in the 169 range and therefore I cannot connect to the server on it, nor can vm's connect outbound. If I assign External1 to port 2 it doesn't have a problem.

Note that both port 1 and 2 are statically configured. Port 1 has a default gateway and port 2 does not.

To fix it I have to delete External1 and reboot the server. Then I can connect again, but have no virtual network to use anymore. Another way to fix it is to delete External1 and set port 1 to DHCP which allows me to connect (so it's not a cabling issue) but I need the static IP.

Ideally I want a virtual network on each port (named External1 and External2) so that I can assign vm's to one or the other.

The server with this problem is part of a 2-node cluster. The partner server doesn't seem to have a problem and I have two virtual networks on it.

I also tried setting the 'alternate configuration' for port 1 to use the same static settings but it still keeps assigning the auto-config IP.

Server is running Win2008 R2 SP1.

Any ideas?
Who is Participating?
Gandharva_GuyAuthor Commented:
Ok, I think found the issue. When I examined the registry more closely I found that there were some leftover settings  from when we initially tried to connect the server to the network (and ran into problems at that time). We ended up changing the NIC were were using and settings from that NIC seemed to be left over in the registry.

In particular I looked at:


for the corresponding NIC and noticed that there were multiple incorrect default gateways and EnableDHCP was set to 1. I corrected the gateways to have just one (with the correct IP) and set EnableDHCP to 0.

Then I made the corresponding changes on:


where {GUID} is the corresponding NIC (based on the IP).

I also set the IP of the original NIC to and disabled it.

Rebooted and all settings stayed correct.
Added virtual networks back in and rebooted. All seems to be working now.

Svet PaperovIT ManagerCommented:
Let see if I understand correctly: you set a static IP address on a NIC and it converts to dynamic within 169 subnet when you restart. Is that happens also if you remove the virtual NIC associated with that adapter (port 1
Gandharva_GuyAuthor Commented:
No it doesn't. If I remove the associated virtual network (using Hyper-v network manager), and then reboot, port 1 goes back to the static settings. It's only after I add a virtual network that this happens.
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

Svet PaperovIT ManagerCommented:
This is weird. You could try to rename the newly created share external virtual network when you recreate it with Virtual network manager in case there are some errors in the registry associated with this controller. May be it will help.

Another solution is to search the registry for some errors in Parameters\Tcpip keys.
Gandharva_GuyAuthor Commented:
Ok, I tried creating a network named 'dev1'...same problem.

Then I looked in the registry and saw that there are two key sets for the IP (the other server is also like this so I assume it's expected to have two). One set had two default gateways and EnableDHCP was set to 1. I corrected both (one default gateway, DHCP set to 0) so that the two key sets are identical. Rebooted and registry was still ok. Then I went to the IPv4 settings of the NIC and still looked ok, but when I pressed Ok it gave me a warning about multiple default gateways. I checked the registry and the two keys that I fixed were back to incorrect values.

Local Machine\System\CurrentControlSet\services\{long NIC id}\Parameters\Tcpip

So it seems that settings sheet is pushing incorrect values to the registry even though they are correct on the screen. Why?
Svet PaperovIT ManagerCommented:
Nice to hear. Thank you for the feedback.
Gandharva_GuyAuthor Commented:
Assistance from other expert led me to the detailed solution.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.