Configruing NTP Services in Linux ( RHEL5/6)

The NTP service is responsible for maintaining the system time, which is highly important in any  environment because so many things rely on time (logs, error messages, applications, and so on). There are
a few different roles that your system can have when using NTP. They include

  • Primary NTP Server Provides time to secondary NTP servers or clients
  • Secondary NTP Server Provides time to clients; helps load balance primary NTP servers
  • NTP Peer Provides and receives time
  • NTP Client Receives time from primary or secondary NTP servers

According to the Red Hat Exam Prep Guide, you need to be able to synchronize clients with a higher-stratum server. The term stratum is used to define different levels, from 1 to 15, of time servers that are available to sync with. A stratum 1 time server is the most accurate. For load balancing and redundancy, you would probably want to configure a primary NTP server and a secondary NTP server to sync with a stratum 1 time server (which is located off your network). Now let’s look more closely at both the server and client side of NTP.

Task 1 : Installing a Time Server

Usually, the NTP package comes installed as part of your Red Hat system, but it is always good to know how to install it should you ever need to.

Step 1. If you need to, install the package:

# yum install -y ntp

Step 2. Verify that the package has been installed:

# rpm -qa | grep ntp

Step 3. Make sure that the service will start when the system boots up:

# chkconfig ntpd on

Step 4. Verify the service starts on boot:

# chkconfig ntpd –list
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Before starting the service, let’s configure the system first.

Task 2: Configuring NTP Server

To configure the primary NTP server, let’s look at part of the config file that comes with the system:

# cat /etc/ntp.conf

server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org

#fudge stratum 10

The first three lines shown here are the Internet (public) NTP servers that you sync with for the correct time. The fourth server option, which is commented out, defines a local clock driver that you can use to update the time. This is usually based on the BIOS click if used.

The final option, fudge, defines the stratum level to which your server is set. The server here is set at a stratum level of 10; a local system clock is also defined, and there are three public Internet servers you can sync with for accurate time.

For now, just let the system sync with the public Internet time servers.

Step 1. Start the NTP service:

# service ntpd start
Starting ntpd: [ OK ]

With the server configured, you can turn your attention over to one of the client systems. For this example,  use the Client01 system to sync  with the RHEL01 primary NTP server.On Client01, you need to verify
that the NTP package is already installed:

# rpm -qa | grep ntp

With the client installed, again look at the config file. Instead of public servers, you can set the RHEL01 system as the primary server to sync with.

Step 2. Define RHEL01 as the primary time server and make sure the driftfile line is uncommented:

# cat /etc/ntp.conf

driftfile /var/lib/ntp/drift

Now the client is looking at RHEL01 to sync its time. The additional option, driftfile, is a scratch place for the NTP service to calculate time checks and errors for accuracy. It is recommended for better results
but not required.

Step 3. Now that the client is configured, you just need to start the service:

# service ntpd start
Starting ntpd: [ OK ]

Please refer below links to know about:

November 16, 2015

0 responses on "Configruing NTP Services in Linux ( RHEL5/6)"

Leave a Message

Why Unixadminschool.com?

These days, working as UNIX and Linux system administrator is just more than knowing about any single operating system or technology. Our training content is carefully designed to explain real world scenarios in easy and systematic manner, so that you don’t need to spend so much time to understand these concepts from different sources – like expert blogs, books and forums.
Visit Us On TwitterVisit Us On FacebookVisit Us On Google PlusVisit Us On YoutubeVisit Us On Linkedin