LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 07-14-2011, 08:55 AM   #1
bramankp
LQ Newbie
 
Registered: Mar 2010
Posts: 11

Rep: Reputation: 0
ntpd - time server, not time source


I have a set of machines on a disconnected network. Periodically, one of the machines connects to the internet and synchronizes its time with a time server that is not known until the connection is established. (The machine queries a central command server for the address of the time server it should synchronize to.)

I then use a custom tool to do some calculations to call adjtimex() and adjust the clock so that it runs fairly accurately.

I know ntpd is supposed to be able to handle disconnected networks but I thought you had to preconfigure the servers in the configuration file.

Regardless ... it is the way it is.

My intent is to run ntpd on this machine (without configured "server"s) so that it can serve time to the internal network. (Periodic synchronization using ntpdate from the internal machine to the bridge machine.)

The problem:

ntpd wants to fuss with the values I set using adjtimex(). I want it to quit thinking it needs to adjust the clock and just serve time to the internal network. (Maybe I have a GPS time source hooked directly to the machine!)

Any idea how to tell it to stop?
 
Old 07-14-2011, 09:55 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by bramankp View Post
I have a set of machines on a disconnected network. Periodically, one of the machines connects to the internet and synchronizes its time with a time server that is not known until the connection is established. (The machine queries a central command server for the address of the time server it should synchronize to.) I then use a custom tool to do some calculations to call adjtimex() and adjust the clock so that it runs fairly accurately. I know ntpd is supposed to be able to handle disconnected networks but I thought you had to preconfigure the servers in the configuration file.

Regardless ... it is the way it is.

My intent is to run ntpd on this machine (without configured "server"s) so that it can serve time to the internal network. (Periodic synchronization using ntpdate from the internal machine to the bridge machine.)

The problem:
ntpd wants to fuss with the values I set using adjtimex(). I want it to quit thinking it needs to adjust the clock and just serve time to the internal network. (Maybe I have a GPS time source hooked directly to the machine!)

Any idea how to tell it to stop?
I've never tried to configure it as such, but it's my understanding that you can set one of the disconnected machines to be a time server (as you've done), and give it a fudge factor of 10, with a reference server of 127.0.0.1. Granted, it will then try to update itself, but I think that NTP is going to have a problem if it doesn't find a higher stratum server further upstream.

I have done the GPS thing, and it works great...and you DO NOT have to have a specialized appliance, either. Grab a cheap (>$100 USD) USB GPS receiver only. Don't need software or anything else, as long as it generates NMEA data. Plug it into a USB port, and do "ln -s /dev/ttyUSB0 /dev/gps". From there, you can set up NTP to read the NMEA data directly, and it'll then become a live, stratum 1 server.

I wrote up instructions here:
http://www.linuxquestions.org/questi...th-gps-824129/

For my openSUSE environment, but should work on pretty much any Linux.
 
Old 07-14-2011, 12:20 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
ntpd will perform similar calculations to adjust time but does it over a period of time and do not know if it that feature can be turned off. As stated you can set up ntpd to use the local clock as a source if it can not connect to a timer server. BTW you can not run ntpdate if ntpd is already started.
 
Old 07-14-2011, 12:34 PM   #4
bramankp
LQ Newbie
 
Registered: Mar 2010
Posts: 11

Original Poster
Rep: Reputation: 0
The server's configuration file is set up with the fudge factor and pointing at the local machine (server 127.0.0.1 with fudge 127.0.0.1 stratum 10). One of the main issues is that when it starts up it's messing with the "freq" part of the timex adjustment that's already loaded. I've already calculated and set "tick" and "freq" in a call to adjtimex() so that the system clock runs accurately. I don't need ntpd to go messing with those values.

I've never had a problem running ntpdate while ntpd is running in this configuration. You just have to pass it the "-u" option so that it doesn't conflict with the NTP socket already in use.


Paul Braman
 
Old 07-15-2011, 08:58 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by bramankp View Post
The server's configuration file is set up with the fudge factor and pointing at the local machine (server 127.0.0.1 with fudge 127.0.0.1 stratum 10). One of the main issues is that when it starts up it's messing with the "freq" part of the timex adjustment that's already loaded. I've already calculated and set "tick" and "freq" in a call to adjtimex() so that the system clock runs accurately. I don't need ntpd to go messing with those values.

I've never had a problem running ntpdate while ntpd is running in this configuration. You just have to pass it the "-u" option so that it doesn't conflict with the NTP socket already in use.
Paul Braman
Well, you obviously know more about NTP than I do. The GPS receiver solution works well for me, and I've got three in an NTP pool that serve up time for the whole company. I knew about the fudge and localhost thing from when I was learning, but I've had VERY good results with the GPS devices, but I know that's not where you want to go for a solution.

Sorry, wish I could help more.
 
  


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
ntpdate/ntpd time is in UTC instead of local time? m4rtin Linux - Software 7 05-06-2011 07:57 AM
[SOLVED] Time sync in ntpd Hariharan Linux - Software 4 09-24-2010 02:36 AM
how to understand user time, sys time, wait time, idle time of CPU guixingyi Linux - Server 1 08-24-2010 10:10 AM
ntpd sets time wrong jimjones Linux - Software 1 02-19-2009 08:45 PM
ntpd time server problem MGrosskopf Linux - Networking 0 02-06-2005 08:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:42 AM.

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