NTP server and client

Posted on Mon 21 March 2011 by Pavlo Khmel

OS: RHEL6
Protpcol: UDP
Default port: 123

NTP installed by default.

System A (server), IP 10.10.10.1

Edit /etc/ntp.conf:

# Hosts on local network are less restricted.
restrict 10.10.10.0 mask 255.255.255.0 nomodify notrap
. . .
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10

Autostart and run:

chkconfig ntpd on
service ntpd start

System B (client), IP 10.10.10.4

Add to /etc/ntp.conf:

server 10.10.10.1

Check time on server:

ntpdate 10.10.10.1

Update time from server:

ntpdate -u 10.10.10.1

Autostart and run:

chkconfig ntpd on
service ntpd start

Verify:

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 10.10.10.1      LOCAL(0)        11 u   57   64    3    1.900  3598849   7.946
[/bahs]
Notes:
1. ntpdate - work if service ntpd is down.
2. After restart of NTP service. You can see error:

ntpdate 10.10.10.1

21 Mar 22:22:34 ntpdate[2421]: no server suitable for synchronization found  

After 1 minute it should be ok.