LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-11-2013, 11:09 AM   #1
shams
Member
 
Registered: Jan 2004
Posts: 535

Rep: Reputation: 30
Question NTP synchronization error?


I installed the ntp in kubuntu 13.04, the date is correct but the time is not set correct, the local time is same as the UTC time, my local time zone is set correctly, this is the /etc/ntp.conf:
Quote:
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

logfile /var/log/xntpd
driftfile /var/lib/ntp/ntp.drift
statsdir /var/log/ntpstats/


# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
##
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org

# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines. Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient
and this is ntpq -p command i don't know if this can help:
Quote:
remote refid st t when poll reach delay offset jitter
==============================================================================
+113.30.137.34 108.199.26.138 3 u 51 128 377 249.634 -24.005 10.312
-31.169.iconpln. 111.92.175.248 3 u 43 128 377 223.382 -58.500 13.574
-120-88-47-10.in 10.84.87.146 2 u 48 128 377 394.758 45.819 9.373
+superluminal.sf 131.113.192.40 2 u 98 128 377 400.725 -4.357 7.560
-beitel.indoforu 47.187.174.51 2 u 46 128 377 237.214 -96.126 16.586
-ec2-54-254-17-2 203.123.48.219 2 u 107 128 377 307.772 79.869 18.120
-202.71.100.89 203.106.109.85 4 u 100 128 355 124.975 -2.709 157.665
*europium.canoni 193.79.237.14 2 u 44 128 375 198.921 -36.770 10.791

Last edited by shams; 10-11-2013 at 11:12 AM.
 
Old 10-11-2013, 01:56 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,138

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Your system time is within 100 msec of 8 different servers. Why do you believe it is not correct? What does "date" print and your phone show, for example?

Also check $TZ and /etc/localtime.
 
Old 10-11-2013, 02:13 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
If you time zone is set correctly then the problem is typically due to the fact that your hardware clock is set to local time but the OS thinks it is UTC or vice versa.

Check the /etc/default/rcS file to see if utc=yes or no and check the hardwark clock time.
 
Old 10-12-2013, 06:02 AM   #4
shams
Member
 
Registered: Jan 2004
Posts: 535

Original Poster
Rep: Reputation: 30
Thanks for reply the, in the file /etc/default/rcS utc is set to yes:
Quote:
# assume that the BIOS clock is set to UTC time (recommended)
UTC=yes
amd the hardware clock is also set to UTC:
Quote:
# hwclock -r
UTC 03:52:21 -0.188043 seconds
now how i can solve this problem please?
 
Old 10-12-2013, 07:44 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
What is your time zone?

Post the output of the command:
zdump -v /etc/localtime | grep 2013
 
Old 10-12-2013, 11:36 AM   #6
shams
Member
 
Registered: Jan 2004
Posts: 535

Original Poster
Rep: Reputation: 30
My time zone is +4:30 and given command have no any output:
Quote:
# zdump -v /etc/localtime | grep 2013
The /etc/timezone file has the correct entry for my time zone.

Last edited by shams; 10-12-2013 at 11:50 AM.
 
Old 10-12-2013, 01:35 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Also try
zdump -v /etc/localtime
and
zdump -v <your_time_zone> (Use actial time zone)

You should see a bunch of time zone data. The output of the files should match.

https://help.ubuntu.com/community/UbuntuTime
 
Old 10-12-2013, 08:55 PM   #8
shams
Member
 
Registered: Jan 2004
Posts: 535

Original Poster
Rep: Reputation: 30
Thesee are the outputs of above commands:
Quote:
# zdump -v /etc/localtime
/etc/localtime Fri Dec 13 20:45:52 1901 UTC = Fri Dec 13 20:45:52 1901 UTC isdst=0 gmtoff=0
/etc/localtime Sat Dec 14 20:45:52 1901 UTC = Sat Dec 14 20:45:52 1901 UTC isdst=0 gmtoff=0
/etc/localtime Mon Jan 18 03:14:07 2038 UTC = Mon Jan 18 03:14:07 2038 UTC isdst=0 gmtoff=0
/etc/localtime Tue Jan 19 03:14:07 2038 UTC = Tue Jan 19 03:14:07 2038 UTC isdst=0 gmtoff=0
Quote:
# zdump -v +4:30
+4:30 Fri Dec 13 20:45:52 1901 UTC = Fri Dec 13 20:45:52 1901 isdst=0 gmtoff=0
+4:30 Sat Dec 14 20:45:52 1901 UTC = Sat Dec 14 20:45:52 1901 isdst=0 gmtoff=0
+4:30 Mon Jan 18 03:14:07 2038 UTC = Mon Jan 18 03:14:07 2038 isdst=0 gmtoff=0
+4:30 Tue Jan 19 03:14:07 2038 UTC = Tue Jan 19 03:14:07 2038 isdst=0 gmtoff=0
I think there is going something wrong?
 
Old 10-13-2013, 08:19 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
All of my systems are the same...
Using time zone aft-4:30 will give you a +4:30 UTC offset.

Code:
zdump -v aft-4:30
aft-4:30  Fri Dec 13 20:45:52 1901 UTC = Sat Dec 14 01:15:52 1901 aft isdst=0 gmtoff=16200
aft-4:30  Sat Dec 14 20:45:52 1901 UTC = Sun Dec 15 01:15:52 1901 aft isdst=0 gmtoff=16200
aft-4:30  Mon Jan 18 03:14:07 2038 UTC = Mon Jan 18 07:44:07 2038 aft isdst=0 gmtoff=16200
aft-4:30  Tue Jan 19 03:14:07 2038 UTC = Tue Jan 19 07:44:07 2038 aft isdst=0 gmtoff=16200

Last edited by michaelk; 10-13-2013 at 08:20 AM.
 
Old 10-13-2013, 12:40 PM   #10
shams
Member
 
Registered: Jan 2004
Posts: 535

Original Poster
Rep: Reputation: 30
Any idea how to get the correct system time with ntp now?
 
Old 10-13-2013, 01:29 PM   #11
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Set your time zone for aft-4:30
 
  


Reply



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 Synchronization chidhambaram7 Linux - General 3 07-12-2012 07:03 AM
Cross synchronization NTP not working Vikonder Linux - Newbie 1 11-16-2011 01:18 PM
NTP synchronization CoderMan Linux - Server 2 02-22-2010 03:14 PM
time synchronization - NTP tractng Linux - Newbie 1 04-02-2008 08:28 PM
ntp synchronization problems ricky_ds Linux - Networking 1 10-13-2004 10:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02: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
Open Source Consulting | Domain Registration