Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Hyper-V VM looses Gateway IP after each reboot

Posted on 2013-11-21
8
Medium Priority
?
1,548 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 96

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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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
 
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 (…
Optimized for private cloud infrastructures and datacenters, Nano Server is minimalistic, yet super-efficient, OS for services such as Hyper-V and Hyper-V cluster. Learn how you can easily deploy Nano Server and unlock its power!
In this Micro Tutorial viewers will learn how to restore their server from Bare Metal Backup image created with Windows Server Backup feature. As an example Windows 2012R2 is used.
In this Micro Tutorial viewers will learn how to restore single file or folder from Bare Metal backup image of their system. Tutorial shows how to restore files and folders from system backup. Often it is not needed to restore entire system when onl…

604 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