Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Red Hat Enterprise Linux 9 Essentials Book now available.

Purchase a copy of Red Hat Enterprise Linux 9 (RHEL 9) Essentials

Red Hat Enterprise Linux 9 Essentials Print and eBook (PDF) editions contain 34 chapters and 298 pages

Preview Book

13.2.2. Network Time Protocol Setup

As opposed to the manual setup described above, you can also synchronize the system clock with a remote server over the Network Time Protocol (NTP). For the one-time synchronization only, use the ntpdate command:
  1. Firstly, check whether the selected NTP server is accessible:
    ~]# ntpdate -q server_address
    
    For example:
    ~]# ntpdate -q 0.rhel.pool.ntp.org
    
  2. When you find a satisfactory server, run the ntpdate command followed with on or more server addresses:
    ~]# ntpdate server_address...
    
    For instance:
    ~]# ntpdate 0.rhel.pool.ntp.org 1.rhel.pool.ntp.org
    
    Unless an error message is displayed, the system time should now be set. You can check the current by setting typing date without any additional arguments as shown in Section 13.2.1, “Date and Time Setup”.
  3. In most cases, these steps are sufficient. Only if you really need one or more system services to always use the correct time, enable running the ntpdate at boot time:
    ~]# chkconfig ntpdate on
    
    For more information about system services and their setup, see Chapter 7, Controlling Access to Services.

    Note

    If the synchronization with the time server at boot time keeps failing, i.e., you find a relevant error message in the /var/log/boot.log system log, try to add the following line to /etc/sysconfig/network:
    NETWORKWAIT=1
    
However, the more convenient way is to set the ntpd daemon to synchronize the time at boot time automatically:
  1. Open the NTP configuration file /etc/ntp.conf in a text editor such as vi or nano, or create a new one if it does not already exist:
    ~]# nano /etc/ntp.conf
    
  2. Now add or edit the list of public NTP servers. If you are using Red Hat Enterprise Linux 6, the file should already contain the following lines, but feel free to change or expand these according to your needs:
    server 0.rhel.pool.ntp.org
    server 1.rhel.pool.ntp.org
    server 2.rhel.pool.ntp.org
    

    Tip

    To speed the initial synchronization up, add the iburst directive at the end of each server line:
    server 0.rhel.pool.ntp.org iburst
    server 1.rhel.pool.ntp.org iburst
    server 2.rhel.pool.ntp.org iburst
    
  3. Once you have the list of servers complete, in the same file, set the proper permissions, giving the unrestricted access to localhost only:
    restrict default kod nomodify notrap nopeer noquery
    restrict -6 default kod nomodify notrap nopeer noquery
    restrict 127.0.0.1
    restrict -6 ::1
    
  4. Save all changes, exit the editor, and restart the NTP daemon:
    ~]# service ntpd restart
    
  5. Make sure that ntpd daemon is started at boot time:
    ~]# chkconfig ntpd on
    

 
 
  Published under the terms of the Creative Commons License Design by Interspire