
	<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.title=gentoo%3A%3A+NTP+setup&amp;rft.aulast=Stavrakis&amp;rft.aufirst=Modestos&amp;rft.subject=linux&amp;rft.source=%CE%BC%CE%BF.&amp;rft.date=2012-10-22&amp;rft.type=blogPost&amp;rft.format=text&amp;rft.identifier=https://xylem.aegean.gr/~modestos/mo.blog/gentoo-setup-time/&amp;rft.language=English"></span>
{"id":5130,"date":"2012-10-22T21:18:03","date_gmt":"2012-10-22T19:18:03","guid":{"rendered":"http:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/?p=5130"},"modified":"2016-01-12T21:08:57","modified_gmt":"2016-01-12T19:08:57","slug":"gentoo-setup-time","status":"publish","type":"post","link":"https:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/gentoo-setup-time\/","title":{"rendered":"gentoo:: NTP setup"},"content":{"rendered":"<h3>Install<\/h3>\n<p>The first thing to do is install the NTP server. Grab the package by running:<\/p>\n<pre># emerge --sync\r\n# emerge ntp<\/pre>\n<h3>Start the service<\/h3>\n<p>To make sure the NTP service starts after installing it, run:<\/p>\n<pre># \/etc\/init.d\/ntpd start<\/pre>\n<h3>The ntp.conf file<\/h3>\n<p>The NTP configuration file can be found at:<\/p>\n<pre># nano -w \/etc\/ntp.conf<\/pre>\n<p>There are a few settings that can be changed in there, but for most people the only settings of interest would be any &#8220;server&#8221; entries. The default for Gentoo looks like:<\/p>\n<pre>server ntp.aegean.gr\r\n# Pools for Gentoo users\r\nserver 0.gentoo.pool.ntp.org\r\nserver 1.gentoo.pool.ntp.org\r\nserver 2.gentoo.pool.ntp.org\r\nserver 3.gentoo.pool.ntp.org\r\n\r\n# you should not need to modify the following paths\r\ndriftfile\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/var\/lib\/ntp\/ntp.drift\r\n\r\n# To deny other machines from changing the\r\n# configuration but allow localhost:\r\nrestrict default nomodify nopeer\r\nrestrict 127.0.0.1<\/pre>\n<h3>Time zones<\/h3>\n<p>Occasionally, your timezone settings might be incorrect. For example it could be set to EST when it should be CST. There are a couple of ways to set the timezone:<\/p>\n<ul>\n<li>Run tzselect (comes with <a href=\"http:\/\/gentoo-portage.com\/Search?search=sys-libs\/timezone-data\" rel=\"nofollow\">sys-libs\/timezone-data<\/a>):<\/li>\n<\/ul>\n<div>tzselect<\/div>\n<p><strong>or<\/strong><\/p>\n<ul>\n<li>Copy the timezone info manually:<\/li>\n<\/ul>\n<div>cp \/usr\/share\/zoneinfo\/Europe\/Athens \/etc\/localtime<\/div>\n<div><\/div>\n<h3>Testing with ntpdate<\/h3>\n<p>Before using an external NTP server to sync your time you should make sure you can actually connect to the server from your machine. Fortunately there&#8217;s a tool for that included with the NTP server named &#8220;ntpdate&#8221;.<\/p>\n<p>The ntpdate command will sync your clock with an NTP server. It&#8217;s similar to what the NTP server does on a regular basis.<\/p>\n<p>You usually shouldn&#8217;t use ntpdate for anything other than testing purposes unless you want to make sure your clock only syncs at particular times of day (by using cron to run ntpdate just at those times). Otherwise you&#8217;re better off running the NTP server because it will use less bandwidth and keep your time more accurate (by tracking your clock&#8217;s drift over time and adjusting accordingly).<\/p>\n<p>The ntpdate command will not run when the NTP server is running. If you run ntpdate and get a response like &#8220;the NTP socket is in use&#8221;, that means your NTP server is running. Stop it with the command:<\/p>\n<pre>sudo \/etc\/init.d\/ntpd stop<\/pre>\n<p>You can now run ntpdate with the server you want to sync against as an argument. For example, to tell ntpdate to try and sync with &#8220;pool.ntp.org&#8221;, run:<\/p>\n<pre>sudo <strong>ntpdate<\/strong> pool.ntp.org<\/pre>\n<p>When you&#8217;re finished testing remember to start NTP back up again:<\/p>\n<pre>sudo \/etc\/init.d\/ntpd start<\/pre>\n<p>&nbsp;<\/p>\n<h2>Finalize synchronization<\/h2>\n<p>To verify that your system time has changed correctly, run<\/p>\n<div>date<\/div>\n<p>Also, consider to synchronize your hardware time with your system time (for example, here, upon reboot, the time went again out of sync). To store the Linux date and time in CMOS, issue the following command<\/p>\n<div>hwclock &#8211;systohc<\/div>\n<p>Again, to check your work, run:<\/p>\n<div>hwclock &#8211;show<\/div>\n<pre><\/pre>\n<pre><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>gentoo:: NTP setup<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[524],"tags":[553,212,688,689],"class_list":["post-5130","post","type-post","status-publish","format-standard","hentry","category-linux-technology","tag-gentoo","tag-linux","tag-ntp","tag-time"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pzkzw-1kK","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/wp-json\/wp\/v2\/posts\/5130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/wp-json\/wp\/v2\/comments?post=5130"}],"version-history":[{"count":3,"href":"https:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/wp-json\/wp\/v2\/posts\/5130\/revisions"}],"predecessor-version":[{"id":5256,"href":"https:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/wp-json\/wp\/v2\/posts\/5130\/revisions\/5256"}],"wp:attachment":[{"href":"https:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/wp-json\/wp\/v2\/media?parent=5130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/wp-json\/wp\/v2\/categories?post=5130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xylem.aegean.gr\/~modestos\/mo.blog\/wp-json\/wp\/v2\/tags?post=5130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}