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

last updated in Categories Linux, RedHat/Fedora Linux, Sys admin, Tips, Ubuntu 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


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:

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

 5 May 14:36:01 ntpdate[5257]: adjust time server offset -0.343242 sec


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

20 comment

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

  2. 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 ?


  3. 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 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.

  4. 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
    9 Mar 10:16:09 ntpdate[7372]: the NTP socket is in use, exiting
    [root@vm-02 ~]# ntpdate
    9 Mar 10:16:17 ntpdate[7375]: the NTP socket is in use, exiting
    [root@vm-02 ~]# rdate -s
    rdate: couldn't connect to host 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,

  5. ntpdate is not used anymore, now we have ntpd -q -g, as explained here:

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

  7. 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

    1. 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.

  8. run:
    sntp -P no -r

    DO NOT use ntpdate anymore:

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

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

  9. 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
    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

  10. 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.

    Have a question? Post it on our forum!