LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-28-2014, 11:46 AM   #1
rjnlinux
Member
 
Registered: Sep 2009
Posts: 41

Rep: Reputation: 0
ntp setup issue


I have setup ntp on my server
however this does not work
for example

when I give the command
ntpdate -q 0.north-america.pool.ntp.org
28 Jul 09:45:32 ntpdate[58813]: step time server 204.9.54.119 offset -59.114942 sec

I think this means that the actual time is offset by 59 seconds
How do I correct this issue
 
Old 07-28-2014, 11:53 AM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,208

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
Just remove the -q (query only) to set your clock.

Also, just using 'pool.ntp.org' will automatically select an NTP server that is available.
 
Old 07-28-2014, 12:19 PM   #3
rjnlinux
Member
 
Registered: Sep 2009
Posts: 41

Original Poster
Rep: Reputation: 0
i thought

that the objective of setting up ntp was that it should automatically update my server clock.

Is my setup wrong ?
 
Old 07-28-2014, 12:29 PM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,208

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
I dont know. What does your ntp config look like?
 
Old 07-28-2014, 01:06 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,015

Rep: Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848
It true that just using pool.ntp.org should return the closest servers but there is nothing wrong with selecting specific server pools for your continent or country.

The difference between nptdate and ntp is that the first will just update the system clock once. Many find this suitable and might use cron to periodically keep the clock synched. In a nutshell, ntp is designed to slowly update time to prevent time jumps, calculate drift which will discipline the clock to keep better time and also synch the hardware clock.
 
Old 07-28-2014, 01:13 PM   #6
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,208

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
Quote:
Originally Posted by michaelk View Post
It true that just using pool.ntp.org should return the closest servers but there is nothing wrong with selecting specific server pools for your continent or country.
Not a thing wrong with it. But which is easier to remember and type often though? pool.ntp.org or 0.north-america.pool.ntp.org?
 
Old 07-28-2014, 02:20 PM   #7
Captain Pinkeye
Member
 
Registered: Oct 2012
Location: The Czech Republic
Posts: 280

Rep: Reputation: 97
The clock will adjust gradually, over time. Maybe you are just impatient.

Quote:
Originally Posted by rjnlinux View Post
that the objective of setting up ntp was that it should automatically update my server clock.

Is my setup wrong ?
AFAIK ntp is supposed to work as a daemon, the ntpdate is obsolete. What's the output of 'ntpq -pn'?
 
Old 07-28-2014, 04:25 PM   #8
rjnlinux
Member
 
Registered: Sep 2009
Posts: 41

Original Poster
Rep: Reputation: 0
ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
107.170.242.27 204.9.54.119 2 u 1 64 1 14.823 -128.80 0.059
174.36.71.205 50.97.210.169 3 u 1 64 1 46.266 -127.88 0.000
66.228.59.187 47.187.174.51 2 u 1 64 1 72.487 -139.84 0.000
198.110.48.12 64.113.32.5 2 u 1 64 1 60.791 -131.15 0.000
 
Old 07-28-2014, 04:56 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,015

Rep: Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848
Code:
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-38.229.71.1     204.123.2.72     2 u  143  256  377   41.340    1.128   4.324
+54.235.96.196   216.66.0.142     3 u  101  256  377   60.517   -6.796   4.025
*204.235.61.9    128.10.19.24     2 u  221  256  377   62.790   -4.156   3.974
-155.101.3.115   198.60.22.240    2 u  219  256  377   87.856  -16.755   2.648
+192.168.0.200   204.2.134.163    3 u   92  256  377    0.542   -3.355   2.636
Please use code tags to preserve formatting. Wait a few minutes and post back when the reach value is 377. When that happens hopefully you will see a * in the first column like the above example.

Currently your system has a ~128 msec offset.

Last edited by michaelk; 07-28-2014 at 04:59 PM.
 
Old 07-28-2014, 05:31 PM   #10
rjnlinux
Member
 
Registered: Sep 2009
Posts: 41

Original Poster
Rep: Reputation: 0
These are my settings

cat /etc/sysconfig/ntpd
# Drop root to id 'ntp:ntp' by default.
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
# Set to 'yes' to sync hw clock after successful ntpdate
SYNC_HWCLOCK=yes
# Additional options for ntpdate
NTPDATE_OPTIONS=""
 
Old 07-28-2014, 05:34 PM   #11
rjnlinux
Member
 
Registered: Sep 2009
Posts: 41

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by rjnlinux View Post
These are my settings

cat /etc/sysconfig/ntpd
# Drop root to id 'ntp:ntp' by default.
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
# Set to 'yes' to sync hw clock after successful ntpdate
SYNC_HWCLOCK=yes
# Additional options for ntpdate
NTPDATE_OPTIONS=""


Code:
ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+107.170.242.27  204.9.54.119     2 u   17   64  377   14.290  -122.64   1.624
-174.36.71.205   184.173.173.205  3 u   21   64  377   45.618  -120.79   1.375
*66.228.59.187   200.98.196.212   2 u   12   64  377   72.367  -133.62   0.824
+198.110.48.12   64.113.32.5      2 u    8   64  377   60.798  -124.08 277.195

Last edited by rjnlinux; 07-28-2014 at 05:38 PM.
 
Old 07-28-2014, 05:50 PM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,015

Rep: Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848
Code:
     remote        refid       st t when  poll reach   delay   offset   jitter
*66.228.59.187  200.98.196.212  2 u  12    64   377   72.367  -133.62   0.824
Looks ok to me. The longer ntp runs the better the clock will be disciplined and the smaller the offset. You will also see the poll value increase.

The settings posted are the options used to start the service versus /etc/ntp.conf which is the configuration file.
 
Old 07-28-2014, 11:39 PM   #13
Captain Pinkeye
Member
 
Registered: Oct 2012
Location: The Czech Republic
Posts: 280

Rep: Reputation: 97
In my eyes, your setup is right and working well. Just between your two posts the offset got smaller by ~7 miliseconds.
 
Old 07-29-2014, 09:53 AM   #14
rjnlinux
Member
 
Registered: Sep 2009
Posts: 41

Original Poster
Rep: Reputation: 0
Wink Thanks

Quote:
Originally Posted by Captain Pinkeye View Post
In my eyes, your setup is right and working well. Just between your two posts the offset got smaller by ~7 miliseconds.
Thanks all !!
I am happy my setup is done with all of your help !!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NTP offset issue rhythm4urs Linux - Server 5 05-19-2012 01:47 AM
NTP issue vetri83 Linux - Server 1 05-10-2012 05:28 AM
Ntp server setup rafaelnunez Linux - Newbie 1 01-06-2012 01:14 PM
ntp drift file in /etc/ntp instead of /var/lib/ntp - suggestion for a patch in Slack niels.horn Slackware 16 05-07-2009 07:35 PM
Need help with NTP server/client setup ncorreia Linux - General 0 11-06-2003 05:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration