[ntp:questions] how to configure ntp for conditional use of servers, depending on my LAN status?

Terje Mathisen "terje.mathisen at tmsw.no" at ntp.org
Fri Jan 11 07:34:18 UTC 2013

Marco Marongiu wrote:
> On 09/01/13 20:21, dar8757 at eml.cc wrote:
>> i'm not sure if/how to implement this conditional fallback 'logic' for
>> ntp's server selection.
> I had a similar problem, and I use cfengine to solve that: depending on
> the network to which I am attached, my ntpd gets a different
> configuration: Italian pool servers when I am in Italy, Norwegian pool
> servers when I am in Norway, but not in the office; and our office
> servers when I am in the office
> You can find some information about my location detection policy here:
> http://my.opera.com/marcomarongiu/blog/2012/11/24/location-detection-in-cfengine
> I shall write a post to describe the policy I use to write ntp.conf and
> restart the service. Unfortunately, I've been quite busy lately and
> wasn't able to make some room for that.

Modern ntpd versions (i.e. those that can use the pool attribute) can 
also easily handle multiple sets of servers in the same ntp.conf file.

Have you tried having a single static ntpd.conf file that contains 
something like:

pool no.pool.ntp.org
pool it.pool.ntp.org
server office1
server office2

I do recognize that it is probably faster to simply rewrite/restart than 
to wait for the pool logic to replace most of the Italian servers with 
Norwegian ones!


- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

More information about the questions mailing list