{"id":44,"date":"2009-05-04T22:06:33","date_gmt":"2009-05-04T20:06:33","guid":{"rendered":"http:\/\/46.105.150.90\/tstnunix\/?p=44"},"modified":"2009-05-04T22:06:33","modified_gmt":"2009-05-04T20:06:33","slug":"ntp-things","status":"publish","type":"post","link":"https:\/\/nunix.fr\/?p=44","title":{"rendered":"Ntp things : synchronize your date &#8230; with Xen"},"content":{"rendered":"<p>{jcomments on}To keep your system clock accurate, it exists the ntp protocol : \u00ab\u00a0<a href=\"http:\/\/en.wikipedia.org\/wiki\/Network_Time_Protocol\">NTP<\/a>\u00ab\u00a0.<\/p>\n<p>You can manage and update your system clock by hand, thanks to the command \u00ab\u00a0ntpdate\u00a0\u00bb <\/p>\n<blockquote>\n<pre># date; ntpdate ntp.ubuntu.com ntp.univ-lyon1.fr ; date<br \/> Tue May  5 22:38:16 CEST 2009<br \/> 5 May 22:38:17 ntpdate[12966]: step time server 91.189.94.4 offset -266.989213 sec<br \/> Tue May  5 22:33:50 CEST 2009<\/pre>\n<\/blockquote>\n<p>Or you can let a deamon do that work for you.   <!--more--> <\/p>\n<pre># apt-get install ntp<\/pre>\n<p>The configuration file for the daemon is \/etc\/ntp.conf. I just added two servers to maximize the <span>accuracy.<\/span><\/p>\n<blockquote>\n<pre># echo -e \"server canon.inria.fr\\nserver ntp.univ-lyon1.fr\"  &gt;&gt; \/etc\/ntp.conf<br \/># \/etc\/init.d\/ntp restart<\/pre>\n<\/blockquote>\n<p> It&rsquo;s really simple to manage your system time, but I had trouble for two days with ntpdate. I couldn&rsquo;t syncrhonize my date, even if the command told me \u00ab\u00a0step time server blabla offset -blabla\u00a0\u00bb. Really <span class=\"clickable\">annoying, and fortunately, I remember my system was a Xen client. So I searched this way. <\/span><\/p>\n<p>You have to say : \u00ab\u00a0my Xen client date is independant from the host\u00a0\u00bb :<\/p>\n<blockquote>\n<pre># set independent_wallclock<br \/># echo 1 &gt; \/proc\/sys\/xen\/independent_wallclock<\/pre>\n<\/blockquote>\n<p> Then you can run\u00a0 ntpdate, or let your deamon synchronize the system. It works!!!! <\/p>\n<p>Finally, I found many useful tips while trying to correct the xen issue.<\/p>\n<ul>\n<li>when the command ntpdate runs successfully, you may notice it says sometime \u00ab\u00a0step time server\u00a0\u00bb, and sometime \u00ab\u00a0adjust time server\u00a0\u00bb. There is a BIG difference between these sentences. The first case indicates ntpdate has used the settimeofday() routine when the second case indicates the time was updated with adjtime() system call. (man ntpdate)<\/li>\n<li>To evaluate your offset with real time, and not change your system date, just run ntpdate with the option -d. This debug mode won&rsquo;t modify your date. <\/li>\n<\/ul>\n<p>Hope this will help someone.<\/p>\n<p>Gabriel <\/p>\n<p>Sources for the Xen bug : <\/p>\n<ul>\n<li><a href=\"http:\/\/www.kaotonik.net\/en\/home\/thk\/ntpdate-on-linux-xen-virtual-server\">http:\/\/www.kaotonik.net\/en\/home\/thk\/ntpdate-on-linux-xen-virtual-server<\/a><\/li>\n<li><a href=\"http:\/\/bliki.rimuhosting.com\/space\/knowledgebase\/linux\/xen\">http:\/\/bliki.rimuhosting.com\/space\/knowledgebase\/linux\/xen<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>{jcomments on}To keep your system clock accurate, it exists the ntp protocol : \u00ab\u00a0NTP\u00ab\u00a0. You can manage and update your system clock by hand, thanks to the command \u00ab\u00a0ntpdate\u00a0\u00bb # date; ntpdate ntp.ubuntu.com ntp.univ-lyon1.fr ; date Tue May 5 22:38:16 CEST 2009 5 May 22:38:17 ntpdate[12966]: step time server 91.189.94.4 offset -266.989213 sec Tue May &hellip; <a href=\"https:\/\/nunix.fr\/?p=44\" class=\"more-link\">Continuer la lecture<span class=\"screen-reader-text\"> de &laquo;&nbsp;Ntp things : synchronize your date &#8230; with Xen&nbsp;&raquo;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-administration"],"_links":{"self":[{"href":"https:\/\/nunix.fr\/index.php?rest_route=\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nunix.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nunix.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nunix.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nunix.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=44"}],"version-history":[{"count":0,"href":"https:\/\/nunix.fr\/index.php?rest_route=\/wp\/v2\/posts\/44\/revisions"}],"wp:attachment":[{"href":"https:\/\/nunix.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nunix.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nunix.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}