Today we need to install ntp server. Lets do it on Centos 6.6. The same process will be for Centos 7.
1. Install NTP Server
First, install NTP package on your server using the appropriate repository:
#yum install ntp
2. Setup Restrict values in ntp.conf
Modify the /etc/ntp.conf file to make sure it has the following two restrict lines.
The first restrict line allows other clients to query your time server. This restrict line has the following parameters
- noquery prevents dumping status data from ntpd.
- notrap prevents control message trap service.
- nomodify prevents all ntpq queries that attempts to modify the server.
- nopeer prevents all packets that attempts to establish a peer association.
- Kod – Kiss-o-death packet is to be sent to reduce unwanted queries
The value -6 in the second line allows forces the DNS resolution to the IPV6 address resolution. For more information on the access parameters list, Please refer to documentation on “man ntp_acc”
3. Allow Only Specific Clients
To only allow machines on your own network to synchronize with your NTP server, add the following restrict line to your /etc/ntp.conf file:
If the localhost needs to have the full access to query or modify, add the following line to /etc/ntp.conf
4. Setup NTP Log Parameters
Specify the drift file and the log file location in your ntp.conf file
driftfile is used to log how far your clock is from what it should be, and slowly ntp should lower this value as time progress.
5. Start NTP Server
#service ntp start
#chkconfig ntpd on