≡ Menu

Synchronize the system clock to Network Time Protocol (NTP) under Fedora or Red Hat Linux

The Network Time Protocol daemon (ntpd) program is a Linux operating system daemon. It sets and maintains the system time of day in synchronism with time servers (Mills).

You need to configure ntpd via /etc/ntp.conf configuration file. The file is well documented and you easily configure it.

Install ntpd

If ntpd is not installed use any one of the following command to install ntpd:
# yum install ntpOR# up2date ntp

Configuration

You should at least set following parameter in /etc/ntp.conf config file:
server <Time Server Name or IP Address>

For example, open /etc/ntp.conf file using vi text editor:
# vi /etc/ntp.conf
Locate server parameter and set it as follows:
server pool.ntp.org

Save the file and restart the ntpd service:
# /etc/init.d/ntpd start

You can synchronize the system clock to an NTP server immediately with following command:
# ntpdate pool.ntp.org
Output:

 5 May 14:36:01 ntpdate[5257]: adjust time server 61.206.115.3 offset -0.343242 sec
Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

Comments on this entry are closed.

  • cool mind July 13, 2006, 4:58 am

    Time is not updated through asia.pool.ntp.org. Any other server that can be configured in /etc/ntpd.conf. Please suggest

  • nixCraft July 13, 2006, 6:20 am

    Goto -> http://www.pool.ntp.org/ and select the server you want :)

  • yellanna October 11, 2007, 11:24 am

    Iam unable to syn two systems time between redhat 7 and redhat enterprise 4.
    Is there any please reply.

  • Timothy March 17, 2009, 3:42 am

    Works perfect! GNOME wouldn’t update the time itself, so I came here. Thanks, buddy!

  • ksk May 27, 2009, 8:04 am

    its good but tell me how i sync the client with my ntp server

  • Gururaj April 21, 2010, 2:44 am

    Hi ,
    I am getting message as NTP socket in use , exiting … I am getting this message after I started the ntp service .

    Do you know what it is ? any solution ?

    Gururaj

  • DrCyb May 3, 2010, 1:14 am

    I had the same problem with Gururaj, until I found out that I need to stop the NTP service first.
    /etc/init.d/ntpd stop
    Then only ntpdate pool.ntp.org will work.

    Why is this so when the instruction says to “Save the file and restart the ntpd service” then
    “You can synchronize the system clock to an NTP server immediately with following command:” ?

    The instructions doesn’t work in that order.

  • Sujith June 22, 2010, 12:52 pm

    us.pool.ntp.org

  • Ville July 23, 2011, 4:01 pm

    Use ntp1.funet.fi or ntp2.funet.fi
    They work nicely :)

  • Deb March 10, 2012, 3:19 am

    Hi, wanted to sync up my (SentOS)VM with NTP. Followed the above mentioned steps, but did not get the intended (described) results. Instead , I got the following errors :
    [root@vm-perfads02 America]# /etc/init.d/ntpd start
    Starting ntpd: <–Good ! No error !!
    [root@vm-02 ~]# ntpdate pool.ntp.org
    9 Mar 10:16:09 ntpdate[7372]: the NTP socket is in use, exiting
    [root@vm-02 ~]# ntpdate pool.ntp.org
    9 Mar 10:16:17 ntpdate[7375]: the NTP socket is in use, exiting
    [root@vm-02 ~]# rdate -s aa.bb.cc.dd
    rdate: couldn't connect to host aa.bb.cc.dd: No route to host
    I ended up fixing the issue , by date command ( as below ):
    [root@vm-perfads02 America]# date
    Fri Mar 9 10:27:33 PST 2012 <–This date was incorrect
    [root@vm-perfads02 etc]# date 030918402012
    Fri Mar 9 18:40:00 PST 2012 <–This is correct date [same as other servers]
    Also bounced the box to recheck if the above date sticks and it does ! Hence sharing this info and good news. Kindest regards,

  • CharlieBrown April 16, 2012, 9:04 am

    ntpdate is not used anymore, now we have ntpd -q -g, as explained here: en.gentoo-wiki.com/wiki/NTP.

  • Sameed Ahmed October 29, 2012, 8:38 am

    use ” ntpdate -u pool.ntp.org ”
    If your server is behind firewall.

  • Mark January 8, 2013, 4:10 am

    I’m facing the problem on time incorrect even I had sync it correctly with ntpd. Weird.

  • Shweta January 25, 2013, 7:20 am

    ntpdate ntp_server_ip
    after executing this command
    its showing like ” no server suitable for synchronization”
    Whats the reason behind this?

  • Santosh March 11, 2013, 10:32 pm

    Comment by Sameed Worked for me.. here is my system output.

    [root@server1~]# ntpdate
    11 Mar 17:11:11 ntpdate[31328]: the NTP socket is in use, exiting

    [root@server1~]# date
    Mon Mar 11 17:11:17 CDT 2013

    [root@server1~]# ntpdate -u
    11 Mar 17:29:29 ntpdate[31551]: step time server offset 979.012426 sec

    [root@server1~]# date
    Mon Mar 11 17:29:35 CDT 2013

    • Santosh March 11, 2013, 10:34 pm

      not sure.. why my command was truncated in my comments so re posting.. I used:

      “ntpdate [our internal server ip]” – Failed

      “ntpdate -u [our internal server ip]” – worked.

  • wintel2006 June 24, 2013, 5:58 pm

    run:
    sntp -P no -r pool.ntp.org

    DO NOT use ntpdate anymore:

    ntpdate pool.ntp.org
    !!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!

    The ntpdate program is deprecated and should not be used any more.

  • DG July 24, 2013, 5:50 am

    I am using SLES 11.1

    !!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!

    The ntpdate program is deprecated and should not be used any more. To
    quote the upstream ntp developers:

    “The functionality ntpdate offered is now provided by the ntpd daemon
    itself. If you call ntpd with the command line option -q it will
    retrieve the current time and set it accordingly.”

    Please check the Network Time Protocol (NTP) daemon man page and
    http://support.ntp.org/bin/view/Dev/DeprecatingNtpdate
    for further information.

    You can replace the ntpdate call with “rcntp ntptimeset” to achieve an
    inital poll of the servers specified in /etc/ntp.conf.

    The program /usr/sbin/sntp offers comparable functionality to ntpdate.

    ======

    sntp -P no -r [our internal server ip] ===> Worked

  • Ranjan July 29, 2013, 5:33 pm

    Hallo Sir,

    How to set all my servers time table as my own server time in my Network ??? Is it possible & How ??? Can you please tell me the answer please … I am desperately want the replay sir…. THANKS in Advance.

  • idm March 4, 2014, 7:01 am

    Dear Sir,

    How to minimize drift (dippresion ) in NTP master and client server.