Solved

Hyper-V VM looses Gateway IP after each reboot

Posted on 2013-11-21
8
1,300 Views
Last Modified: 2014-11-12
Here's the environment...

Server 2012 Hyper-V Host :

VM1 = Domain Controller
VM2 = Remote Desktop Server (RDS)

Both VMs are accessed via static IP through the Hyper-V host's Virtual Switch.

Problem...

After each reboot of the Hyper-V host the Domain Controller's NIC comes up fine but the RDS's NIC doesn't.  The RDS NIC "looses" its Default Gateway...the field is blank in the NIC's Network Connections > IPv4 Settings...and the only way to recover it is to disable / enable the NIC.

I've written a powershell script to disable > enable the NIC but before testing wanted to table this issue here to see if anyone has any idea of how to fix without implementing a hack / work around?

Look forward to feedback!
0
Comment
Question by:vn_tech
  • 5
  • 2
8 Comments
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 39669715
What's the guest OS?  I doubt this is a Hyper-V issue and more likely an issue with the guest OS.  I think it was the 2008 days (maybe 2008 R2) there was a bug where if you set the gateway using a certain way, I think it put a null character or something like that before the entry for the gateway in the registry.  

I think this was the blog entry... and I *THINK* I remember seeing it happen on non-SBS systems:
http://blogs.technet.com/b/sbs/archive/2010/04/22/you-may-lose-the-default-gateway-on-sbs-2008-every-time-you-reboot.aspx
0
 

Author Comment

by:vn_tech
ID: 39669844
Thanks for the feedback.  I actually saw this post or one similar yesterday and confirmed the registry is not the problem.  As for the OS everything is Server 2012...

Host = Hyper-V Host on Server 2012 Standard < we're running 2 VM's on this host
VM1 = Domain Controller (AD / DS, DNS, DHCP) on Server 2012 Std
VM2 = Remote Desktop Server on Server 2012 Std

VM1 & VM2 are accessed through a virtual switch but both have been configured with static IP addresses via their respective Local Area Connections.  Every time I reboot the Host, VM1's connection comes up fine but VM2 (Remote Destop Server) "looses" its Default Gateway rendering it inaccessible until I login to the vm directly on the server and disable / enable the adapter.  I've written a powershell script to perform this task after startup but would prefer determining root-cause & resolving rather than implementing a hack.

Any thoughts / ideas are VERY welcome as I'm stumped!
0
 
LVL 1

Expert Comment

by:SandC
ID: 39674345
We have the same problem with a pair of 2012 servers (non-HyperV). When I reboot them both one will have no gateway and the other will be fine, and it's not always the same server!

If I look in the registry the gateway is there, and in the GUI the gateway is there. IPCONFIG shows the gateway is there. However, until I do a network validate or repair it doesn't work and then I get the message "Gateway fixed".

I suspect it's to do with the Broadcom NIC teaming we're using.
0
 

Accepted Solution

by:
vn_tech earned 0 total points
ID: 39674412
I implemented a powershell workaround which based on a small amount of testing appears to be working.  The details of this workaround follows...

Powershell script :

Start-Sleep -s 10
Disable-NetAdapter -Name "VM NIC" -confirm:$false
Start-Sleep -s 10
Enable-NetAdapter -Name "VM NIC"

NOTE : I renamed our Hyper-V guest NIC to "VM NIC" and its on this NIC that our vm's run

With the script written there were three more things I needed to do to get it to work...

1. I added a task in the Task Scheduler to execute the script at system start up.
2. To make sure VM2 (our Remote Desktop Server) started up rather than resumed when the Hyper-V host was restarted / power-cycled, I had to configure VM2 to shutdown every time the Hyper-V host was shutdown. I also made sure our UPS was configured to shutdown the Hyper-V host if its battery hit the 8 minute "time-to-live" mark.
3. Lastly, I had to change powershell's execution policy from Restricted to RemoteSigned.

With the small amount of testing I've done this appears to work.  While its working, it feels like a hack so I am still VERY interested in ideas on how to fix via built-in server config.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 1

Expert Comment

by:SandC
ID: 39680499
As you suggested, bringing my NICs down and up again on every boot fixes the problem for me, even though no changes are being made.

Are you also using NIC teaming by any chance in your hypervisor?
0
 

Author Comment

by:vn_tech
ID: 39681435
@SandC

I'm running a Server 2012 STD -based Hyper-V Host on a Dell T320 which shipped with two Broadcom-based LOM's.  I configured one statically to manager the Hyper-V Host.  The other was configured as a Virtual Switch for the vm's; I believe this was configured during initial setup of the Hyper-V Host.  This Virtual Switch supports two NICs for two vm's.

After getting your note I looked in the NIC Teaming section and only see the NIC for the Hyper-V Host so assume its handled differently than NIC Teaming.
0
 

Author Comment

by:vn_tech
ID: 39689813
Since I've gotten no additional feedback / ideas I'm going to accept my workaround as the solution.  That said, the weakness in this solution is if the server shuts down abnormally VM2 will likely be paused / suspended rather than shutting down too at which point I will need to manually execute the script to recover its NIC.
0
 

Author Closing Comment

by:vn_tech
ID: 39702862
Its a workaround that will not work in every situation.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

What to do when Windows Update is not working correctly? What tools can I use to detect the cause of the malfunction problem? What does this numeric error code mean? These and other questions that you have been asking in the past are answered here (…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now