Configuring NTP Server
What is NTP Server?
NTP or Network Time Protocol in Linux is used for atomic time synchronization on system’s clock using correct time source. There are two types of NTP sites
There are that allow the general public to synchronize with them. They are divided into two types:
It is best idea to have one server in your network to manage local time server for all devices used in network. It will create a relationship between different system events much easier and reduces internet bandwidth usage because of NTP traffic and reduces needs for managing firewalls rules and regulations for every NTP client on a network.
Downloading and Installing NTP Package
Mostly Linux all Linux packages are available in RPM format and you can easily download these products from internet or from Linux CD. NTP’s file name normally starts with phrase ntp following the version number such as ntp-4.1.2-5.i386.rpm
The /etc/ntp.conf File
/etc/ntp.conf file is used for NTP configuration and you have to edit it and place IP address of stratum 1 and stratum 2 servers which are needed to use. Follow these steps for creating NTP configuration file by using sample NTP servers.
- Decide about servers in which you are interested for example
- Limit access types to your servers like servers should not be allowed to change run-time configuration or query from Linux NTP server.
- If NTP time server is providing atomic time clock information for other computers like workstations, Linux servers and networking devices then you should define proper networks and from that network server will accept NTP time synchronization requests.
- Restrict localhost universal IP address using this command
- Save NTP configuration file and restart NTP for these settings to take effect.
server otherntp.myserver.org # A stratum 1 server at myserver.org
server ntp.myresearch.gov # A stratum 2 server at myresearch.gov
restrict otherntp.myserver.org mask 255.255.255.255 nomodify notrap noquery
restrict ntp.myresearch.gov mask 255.255.255.255 nomodify notrap noquery
255.255.255.255 mask is used for limiting every IP address on remote NTP servers.
Use this command using non query keyword to permit network to query NTP server.
restrict 192.168.2.0 mask 255.255.255.0 nomodify notrap
It will be applied to all possible IP addresses on local network.
restrict 127.0.0.1
Starting NTP Server
Restart NTP each time you have edit its configuration file to make changes takes effect during running time.
Use this command to get configured NTP start at boot.
[root@linux-server tmp]# chkconfig ntpd on
Use these commands to start,stop and restart NTP after booting by following these commands.
[root@linux-server tmp]# service ntpd start
[root@linux-server tmp]# service ntpd stop
[root@linux-server tmp]# service ntpd restart
Checking NTP working
Use this command to check to test whether NTP is working correctly or not.
[root@linux-server tmp]# pgrep ntpd













