LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 06-12-2013, 03:55 AM   #1
stevetronik
LQ Newbie
 
Registered: Jun 2013
Posts: 3

Rep: Reputation: Disabled
ntpstat unsynchronised time server restarting w32time server


I have gone through with the thread "NTP Client Error -- ntpstat shows unsynchronised " But to no avail seems like a different issues, I think. I am not familar with linux

Currently I have a Windows 7 Professional setup as a server/timeserver providing Time sync for my intended linux client. My windows client are synching alright with my time server

I change some of the Windows registry value to allow the Windows Server to act as a Time Server instead of using pools.

When I key in root#ntpstat it tells me that unsynchronised time server restarting.

I set my min and max poll rate to 64 second.

I do noticed that it is able to sync with my time server, only when I click the adjust date and time and click on the internet time tab and clicking ok. It would display "contacting ntp server", and the time will sync.

I do not wish to used ntpdate with cron job to brute force unless it is really a last resort. (although i think my cron job isn't working as well)
 
Old 06-12-2013, 11:18 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,080

Rep: Reputation: 797Reputation: 797Reputation: 797Reputation: 797Reputation: 797Reputation: 797Reputation: 797
On the Linux side of the world you need a configured /etc/ntp.conf that looks like this:
Code:
# /etc/ntp.conf

driftfile /etc/ntp/drift
logfile /var/log/ntp.log

server 192.168.2.1

server 127.127.1.0
fudge  127.127.1.0 stratum 10

restrict default ignore
restrict 127.0.0.1 mask 255.0.0.0
restrict 192.168.2.1 mask 255.255.255.255
In this example, 192.168.2.1 is the address of your time server.

From you Linux system you should be able to ping the time server; e.g.,
Code:
ping -c 5 192.168.2.1
(obviously, substitute the actual address of your time server).

Now, NTPD (the NTP daemon) on your Linux system, is started at boot; the typical command looks like this:
Code:
# Start ntpd:
ntpd_start() {
  CMDLINE="/usr/sbin/ntpd -g"
  echo -n "Starting NTP daemon:  $CMDLINE"
  $CMDLINE -p /var/run/ntpd.pid
  echo
}
Your locations may vary from the above, but look for the daemon start in /etc/init.d or one of the /etc/rc[0-6].d directories, depending upon where your service start files are located in /etc. The important thing is that the daemon is started with /usr/sbin/ntpd -g -p /var/run/ntpd.pid (the -g allows the first time adjustment to be big (NTPD will not synchronize if the time is more than about five minutes off). Again, the location of the executable ntpd may not be in /usr/sbin on your system, use the whereis utility to find it.

You don't want to start it in a cron job, you want it to start at boot and run "forever."

Once NTPD has started, it can take 5-to-10 minutes for it to synchronize with your time server (it can take up to half an hour). You use the ntpq utility to view the status:
Code:
ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.2.1     81.19.16.225     3 u  916 1024  377    0.367    7.897   2.552
 LOCAL(0)        .LOCL.          10 l  10h   64    0    0.000    0.000   0.000
The asterisk means it's synchronized; before it syncs, the asterisk will be on the LOCAL line in the ntpq display.

You will need to, as root,
Code:
touch /var/log/ntp.log
once (your log entries will go in there).

You can use ntpdate to set the system clock at boot if you don't want to use the daemon; however, if the system is running long-term (over days or weeks), it's better to use the daemon -- it will "walk" your system clock into synchronization over time, applying the drift value (which is kept in /etc/ntp/drift) to slowly adjust the system clock into accuracy.

One function of the "init" functions (the ones that start system services) is that NTPD will read time from the hardware clock to initially set the system clock. NTPD runs, synchronizes your system clock then, at shutdown, saves that synchronized (accurate) time to the hardware clock (which runs on the battery while the power is off). That generally keeps your system on-time within a few milliseconds.

Hope this helps some.

Note: the above example is taken from Niki Kovacs' article at http://docs.slackware.com/howtos:network_services:ntp. Although the article is Slackware-centric, it serves as a good guide to setting up NTP on a LAN.

Last edited by tronayne; 06-12-2013 at 11:21 AM.
 
Old 06-12-2013, 08:56 PM   #3
stevetronik
LQ Newbie
 
Registered: Jun 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
After I did the above mentioned step.

When I run ntpstat it says I m sync to local net stratum 11
Not my server.

I run ntp logging it shows
Sendto(192.168.1.111)(fd=-1):bad file descriptor
The address above is my time server
 
Old 06-13-2013, 07:41 AM   #4
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,080

Rep: Reputation: 797Reputation: 797Reputation: 797Reputation: 797Reputation: 797Reputation: 797Reputation: 797
After reading through Windows Time Service Tools and Settings http://technet.microsoft.com/en-us/l...8WS.10%29.aspx, I have the impression that the Windows side of the world is not an NTP protocol (could be wrong, but it sure looks that way) -- it gets its time from an NTP server, but doesn't seem to provide an NTP service to clients. Now I am the first to admit that I know diddly-squat about Windows (don't have it, don't use it).

I suspect that you would be better off if you configure NTPD on your Linux system to actually use NTP servers; it's simple enough to do and it won't bog down your LAN (NTP doesn't constantly interact with the network, it's a short burst every few minutes sending and receiving small packets of data).

If you read though Niki Kovacs' article, the first section of it shows How to synchronize a LAN server or public root server with an NTP server on the internet with a working example /etc/ntp.conf file (using public servers in France; if you're in the USA, simply change
Code:
server 0.fr.pool.ntp.org
to
Code:
server 0.us.pool.ntp.org
(and, of course the other three lines, too). If you're not in the US, use the country code for where you're located.

First thing to do is shut down the running service on your Linux server (maybe something like ntpstop?), edit /etc/ntp.conf, then ntpstart. Wait a few minutes then execute
Code:
/usr/sbin/ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 127.127.1.0     .LOCL.          10 l   7h   64    0    0.000    0.000   0.000
+208.53.158.34   164.244.221.197  2 u  320 1024  377  1330.61   81.481  54.241
+24.124.0.251    128.206.12.130   3 u  472 1024  377  1300.17  131.206  92.446
*173.255.240.184 216.218.254.202  2 u  655 1024  377  1267.30   21.671  47.755
and you should see something similar to the above.

I'm sorry that I'm not familiar with Windows -- it may be that there is a option to the Windows Time Service that will provide NTP protocol services but I just don't have a clue if or how to make that happen.

Hope this helps some.
 
Old 06-13-2013, 07:54 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,971

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
I assume that there is a process number i.e [xxxx] before that error in the logs. You should kill that process and any other ntp related process then restart ntp

Quote:
I change some of the Windows registry value to allow the Windows Server to act as a Time Server instead of using pools.
Your server still needs an accurate time source external or internal i.e. server pools or attached GPS receiver etc. I've never tried using windows as a ntp server. It isn't obvious why the client does not like the server. Post the output of the ntpq -p command as shown in tronayne post.

I believe that 7 is the same as XP.
http://support.microsoft.com/kb/314054
 
Old 06-14-2013, 03:13 AM   #6
stevetronik
LQ Newbie
 
Registered: Jun 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
All my system are not connected to the internet, we have PCs windows and Linux a liked syncing to a windows server using its own clock. Don't have to be accurate to world, but they all have to sync to have same time

/usr/sbin/ntpq -p
192.168.1.111 .LOCL. 1 u 31 64 177 0.655 6.769 10.402

.111 is the windows time server
My Linux client is .101 within the same network

Sorry I m replying with my phone.

What puzzles me is that it can sync to my windows server alright on first time when using GUI to choose ntp server. But subsequent polls doesn't work. Ntpstat keep saying time server restarting. It work when I ran "service ntpd restart"

Last edited by stevetronik; 06-14-2013 at 03:49 AM.
 
  


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
[SOLVED] NTP Client Error -- ntpstat shows unsynchronised vikas027 Linux - Server 23 05-10-2012 01:19 AM
Server restarting again and again raunaq Linux - Server 6 01-31-2012 04:16 PM
server Restarting eldhochacko Linux - Server 5 09-25-2009 08:32 AM
restarting x server? pyschomike15 Linux - General 4 11-02-2003 07:13 AM


All times are GMT -5. The time now is 11:42 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration