LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-15-2005, 07:42 AM   #1
DaveG
Member
 
Registered: Nov 2001
Location: London, UK
Distribution: Fedora 16
Posts: 160

Rep: Reputation: 43
NTP pool resolver problem


It's a problem that's been nagging me for some time - ntp.org provide a great time syschronisation service through pools of public time servers maintained as sets of DNS entries. The idea is that you configure your NTP client to use the same DNS address three or four times and the round-robin nature of DNS should provide a different IP address each time. e.g.

server uk.pool.ntp.org => 195.137.55.38
server uk.pool.ntp.org => 212.23.29.225
server uk.pool.ntp.org => 212.159.114.45
server uk.pool.ntp.org => 217.147.177.118

My problem is that the SAME address is used by ntpd each time so it will only synchronise with one peer.

Using dig/host/nslookup on the machine returns the same list of IPs, but in a different order each time, as they should. Even a little perl program returns a different IP each time using gethostbyname().

/etc/resolv.conf points to the local cacheing name server - bind-9.2.4, running on the local machine (127.0.0.1:53). This is configured to forward queries to my ISP's name servers. Querying those directly still provides a nice, random order of addresses.

I have tried using 1.uk.pool.ntp.org, 2.uk... etc. and ntpd still uses the same IP each time.

I have even toyed with redirecting *.ntp.org DNS queries directly to ntp.org's name servers. All with the same result. It's so frustrating not being able to reproduce the effect anywhere else! Used to run fine on my old RH7.2 box.

I have now run out of ideas and resorted to entering fixed addresses in to ntpd.conf.

I think the problem is either in the ntpd code or the linux resolver library, but it looks like some kind of caching problem somewhere (nscd is off). Any suggestions on where to look next would be greatly appreciated!

My server is running FC3, all kept up to date, with ntp-4.2.0.a.20040617-4 and bind-9.2.4-8_FC3.
 
Old 02-15-2005, 09:49 AM   #2
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
I am not sure exactly what you are trying to achieve but I will have a stab.
Firstly I note that my server is on top of that list. Lets firstly look at the structure of what ntpd source is and how it should work.
The ntp.conf file should have at least 3 entries;

server uk.pool.ntp.org
server uk.pool.ntp.org
server uk.pool.ntp.org

The reason for this is that ntp picks up a time from each of the servers and examines the time it took to reach it (delay), the offset ( the difference with its own setting) and the jitter (amount of variation by correction). Using at least 3 entries allows ntp to decide which is the best and therefore the best to synchonise with. You can have a look at this with the console command ntpq -p.
The reason you are probably getting the same ip's is that they are the only stable ones present at the time. pool.ntp.org monitors the servers and drops those servers whose scores are low.
The point of the pool is to distribute the ntp load over a large number of servers so that the servers (like mine) are not put under heavy loads. The pool is actually designed to rotate the servers so that they get a break every so many hours. Which brings me to the next point which may be selfish but is a fact none the less. Many of the public servers (quantum 1) have come under heavy pressure as the number of computers globally start syncing their time to them. This has reached a point when many of these servers are withdrawing their service for this reason. The same scenario applies to the pool. My own server has recently been under quite heavy pressure with loads going up to 12Kbytes/s. When I start getting these kind of loads, which I pay for, and which also affect my own services I also start getting a bit irritated.
I urge you not to use these specific IP addresses but rather to stick to the generic insertion.

Last edited by TigerOC; 02-15-2005 at 09:55 AM.
 
Old 02-15-2005, 12:32 PM   #3
DaveG
Member
 
Registered: Nov 2001
Location: London, UK
Distribution: Fedora 16
Posts: 160

Original Poster
Rep: Reputation: 43
I'd love to use the pool. The problem is that ntpd won't let me.

I don't think ntpd is discarding alternate servers, it just keeps using the same one.

If I use 3 x "uk.pool.ntp.org" I get 3 identical peers reported from ntpq, only one of which is active.

If I use 0.uk.pool.ntp.org, 1.uk.pool.ntp.org and 2.uk.pool.ntp.org then I get exactly the same! Argh!

e.g.
<pre>
/etc/ntp.conf...
server uk.pool.ntp.org
server uk.pool.ntp.org
server uk.pool.ntp.org
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10

# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
80.253.108.112 .INIT. 16 u - 64 0 0.000 0.000 4000.00
80.253.108.112 .INIT. 16 u - 64 0 0.000 0.000 4000.00
80.253.108.112 62.3.200.116 2 u 4 64 3 11.890 -3.203 0.618
127.127.1.0 LOCAL(0) 10 l 1 64 3 0.000 0.000 0.004
</pre>

The addresses returned by 'dig' etc. are all present, correct and presented in a nice round-robin order. Something must be going wrong between the DNS query and ntpd.

I think I'll have to trace the DNS queries to see what is going on here. I just downloaded the ntpd source as well. Could be in for a late night!

By the way, the IPs I used were just from 'dig uk.pool.ntp.org' rather than the entries I actually use. Luck of the draw.
 
Old 02-15-2005, 01:04 PM   #4
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
The output above is the initial query out and initially indicating that the host is unreachable (4000). Have a look at your ntp log files and see what they are reporting. Leave the system for a number of hours and see if the system stabilises. As regards your local clock, may I ask what you are using as the input for fudge?
 
Old 02-15-2005, 06:25 PM   #5
DaveG
Member
 
Registered: Nov 2001
Location: London, UK
Distribution: Fedora 16
Posts: 160

Original Poster
Rep: Reputation: 43
The local clock fudge is just to force it down to stratum 10, i.e. as a last resort so that local clients can still sync. if I loose the internet connection (Fedora core 3 default).

The ntpq output shows that, as far as ntpd is concerned, uk.pool.ntp.org = 80.253.108.112, period. The first two entries show as unreachable because they are duplicates of the only functioning server entry.

My "normal", hard-coded configuration is:
Code:
server 82.219.3.1 maxpoll 12
server 81.187.242.38 maxpoll 12
server 217.204.76.170 maxpoll 12
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10
The addresses were chosen from the uk pool. This usually reports something like:
Code:
# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+82.219.3.1      195.66.241.2     2 u  62m  68m  377   23.814   -2.221   3.211
*81.187.242.38   .MSF.            1 u  62m  68m  377   37.137    1.519   1.475
+217.204.76.170  195.40.0.250     4 u  62m  68m  377   16.469   -1.183   2.727
 127.127.1.0     LOCAL(0)        10 l   54   64  377    0.000    0.000   0.004
... just as one would expect. The maxpoll 12's are there to further reduce server polling to less than one per hour if conditions permit.

I could just cary on with the "manual" configuration but I don't want to keep picking on the same three servers when there's a better solution, i.e. the ntp pools. I just can't get ntpd to come up with round-robin addresses, and I hate not knowing why.

Thanks for the suggestions and the prompt response! Thanks also for donating your bandwith to the world of ntp.
 
Old 02-16-2005, 02:59 AM   #6
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
The use of a local clock should not be necessary as merely directing ntpd of local boxes to the primary server which is synced to an external source should be fine. Ideally the primary box should not have a drift in excess of 100. The drift file on the primary box should ensure that the clock is within 16us for a fairly long period without reference to an external source.
You have done most of the tweaks that have been suggested i.e. using 0.uk.pool.ntp.org etc .The only thing I can suggest is posing the question at;
timekeepers@fortytwo.ch
where there are people with far more insight than myself.
 
  


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 cannot work with timeserver, NTP-d can jerryvapps Linux - Networking 0 08-04-2004 03:04 PM
ntp problem,,, Anmar Linux - Software 0 03-26-2004 11:35 AM
Resolver problem: ping localhost.localdomain gives Unknown host rmd Linux - Networking 0 11-06-2003 08:58 AM
NTP problem jaycee999 Linux - Networking 3 07-31-2002 11:14 PM
ntp problem ? virtaava Linux - Newbie 0 10-09-2001 06:27 AM


All times are GMT -5. The time now is 06:13 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration