Configuring NTP Server and Client on CentOS 5.x


The Network Time Protocol (NTP) is a protocol for synchronizing the clocks of computer systems over packet-switched, variable-latency data networks. NTP uses UDP on port 123 as its transport layer. The ntp package includes ntpdate package (for retrieving the date and time from remote machines via a network) and ntpd (a daemon which continuously adjusts system time).

For this blog entry, we are looking at a typical HPC Setup with Local Head Nodewith access to Internet and with Clients with no access to internet.

Step 1: Install the ntp package

# yum install ntp

Step 2: Configuration at /etc/ntp.conf
(The Basic Configuration is sufficient. A few things to note)

# vim /etc/ntp.conf
(Inside the /etc/ntp.conf)

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
(This statement is to allow local network to access the Server)

restrict 127.0.0.1
(Ensure the localhost has full access without any restricting password)

server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
(server xxxx.pool.ntp.org represent remote NTP servers that your local NTP Server want to sync to)

Step 3: Start the NTP Service
(Synchronise the local NTP Server with Remote NTP Server)

# chkconfig --levels 235 ntpd on
# ntpdate 0.centos.pool.ntp.org
# service ntpd start

Step 4: Check whether the NTP Server is working

# ntpq -p

Setting Up NTP Clients to sync with the local NTP Server and NTP Client

Step 1: Install NTP Client

# yum install ntp

Step 2: Configure the /etc/ntp.conf

# vim /etc/ntp.conf
(Inside the /etc/ntp.conf)

server 192.168.10.1
(where 192.168.10.1 is the local NTP Server)

Step 3: Configure /etc/ntp/ntpservers and /etc/ntp/step-tickers to point to the local NTP Servers

192.168.10.1
(where 192.168.10.1 is the local NTP Server where the NTP Clients will sync with)

Step 4: Start the Services

# chkconfig --levels 235 ntpd on
# ntpdate 192.168.10.1
# service ntpd start

Step 5: Check whether it is working

# ntpq -p

For more information, go to

  1. NTP.org
  2. ntpdate no server suitable for synchronization found (Linux Toolkit)
  3. Setting up NTP Server for Local Network (Linux Toolkit)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s