Galactic Civilizations 3
Install a NTP server on Linux

Install a NTP server on Linux

Category: Administration.
Posted by on the 15/08/2013.
Last update on the 16/08/2013.

Description

This tutorial explains how to install and configure a NTP server on Debian.

Introduction

This tutorial is intended for people under Debian or distributions based on it (Ubuntu, Xandros ...). All commands in this tutorial are executed as root. (su command). It does not require any prerequisites.

NTP (Network Time Protocol) is a protocol that allows synchronizing the clocks of computers. Using a NTP server is a good way to have the good time in your systems. NTP works by asking the time to a number of servers around the world and calculating the correct time from the NTP server.

Installation

We will start by installing the packages ntpdate and ntp. To do that, executes the following command:

apt-get install ntpdate ntp

We will now update the system time. To do that, executes the following command:

/usr/sbin/ntpdate fr.pool.ntp.org

NTP server

NTP server's configuration

We can modify from where the NTP server is synchronized. To do that, we need to modify the configuration file. Here is an example with french NTP server:

nano /etc/ntp.conf

ntp.conf

# pool:
# server 0.debian.pool.ntp.org iburst
# server 1.debian.pool.ntp.org iburst
# server 2.debian.pool.ntp.org iburst
# server 3.debian.pool.ntp.org iburst


server 0.fr.pool.ntp.org iburst
server 1.fr.pool.ntp.org iburst
server 2.fr.pool.ntp.org iburst

Test

We will end this tutorial by testing our new service. First of all we need to restart the NTP server. To do that, executes the following command:

/etc/init.d/ntp restart

Then we can check if the communication is well performed by executing the following command:

ntpq -p

NTP

If you have only 0 in the columns delay offset jitter this means that there is an issue. Therefore, you need to check your configuration.

The clients

In order to synchronize your servers with the NTP server, you need to install on all your servers the package ntp. To do that, executes the following command:

apt-get install ntp

Configuration

We will now modify the configuration file /etc/ntp.conf. To do that, executes the following command:

nano /etc/ntp.conf

Then modify the configuration file like this:

ntp.conf

# pool:
# server 0.debian.pool.ntp.org iburst
# server 1.debian.pool.ntp.org iburst
# server 2.debian.pool.ntp.org iburst
# server 3.debian.pool.ntp.org iburst

server ipServeurNTP

Comment the other lines that start with server.

Launch the synchronization

We will now restart the service on all our servers that need to be synchronized. To do that, executes the following command:

/etc/init.d/ntp restart

To check if the synchronization is well performed, execute the following command:

ntp-wait -v

After few minutes, the following message is displayed:

Waiting for ntpd to synchronize... OK!

You like this tutorial ?
Like this website in order to promote it on facebook !

You like this tutorial ? Share it with your friends !
Partager sur Facebook Partager sur Twitter Partager sur Myspace Partager sur Stumbleupon Soumettre sur Reddit Partager sur Digg Ajouter à vos favoris Technorati Ajouter à vos favoris Live Ajouter à vos favoris Google Ajouter sur vos favoris Yahoo