This week I had some spare time to finally deal with some things that should have been dealt with a long time ago. Things like checking my backup and performing a restore, tuning various things in my Home Automation system, and all those other things you can’t (or don’t want) to spend time on too much, but that still have to be done sometime. One of those things is time synchronization; keeping all the machines running with the same time.
One of the worst performing virtual machines regarding time synchronization is my CentOS based firewall. I started using this firewall by converting a VMWare virtual appliance to Hyper-V with the vmdk2vhd tool and it has been running flawless ever since – but with 1 irritating issue: time keeping. 2 seconds per minute is a lot! And it looked like the issue got worse when I switched from Windows Server 2008 to 2008R2 in March of this year. Let’s fix this!
I’m neither a Linux nor a Windows expert – I like to think I used to be in the days where Windows 2000 and Linux distro’s like FC3 were considered up-to-date, but since then I gradually lost track of things, primarily due to the fact that I wasn’t spending enough time with these OSes anymore. I found other hobbys ;-). vi is a nightmare for me (on Linux I prefer joe, a Wordstar-like editor), just like I have a big dislike of the recent versions of Windows Explorer – on the other hand, I do know how to configure and use Apache, IIS, Postfix, MySQL and MS SQL Server and such.
So now I had to dig into something fuzzy as time synchronization: NTP, peers, offset, jitter, delays… OMG, why doesn’t it just work like it is supposed to? Well, it seemed the NTP server running on my firewall gave up on syncing very quickly because of the very large time shift of 2 seconds per minute, so I had to find a way to correct that and help the NTP server a bit. And as it happens quite often, I Googled for a solution to my problem and hey, I’m not the only one experiencing this, what a surprise!
Even the exact combination of Host OS and guest OS that I am using is mentioned a lot, like here for example. After reading some more pages regarding this issue it seemed I only had to do some small adjustments here and there and my NTP server would be fine:
- Disabling Time Synchronization in the Hyper-V Integration Services;
- Add the parameters “notsc divider=10” to the kernel line in grub.conf;
- Add “tinker panic 0” as first line in ntp.conf;
- Remove the lines “server 127.127.1.0” and “fudge 127.127.1.0 stratum 10” from ntp.conf;
- Restart the VM.