{"id":496,"date":"2010-03-02T15:51:06","date_gmt":"2010-03-02T23:51:06","guid":{"rendered":"http:\/\/greg.porter.name\/wordpress\/?p=496"},"modified":"2010-03-09T16:14:27","modified_gmt":"2010-03-10T00:14:27","slug":"adventures-in-windows-time","status":"publish","type":"post","link":"https:\/\/greg.porter.name\/wordpress\/?p=496","title":{"rendered":"Adventures in Windows Time"},"content":{"rendered":"<p style=\"margin: 0pt; font-size: 12px;\">\n<p style=\"margin: 0pt; font-size: 12px;\"><strong><a href=\"https:\/\/www.quotes.net\/quote\/9385\">\u201cThe only reason for time is so that everything doesn&#8217;t happen at once.\u201d<\/a><\/strong><\/p>\n<p>At work, I have an integrated authentication system based on Windows Active Directory.\u00a0 All clients, Linux, Unix, and Windows, use Active Directory for user names and passwords.\u00a0 Active Directory is actually a good implementation of Kerberos.\u00a0 It does pretty good LDAP as well.\u00a0 <a href=\"https:\/\/blog.scottlowe.org\/tag\/interoperability\/\">I used some of Scott Lowe&#8217;s interoperability blog recipes to get this to work<\/a>, <a href=\"https:\/\/blog.scottlowe.org\/2007\/01\/15\/linux-ad-integration-version-4\/\">namely this post for Linux<\/a>, and <a href=\"https:\/\/blog.scottlowe.org\/2007\/04\/25\/solaris-10-ad-integration-version-3\/\">this one for Solaris<\/a>.<\/p>\n<p>One requirement for a reliable Kerberos service is that every clock on every participating machine has to be synchronized.\u00a0 By default Windows domain controllers act as Network Time Protocol (NTP) servers, and Windows clients know to sync with them.\u00a0 We configure our Linux and Unix machines to use them as well.<\/p>\n<p>There&#8217;s some issues with using Windows domain controllers as NTP servers&#8230;<\/p>\n<p><!--more--> namely, that their time service was designed to just be &#8220;good enough&#8221; to keep the clocks within the 5 minutes required for Kerberos. \u00a0By default, they sync with time.microsoft.com, <a href=\"https:\/\/www.pcworld.com\/article\/76744\/is_microsofts_time_warped.html\">which isn&#8217;t particularly accurate<\/a>.<\/p>\n<p><a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/cc773013%28WS.10%29.aspx\">I&#8217;m not just talking smack about Microsoft, that&#8217;s what they themselves say.<\/a><br \/>\n&#8220;Windows Time service is not an exact implementation of the Network Time Protocol (NTP)&#8230;&#8221;<\/p>\n<p>So the real issue is getting the first domain controller (not called the primary domain controller any more, but in the case of NTP anyway, it still acts like a PDC) set to get its time from an authoritative source.\u00a0 By default, on our Windows 2008 domain controller, it seems to use its hardware clock, which wanders around all over the place, time wise.\u00a0 The rest of the domain controllers by default sync against the first one.<\/p>\n<p>The real solution is to get some Windows friendly hardware attached to the first domain controller, that really does sync with a reliable time source, like the GPS satellites.\u00a0 Where I used to work I bought a actual stratum one time source like <a href=\"https:\/\/www.symmetricom.com\/products\/ntp-servers\/ntp-network-appliances\/SyncServer-S250\">this one from Symmetricom<\/a>.\u00a0 <span id=\"OBJ_PREFIX_DWT23\"> <\/span>It worked fine.<\/p>\n<p>So the basic idea is to get the first domain controller (PDC) to sync reliably to a network time source, like 0.us.pool.ntp.org.\u00a0 Then the other domain controllers will be OK.\u00a0 All clients should be pointed at the domain controllers for their time.\u00a0 Micrsoft has lots of Technet articles on this <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/cc731790%28WS.10%29.aspx\">like this one for 2008<\/a>.<\/p>\n<p>Supposedly on the &#8220;PDC&#8221; (well, first domain controller, anyway) then run this command in a command window as an admin:<\/p>\n<pre><span style=\"font-size: 85%;\">net time \/setsntp:\"0.us.pool.ntp.org  1.us.pool.ntp.org  2.us.pool.ntp.org\"\r\n<\/span><\/pre>\n<p>I&#8217;m not clear if this &#8220;sticks&#8221;, that is, stays set after a reboot, or if it actually reliably keeps the domain controller synced to &#8220;real&#8221; time.\u00a0 I&#8217;ll update this post as I try it in real life.<\/p>\n<p>On linux clients, \/etc\/ntp.conf should have:<\/p>\n<pre>server dc1.yourdomain.com<\/pre>\n<pre>server dc2.yourdomain.com<\/pre>\n<pre>server dc3.yourdomain.com<\/pre>\n<p>A happy linux client should look something like:<\/p>\n<p>-bash-3.2$ \/usr\/sbin\/ntpq -p<br \/>\nremote\u00a0\u00a0\u00a0\u00a0 refid\u00a0\u00a0\u00a0 st t when poll reach\u00a0\u00a0 delay\u00a0\u00a0 offset\u00a0 jitter<br \/>\n=================================================================<br \/>\ndc1.yourd .LOCL.\u00a0\u00a0\u00a0\u00a0 1 u\u00a0\u00a0 13\u00a0\u00a0 64\u00a0 377\u00a0\u00a0\u00a0 1.131\u00a0\u00a0 33.984\u00a0 10.680<br \/>\ndc2.yourd dc1.yourd\u00a0 2 u\u00a0\u00a0 24\u00a0\u00a0 64\u00a0 377\u00a0\u00a0\u00a0 0.994\u00a0\u00a0\u00a0 4.629\u00a0\u00a0 8.372<br \/>\ndc3.yourd dc1.yourd\u00a0 2 u\u00a0\u00a0 19\u00a0\u00a0 64\u00a0 377\u00a0\u00a0\u00a0 1.209\u00a0\u00a0 12.256\u00a0\u00a0 5.845<\/p>\n<p>dc1 is listed as stratum 1 (st 1) which means that it is the authoritative time source (and is considered atomic clock accurate). \u00a0We are lying, as dc1&#8217;s&#8217;s reference is &#8220;LOCL&#8221; which means its own hardware clock, which is some silly Dell BIOS clock, not a real time standard. \u00a0Oh well.<\/p>\n<p>dc2 and dc3 are listed a stratum 2, who reference dc1.<\/p>\n<p>The &#8220;offset&#8221; is the amount of milliseconds that your server&#8217;s clock varies from the source. \u00a033 milliseconds isn&#8217;t so bad.<\/p>\n<p>So to recap:<br \/>\nMake sure the clock on the PDC matches &#8220;real&#8221; time, like 0.us.pool.ntp.org. \u00a0This has to be manually done every so often. \u00a0Directions at <span id=\"OBJ_PREFIX_DWT25\"><span id=\"OBJ_PREFIX_DWT26\"><a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/cc731790%28WS.10%29.aspx\" target=\"_blank\">https:\/\/technet.microsoft.com\/en-us\/library\/cc731790%28WS.10%29.aspx<\/a><\/span><\/span>.<br \/>\nAs an admin in a cmd window, do:<br \/>\nw32tm \/config \/syncfromflags:manual \/manualpeerlist:0.us.pool.ntp.org<br \/>\nw32tm \/config \/update<br \/>\n(Other dc&#8217;s know to follow the PDC. \u00a0They automatically sync to algol.)<\/p>\n<p>Make sure esx servers are set to PDC time.<br \/>\nAs root (probably need to be on the console, ssh as root is turned off by default in esx):<br \/>\nservice ntpd stop<br \/>\nntpdate dc1<br \/>\nntpdate dc1 (should be darn close the second time, just milliseconds off)<br \/>\nservice ntpd start<\/p>\n<p>Make sure client machines are set to PDC time:<br \/>\nAs root:<br \/>\nservice ntpd stop<br \/>\nntpdate algol<br \/>\nntpdate algol (should be darn close the second time, just milliseconds off)<br \/>\nservice ntpd start<\/p>\n<p>Make sure Solaris servers are set to PDC time:<br \/>\nAs root:<br \/>\nsvcadm disable ntp<br \/>\nntpdate algol<br \/>\nntpdate algol (should be darn close the second time, just milliseconds off)<br \/>\nsvcadm enable ntp<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u201cThe only reason for time is so that everything doesn&#8217;t happen at once.\u201d At work, I have an integrated authentication system based on Windows Active Directory.\u00a0 All clients, Linux, Unix, and Windows, use Active Directory for user names and passwords.\u00a0&hellip; <a href=\"https:\/\/greg.porter.name\/wordpress\/?p=496\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-496","post","type-post","status-publish","format-standard","hentry","category-content"],"_links":{"self":[{"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=496"}],"version-history":[{"count":35,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/496\/revisions"}],"predecessor-version":[{"id":531,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/496\/revisions\/531"}],"wp:attachment":[{"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greg.porter.name\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}