|
Softwares ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Main /
ConfiguringNTPMain.ConfiguringNTP HistoryHide minor edits - Show changes to output Changed lines 41-42 from:
'''If you to:
'''If you want to choose NTP servers other than the defaults''' Changed line 59 from:
(:table border=1 width= to:
(:table border=1 width=70% bgcolor=#cccc99 cellspacing=0 :) November 13, 2011, at 09:21 AM
by - Configuring NTP
Added lines 1-113:
(:Google1:) (:Googlemm:) ---- !!Using NTP to sync your server time. ---- NTP lets you automatically sync your system time with a remote server. '''Installing NTP''' (:table border=1 width=70% bgcolor=#cccc99 cellspacing=0 :) (:cellnr:) [@ [centos@centos ~]$ sudo yum install ntp [sudo] password for centos: Loaded plugins: fastestmirror, refresh-packagekit Loading mirror speeds from cached hostfile - - Setting up Install Process Package ntp-4.2.4p8-2.el6.x86_64 already installed and latest version Nothing to do [centos@centos ~]$ @] (:tableend:) '''Check NTPD Status''' (:table border=1 width=70% bgcolor=#cccc99 cellspacing=0 :) (:cellnr:) [@ [centos@centos ~]$ chkconfig --list |grep ntpd ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off [centos@centos ~]$ /etc/init.d/ntpd status ntpd (pid 1513) is running... [centos@centos ~]$ @] (:tableend:) '''If you wnat to choose NTP servers other than the defaults''' (:table border=1 width=70% bgcolor=#cccc99 cellspacing=0 :) (:cellnr:) [@ [centos@centos ~]$ grep ^server /etc/ntp.conf server 0.rhel.pool.ntp.org server 1.rhel.pool.ntp.org server 2.rhel.pool.ntp.org [centos@centos ~]$ @] (:tableend:) '''NTP port 123''' NTP uses UDP port 123 to conduct its business, either connecting out to another NTP server or accepting incoming connections. (:table border=1 width=80% bgcolor=#cccc99 cellspacing=0 :) (:cellnr:) [@ [centos@centos ~]$ sudo netstat -antupl|grep ntp udp 0 0 10.0.2.15:123 0.0.0.0:* 1513/ntpd udp 0 0 127.0.0.1:123 0.0.0.0:* 1513/ntpd udp 0 0 0.0.0.0:123 0.0.0.0:* 1513/ntpd udp 0 0 fe80::a00:27ff:fe75:123 :::* 1513/ntpd udp 0 0 ::1:123 :::* 1513/ntpd udp 0 0 :::123 :::* 1513/ntpd @] (:tableend:) '''The ntpdate command will sync your clock with an NTP server''' The ntpdate command will not run when the NTP server is running, if you run then it says the NTP socket is in use, exiting. (:table border=1 width=70% bgcolor=#cccc99 cellspacing=0 :) (:cellnr:) [@ [centos@centos ~]$ grep ^server /etc/ntp.conf server 0.rhel.pool.ntp.org server 1.rhel.pool.ntp.org server 2.rhel.pool.ntp.org [centos@centos ~]$ sudo ntpdate 0.rhel.pool.ntp.org [sudo] password for centos: 13 Nov 19:15:42 ntpdate[10611]: the NTP socket is in use, exiting [centos@centos ~]$ @] (:tableend:) '''Stop NTP and then run ntpdate''' (:table border=1 width=70% bgcolor=#cccc99 cellspacing=0 :) (:cellnr:) [@ [centos@centos ~]$ sudo /etc/init.d/ntpd stop Shutting down ntpd: [ OK ] [centos@centos ~]$ sudo ntpdate 0.rhel.pool.ntp.org 13 Nov 19:16:58 ntpdate[10636]: adjust time server 123.108.200.163 offset -0.285447 sec [centos@centos ~]$ sudo /etc/init.d/ntpd start Starting ntpd: [ OK ] [centos@centos ~]$ pgrep ntp 10643 [centos@centos ~]$ @] (:tableend:) '''Reference''': http://support.ntp.org/bin/view/Support/GettingStarted ---- (:Google1:) (:Googlemm:) |