Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Centos Time
PostPosted: Mon Mar 25, 2013 4:03 pm 
Offline
Junior Member

Joined: Wed Jan 27, 2010 1:48 pm
Posts: 22
Location: Las Vegas, NV
For some reason my Linode with CentOS on it seems to be running 5 minutes fast. I have NTP running. Can someone help me get this set to the correct time?

Thanks,


Top
   
 Post subject: Re: Centos Time
PostPosted: Mon Mar 25, 2013 4:08 pm 
Offline
Senior Member

Joined: Sat Nov 27, 2010 8:21 pm
Posts: 63
Run ntpstat and see what it says.


Top
   
 Post subject: Re: Centos Time
PostPosted: Mon Mar 25, 2013 4:10 pm 
Offline
Junior Member

Joined: Wed Jan 27, 2010 1:48 pm
Posts: 22
Location: Las Vegas, NV
synchronised to NTP server (173.255.219.242) at stratum 11
time correct to within 961 ms
polling server every 64 s


Top
   
 Post subject: Re: Centos Time
PostPosted: Mon Mar 25, 2013 7:17 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
lvthunder wrote:
synchronised to NTP server (173.255.219.242) at stratum 11

You're not talking to a real server. Either your ntp.conf is wrong or you have firewall rules blocking communication.

_________________
Rgds
Stephen
(Linux user since kernel version 0.11)


Top
   
 Post subject: Re: Centos Time
PostPosted: Wed Mar 27, 2013 5:28 pm 
Offline
Senior Member
User avatar

Joined: Wed Mar 17, 2004 4:11 pm
Posts: 554
Website: http://www.unixtastic.com
Location: Europe
sweh wrote:
lvthunder wrote:
synchronised to NTP server (173.255.219.242) at stratum 11

You're not talking to a real server. Either your ntp.conf is wrong or you have firewall rules blocking communication.


To expand on that, stratum 11 means you are syncing to the local clock. Allow connections to UDP destination port 123 in and out.

Check ntp.conf contains some server lines for the country your Linode is in. A driftfile is good too.
Code:
driftfile /var/lib/ntp/drift

server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
server 3.us.pool.ntp.org


Top
   
 Post subject: Re: Centos Time
PostPosted: Wed Mar 27, 2013 7:02 pm 
Offline
Junior Member

Joined: Wed Jan 27, 2010 1:48 pm
Posts: 22
Location: Las Vegas, NV
Here is my ntp.conf
Code:
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org

#broadcast 192.168.1.255 key 42         # broadcast server
#broadcastclient                        # broadcast client
#broadcast 224.0.1.1 key 42             # multicast server
#multicastclient 224.0.1.1              # multicast client
#manycastserver 239.255.254.254         # manycast server
#manycastclient 239.255.254.254 key 42  # manycast client

# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

# Drift file.  Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
driftfile /var/lib/ntp/drift


I opened the ports using these commands
Code:
iptables -I INPUT -p udp --dport 123 -j ACCEPT
iptables -I OUTPUT -p udp --dport 123 -j ACCEPT


I then turned the ntpd off and ran ntpdate 1.pool.ntp.org and got
Code:
27 Mar 16:06:37 ntpdate[11541]: step time server 94.125.129.7 offset -349.872909 sec

Now when I turn ntpd back on I get this when I run ntpstat
Code:
unsynchronised
  time server re-starting
   polling server every 64 s


Any ideas?


Top
   
 Post subject: Re: Centos Time
PostPosted: Thu Mar 28, 2013 12:32 pm 
Offline
Senior Member
User avatar

Joined: Wed Mar 17, 2004 4:11 pm
Posts: 554
Website: http://www.unixtastic.com
Location: Europe
lvthunder wrote:
Any ideas?


It should be working but it can take a while to get the initial sync.

Try 'ntpq -p' and 'ntptrace'.


Top
   
 Post subject: Re: Centos Time
PostPosted: Thu Mar 28, 2013 12:38 pm 
Offline
Junior Member

Joined: Wed Jan 27, 2010 1:48 pm
Posts: 22
Location: Las Vegas, NV
Darn it still says stratum 11.

Code:
ntpstat
synchronised to NTP server (149.20.68.17) at stratum 11
   time correct to within 950 ms
   polling server every 64 s

ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+ntp1.Housing.Be 128.32.206.55    3 u    8   64  177    3.320  -346373   8.795
+zulu.frizzen.ne 209.151.225.100  3 u    2   64  177   16.902  -346390  14.014
*pool-test.ntp.o 66.220.9.122     2 u   33   64   77    1.256  -346375   6.932
 LOCAL(0)        .LOCL.          10 l   44   64   77    0.000    0.000   0.001

ntptrace
localhost.localdomain: stratum 11, offset 0.000000, synch distance 0.950956
pool-test.ntp.org: stratum 2, offset -0.000014, synch distance 0.000574
clock.fmt.he.net: stratum 1, offset 0.000001, synch distance 0.000258, refid 'CDMA'


Top
   
 Post subject: Re: Centos Time
PostPosted: Thu Mar 28, 2013 6:27 pm 
Offline
Senior Member
User avatar

Joined: Wed Mar 17, 2004 4:11 pm
Posts: 554
Website: http://www.unixtastic.com
Location: Europe
Your offset is ludicrous!

Stop NTP, run 'ntpdate pool-test.ntp.org', then start NTP. Then wait for 30 minutes and it should be OK.


Top
   
 Post subject: Re: Centos Time
PostPosted: Thu Mar 28, 2013 7:01 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
Also, comment out this:

Code:
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10


That generally shouldn't be used in an Internet-connected environment.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject: Re: Centos Time
PostPosted: Thu Mar 28, 2013 11:28 pm 
Offline
Junior Member

Joined: Wed Jan 27, 2010 1:48 pm
Posts: 22
Location: Las Vegas, NV
I commented those lines out and now a couple hours later it is saying

Code:
unsynchronised
   polling server every 64 s


Is there a way to test the iptables settings?


Top
   
 Post subject: Re: Centos Time
PostPosted: Fri Mar 29, 2013 5:55 am 
Offline
Senior Member

Joined: Sat May 03, 2008 4:01 pm
Posts: 569
Website: http://www.mattnordhoff.com/
Did you restart NTP after making the configuration change? What does `ntpq -p` report now?

Edit: As for iptables, your earlier `ntpq -p` proves that your firewall is not causing problems for NTP.

_________________
Matt Nordhoff (aka Peng on IRC)


Top
   
 Post subject: Re: Centos Time
PostPosted: Fri Mar 29, 2013 11:18 am 
Offline
Junior Member

Joined: Wed Jan 27, 2010 1:48 pm
Posts: 22
Location: Las Vegas, NV
Yes I am pretty sure I restarted it. To be really sure I'll do it again.

Here is ntpq -p
Code:
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*216.45.57.38    204.123.2.5      2 u   10   64   37    9.390  -341845   6.877
+stratum2-2.NTP. 129.70.130.70    2 u   12   64   37  172.813  -341852   9.777
 209.141.38.41   216.218.254.202  2 u   60   64   17   17.364  -341840   5.293


Top
   
 Post subject: Re: Centos Time
PostPosted: Fri Mar 29, 2013 12:52 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
You didn't run the ntpdate command because your machine is still massively wrong.

You need to get it "close to right" before running ntpd. "ntpdate" will change your clock to be "close to right" and then ntpd can keep it right.

_________________
Rgds

Stephen

(Linux user since kernel version 0.11)


Top
   
 Post subject: Re: Centos Time
PostPosted: Fri Mar 29, 2013 1:07 pm 
Offline
Junior Member

Joined: Wed Jan 27, 2010 1:48 pm
Posts: 22
Location: Las Vegas, NV
When I run ntpdate I get this.
Code:
29 Mar 10:10:56 ntpdate[17953]: step time server 149.20.68.17 offset -341.469929 sec

Does that mean it worked or failed???

Is it so far off that i need to manually set the time?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group