ntp

[root@server-rhel6 ~]# yum install ntp -y

[root@server-rhel6 ~]# date
Tue Feb 23 16:43:07 PST 2016

vim /etc/ntpd.conf ====> comment this lines first and add required lines

#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst

restrict 172.16.28.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0 #local clock
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

[root@server-rhel6 ~]# date -s “1 JAN 2001 12:00:00”
Mon Jan  1 12:00:00 PST 2001

[root@server-rhel6 ~]# date
Mon Jan  1 12:00:02 PST 2001

[root@server-rhel6 ~]# service ntpd restart
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:
[  OK  ]
[root@server-rhel6 ~]# ntpq -p
remote           refid      st t when poll reach   delay   offset  jitter
========================================================================
*LOCAL(0)        .LOCL.          10 l    5   64    1    0.000    0.000   0.000
[root@server-rhel6 ~]# ntpdc -c sysinfo
system peer:          LOCAL(0)
system peer mode:     client
leap indicator:       00
stratum:              11
precision:            -23
root distance:        0.00000 s
root dispersion:      7.94789 s
reference ID:         [127.127.1.0]
reference time:       bdfb604b.174c634d  Mon, Jan  1 2001 12:00:11.091
system flags:         auth monitor ntp kernel stats
jitter:               0.000000 s
stability:            0.000 ppm
broadcastdelay:       0.000000 s
authdelay:            0.000000 s

[root@server-rhel6 ~]# iptables -I INPUT -p udp –dport 123 -j ACCEPT

[root@server-rhel6 ~]#service iptables save

[root@server-rhel6 ~]#service iptables reload

[root@server-rhel6 ~]# chkconfig ntpd on

————————–Client side—————————————–

[root@rhel6-client1 ~]# date
Tue Feb 23 16:43:13 PST 2016

[root@rhel6-client1 ~]# vim /etc/ntp.conf
comment this lines first and add required lines

#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst

server 172.16.28.150 prefer
restrict 172.16.28.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0 #local clock
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

[root@rhel6-client1 ~]# service ntpd restart
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:                                             [  OK  ]

[root@rhel6-client1 ~]# ntpdate -u 172.16.28.150
1 Jan 12:01:06 ntpdate[26161]: step time server 172.16.28.150 offset -601194011.739872 sec

[root@rhel6-client1 ~]# date 
Mon Jan  1 12:01:17 PST 2001

[root@rhel6-client1 ~]# ntpq -p
remote           refid      st t when poll reach   delay   offset  jitter
========================================================================
172.16.28.150   LOCAL(0)        11 u   37   64  377    0.741  -601194 6011940
*LOCAL(0)        .LOCL.          10 l   41   64   37    0.000    0.000   0.000
[root@rhel6-client1 ~]# ntpdc -c sysinfo
system peer:          LOCAL(0)
system peer mode:     client
leap indicator:       00
stratum:              11
precision:            -23
root distance:        0.00000 s
root dispersion:      0.44897 s
reference ID:         [127.127.1.0]
reference time:       bdfb61eb.66f71ff3  Mon, Jan  1 2001 12:07:07.402
system flags:         auth monitor ntp kernel stats
jitter:               0.000000 s
stability:            0.000 ppm
broadcastdelay:       0.000000 s
authdelay:            0.000000 s

[root@rhel6-client1 ~]# ntpdate -u 172.16.28.150
1 Jan 12:08:04 ntpdate[26210]: adjust time server 172.16.28.150 offset 0.000400 sec
[root@rhel6-client1 ~]# date
Mon Jan  1 12:08:07 PST 2001

[root@rhel6-client1 ~]# chkconfig ntpd on

Advertisements
Posted in: ntp

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s