NTP
SERVER
Install NTP Server
#
yum install ntp
Setup Restrict values in
ntp.conf
# vi /etc/ntp.conf
# Permit
time synchronization with our time source, but do not
# Permit
the source to query or modify the service on this system.
restrict
default kod nomodify notrap nopeer noquery
restrict
-6 default kod nomodify notrap nopeer noquery
Allow Only Specific
Clients
# vi /etc/ntp.conf
restrict
172.16.0.0 mask 255.255.0.0 nomodify notrap
If the localhost needs to have the full access to query or
modify, add the following line to /etc/ntp.conf
restrict 127.0.0.1
Add Local Clock as Backup
# vi /etc/ntp.conf
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
Setup NTP Log Parameters
Specify the drift file and the log file
location in your ntp.conf file
# vi /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log
Start the NTP Server
# service ntpd start
CLIENT
Modify ntp.conf on NTP Client
To synchronize the time of your local Linux client machine with
NTP server, edit the /etc/ntp.conf file on the client side. Here is an example
of how the sample entries look like. In the following example, you are
specifying multiple servers to act as time server, which is helpful when one of
the timeservers fails.
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
iburst: After every poll, a burst of eight packets is sent instead
of one. When the server is not responding, packets are sent 16s interval. When
the server responds, packets are sent every 2s.
Edit
your ntp.conf to reflect appropriate entries for your own NTP server.
server
172.16.1.98 prefer
prefer: If this option is specified that server is preferred over
other servers. A response from the preferred server will be discarded if it
differs significantly different from other server’s responses.
Start the NTP Daemon
#
/etc/init.d/ntp start
Check the NTP Status
#
ntpq –p
Set Local Date and Time
#
ntpdate –u 172.16.1.98
# ntpdc –c sysinfo
Comments
Post a Comment