Monday, 8 December 2014

Setting up an local NTP server

A local NTP server is necessary when there is a local network and the machines in the local environment need to have a synchronized time.

Here, in this article, I will be explaining the steps to setup a local NTP server and some useful commands related to NTP.

First of all we need to install ntp via yum. Run the below command:
====
yum install ntp
====

Now, you will have to edit the configuration file, /etc/ntpd.conf and set the server as:
===
server  127.127.1.0 # local clock
===

Comment out all servers listed in the configuration file.

Now start the NTP server as:
===
service ntpd start
====

Now, you have a local NTP server and you have to tell all clients in the local network that, to sync their time with the local NTP server. To get this done, install NTP service in the client machines and edit the NTP configuration files of clients. In the server section of configuration file, enter the server IP of the local NTP server.

Some commands:

Command 1:
===
ntpq -q

This command is used to check the status of NTP.
====

Command 2:
====
ntpdate -u <SERVER IP OF NTP SERVER>

This command is used to sync time of client with the local NTP server.
====

Command 3:
====
ntpdc -c sysinfo

This command is used to view the status of NTPD.
====

Cool :)

No comments:

Post a comment

Note: only a member of this blog may post a comment.