{"id":1885,"date":"2012-02-07T22:33:34","date_gmt":"2012-02-07T14:33:34","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=1885"},"modified":"2023-04-28T09:49:56","modified_gmt":"2023-04-28T09:49:56","slug":"how-to-install-and-configure-ntp-server-on-centos-6-2","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-and-configure-ntp-server-on-centos-6-2\/","title":{"rendered":"How to Install and Configure NTP Server On CentOS 6.2"},"content":{"rendered":"<p>In this post, i will show you on how to configure NTP server for time adjustment. NTP, Network Time Protocol, it is an Internet protocol used to synchronize the clocks of computers or servers to some NTP server on internet or intranet.<\/p>\n<p>Install the following package using yum :<\/p>\n<ol>\n<pre class=\"code\">\n[root@centos62 ~]# yum install ntp -y\nLoaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: centos.maulvi.net\n * extras: centos.maulvi.net\n * updates: centos.maulvi.net\nSetting up Install Process\nResolving Dependencies\n--> Running transaction check\n---> Package ntp.i686 0:4.2.4p8-2.el6.centos will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n====================================================================================================\n Package       Arch           Version                          Repository                      Size\n====================================================================================================\nInstalling:\n ntp           i686           4.2.4p8-2.el6.centos             CentOS6.2-Repository           436 k\n\nTransaction Summary\n====================================================================================================\nInstall       1 Package(s)\n\nTotal download size: 436 k\nInstalled size: 1.1 M\nDownloading Packages:\nRunning rpm_check_debug\nRunning Transaction Test\nTransaction Test Succeeded\nRunning Transaction\n  Installing : ntp-4.2.4p8-2.el6.centos.i686                                                    1\/1\n\nInstalled:\n  ntp.i686 0:4.2.4p8-2.el6.centos\n\nComplete!\n<\/pre>\n<\/ol>\n<p>Once NTP is installed you need to update the configuration file, ntp.conf located in the \/etc directory :<\/p>\n<ol>\n<pre class=\"code\">\n[root@centos62 ~]# vi \/etc\/ntp.conf\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n# For more information about this file, see the man pages\n# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).\n\ndriftfile \/var\/lib\/ntp\/drift\n\n# Permit time synchronization with our time source, but do not\n# permit the source to query or modify the service on this system.\nrestrict default kod nomodify notrap nopeer noquery\nrestrict -6 default kod nomodify notrap nopeer noquery\n\n# Permit all access over the loopback interface.  This could\n# be tightened as well, but to do so would effect some of\n# the administrative functions.\nrestrict 127.0.0.1\nrestrict -6 ::1\n\n# Hosts on local network are less restricted.\nrestrict 192.168.1.0 mask 255.255.255.0 nomodify notrap\n\n# Use public servers from the pool.ntp.org project.\n# Please consider joining the pool (http:\/\/www.pool.ntp.org\/join.html).\nserver 0.centos.pool.ntp.org\nserver 1.centos.pool.ntp.org\nserver 2.centos.pool.ntp.org\n\n#broadcast 192.168.1.255 autokey        # broadcast server\n#broadcastclient                        # broadcast client\n#broadcast 224.0.1.1 autokey            # multicast server\n#multicastclient 224.0.1.1              # multicast client\n#manycastserver 239.255.254.254         # manycast server\n#manycastclient 239.255.254.254 autokey # manycast client\n\n# Undisciplined Local Clock. This is a fake driver intended for backup\n# and when no outside source of synchronized time is available.\n#server 127.127.1.0     # local clock\n#fudge  127.127.1.0 stratum 10\n\n# Enable public key cryptography.\n#crypto\n\nincludefile \/etc\/ntp\/crypto\/pw\n\n# Key file containing the keys and key identifiers used when operating\n# with symmetric key cryptography.\nkeys \/etc\/ntp\/keys\n\n# Specify the key identifiers which are trusted.\n#trustedkey 4 8 42\n\n# Specify the key identifier to use with the ntpdc utility.\n#requestkey 8\n\n# Specify the key identifier to use with the ntpq utility.\n#controlkey 8\n\n# Enable writing of statistics records.\n#statistics clockstats cryptostats loopstats peerstats\n<\/pre>\n<\/ol>\n<p>Start the NTP service :<\/p>\n<ol>\n<pre class=\"code\">\n[root@centos62 ~]# \/etc\/rc.d\/init.d\/ntpd start\nStarting ntpd:                                             [  OK  ]\n<\/pre>\n<\/ol>\n<p>Set NTP service start at boot :<\/p>\n<ol>\n<pre class=\"code\">\n[root@centos62 ~]# chkconfig ntpd on\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n[root@centos62 ~]# ntpq -p\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n     remote           refid      st t when poll reach   delay   offset  jitter\n==============================================================================\n 113.23.142.94   202.71.100.89    5 u   33   64    1   55.809  35573.8   0.001\n enterprise.wyne 203.129.68.14    3 u   32   64    1   55.888  35592.2   0.001\n 202.71.100.89   124.82.204.2     4 u   31   64    1   54.479  35584.8   0.001\n<\/pre>\n<\/ol>\n<p>To verify the NTP service is now running on the server using the following command : <\/p>\n<ol>\n<pre class=\"code\">\n[root@centos62 ~]# ps -ef | grep ntpd\nntp      22682     1  0 22:38 ?        00:00:00 ntpd -u ntp:ntp -p \/var\/run\/ntpd.pid -g\nroot     22696  2377  0 22:40 pts\/0    00:00:00 grep ntpd\n<\/pre>\n<\/ol>\n<p>The command should return two lines showing that the ntpd process is running and the ntpd grep process you executed<\/p>\n<ol>\n<pre class=\"code\">\n[root@centos62 ~]# service ntpd status\nntpd (pid  22682) is running...\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n[root@centos62 ~]# watch ntpq -c lpee\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\nEvery 2.0s: ntpq -c lpee                                                    Tue Feb  7 23:00:24 2012\n\n     remote           refid      st t when poll reach   delay   offset  jitter\n==============================================================================\n ns2.epiweb.com. .RMOT.          16 u    -   64    0    0.000    0.000   0.000\n zephyr.vtsv.com .INIT.          16 u    -   64    0    0.000    0.000   0.000\n<\/pre>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In this post, i will show you on how to configure NTP server for time adjustment. NTP, Network Time Protocol, it is an Internet protocol used to synchronize the clocks&#8230;<\/p>\n","protected":false},"author":6,"featured_media":1554,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2064],"tags":[1244,1253,1536,1610,1611],"class_list":["post-1885","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ntp","tag-centos","tag-centos-6-2","tag-linux","tag-ntp","tag-ntp-server"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1885","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=1885"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1885\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/1554"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=1885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=1885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=1885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}