Top Menu

Saturday, June 22, 2013

Configure NTP Server and NTP Client

NTP Server Configuration:

[root@santst01 ~]# date 110516002010
[root@santst01 ~]# vim /etc/ntp.conf
[root@santst01 ~]# cat /etc/ntp.conf |grep -v ^#
restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
keys /etc/ntp/keys
[root@santst01 ~]# chkconfig ntpd on
[root@santst01 ~]# /etc/init.d/ntpd restart
Shutting down ntpd: [ OK ]
Starting ntpd: [ OK ]
[root@santst01 ~]#
[root@node2 ~]# cat /etc/ntp.conf |grep -v ^#
restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
server 192.168.11.10
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
[root@node1 ~]# date
Sat Nov 5 16:02:58 BDT 2010

NTP Client Configuration:

[root@node1 ~]# ntpdate -d 192.168.11.10
6 Nov 02:41:19 ntpdate[3882]: ntpdate 4.2.2p1@1.1570-o Thu May 14 13:01:42 UTC 2009 (1)
Looking for host 192.168.56.10and service ntp
host found : santst01.example.com
transmit(192.168.11.10)
receive(192.168.11.10)
transmit(192.168.11.10)
receive(192.168.11.10)
transmit(192.168.11.10)
receive(192.168.11.10)
transmit(192.168.11.10)
receive(192.168.11.10)
transmit(192.168.11.10)
server 192.168.11.10, port 123
stratum 11, precision -20, leap 00, trust 000
refid [192.168.11.10], delay 0.02577, dispersion 0.00000
transmitted 4, in filter 4
reference time: d25f886d.6d47e00e Sat, Nov 5 2010 16:03:25.426
originate timestamp: d25f887e.4b2883ce Sat, Nov 5 2010 16:03:42.293
transmit timestamp: d2601def.fbb3636f Sun, Nov 6 2010 2:41:19.983
filter delay: 0.02597 0.02583 0.02579 0.02577
0.00000 0.00000 0.00000 0.00000
filter offset: -38257.6 -38257.6 -38257.6 -38257.6
0.000000 0.000000 0.000000 0.000000
delay 0.02577, dispersion 0.00000
offset -38257.689706
6 Nov 02:41:19 ntpdate[3882]: step time server 192.168.56.10offset -38257.689706 sec
[root@node1 ~]# ntpdate -u 192.168.11.10
5 Nov 16:03:46 ntpdate[3884]: step time server 192.168.56.10offset -38257.689764 sec
[root@node1 ~]# date
Sat Nov 5 16:03:58 BDT 2010
[root@node01]# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
*192.168.56.10LOCAL(0) 11 u 204 256 377 0.272 -0.003 0.048
[root@node01]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*santst01.example.co LOCAL(0) 11 u 217 256 377 0.272 -0.003 0.048
[root@node02]# ntpstat
synchronised to NTP server (192.168.11.10) at stratum 12
time correct to within 17 ms
polling server every 256 s