LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-18-2024, 02:53 PM   #1
lazardo
Member
 
Registered: Feb 2010
Location: SD Bay Area
Posts: 275

Rep: Reputation: Disabled
/etc/ntp.conf 'pool' vs 'server' in 15.0 and Current


In updating a gateway router running dd-wrt from DNS -> SmartDNS/DoT there is a time synchronization requirement, eg, if system clock is too far off it breaks.

This led to looking at formal NTP security models, all of which were rejected as too much effort and/or too few public NTS servers so ended up increasing the server count given ntp will manage discrepencies, and the impact of getting a rogue is negligible.

In 15.0, /etc/ntp.conf uses 'server 0.pool.ntp.org iburst' which does a one-shot DNS for each of the given servers, however, if the resolved server goes septic it is dropped but not replaced. 'pool' has a different behavior in that servers are replaced.

I changed 'server' to 'pool', and after 15 minutes, zero synchronization and zero error messages:
Code:
$ ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*127.127.1.0     .LOCL.          10 l   55   64  377    0.000   +0.000   0.000
 0.us.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 1.us.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 2.us.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 3.us.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
After removing 'nopeer' from the 'restrict' options, it worked:
Code:
$ ntpq -np
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 127.127.1.0     .LOCL.          10 l 186m   64    0    0.000   +0.000   0.000
 0.us.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 1.us.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 2.us.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 3.us.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
+155.248.196.28  135.45.28.167    2 u  313  512  377   25.902   -0.987   0.754
+45.33.103.94    192.126.175.149  3 u  156  512  377   70.656   +0.665   0.405
*44.190.5.123    17.253.4.125     2 u   96  512  377   25.826   +0.199   0.589
-44.190.40.123   66.220.9.122     2 u  301  512  377   24.383   +1.143   0.484
Update: Current was in the subject as I mistakenly saw 'pool' in Current's /etc/ntp.conf
Note this is an always-on server that provides time service to the router and other LAN clients.

Caution: See replies 4 and 5 before adjusting your ntp.conf

Last edited by lazardo; 01-24-2024 at 12:14 PM.
 
Old 01-18-2024, 04:11 PM   #2
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,854

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Quote:
Originally Posted by lazardo View Post
In Current, /etc/ntp.conf uses 'pool 0.pool.ntp.org iburst'
Do you mean you have it like that? It's a commented out 'server' command in the sample ntp.conf in -current.
Quote:
Originally Posted by lazardo View Post
After removing 'nopeer' from the 'restrict' options, it worked:
You could try adding a 'restrict source ...' line without nopeer, something like this:
Code:
restrict default limited kod nomodify notrap nopeer noquery
restrict source limited kod nomodify notrap noquery
See man ntp.conf, under 'restrict' command:
Code:
              nopeer Deny  unauthenticated packets which would result in mobi-
                     lizing a new association.  This  includes  broadcast  and
                     symmetric  active  packets  when a configured association
                     does not exist.  It also includes pool  associations,  so
                     if you want to use servers from a pool directive and also
                     want to use nopeer by default,  you'll  want  a  restrict
                     source ...  line as well that does not include the nopeer
                     directive.
 
1 members found this post helpful.
Old 01-18-2024, 04:18 PM   #3
lazardo
Member
 
Registered: Feb 2010
Location: SD Bay Area
Posts: 275

Original Poster
Rep: Reputation: Disabled
Quote:
Do you mean you have it like that? It's a commented out 'server' command in the sample ntp.conf in -current.
My diff was incorrect somehow, I'll update the post.

Thanks for the 'restrict source' pointer.

Last edited by lazardo; 01-24-2024 at 11:51 AM.
 
Old 01-24-2024, 11:49 AM   #4
lazardo
Member
 
Registered: Feb 2010
Location: SD Bay Area
Posts: 275

Original Poster
Rep: Reputation: Disabled
Here is a working 'pool' vs 'server' diff based on 15.0 '/etc/ntp.conf.new'.

'pool' has been around for some time: https://community.ntppool.org/t/reco...er-in-ntp-conf

Cheers,
Code:
--- ntp.conf.new	2023-06-06 10:07:43.000000000 -0700
+++ /tmp/ntp.conf.pool	2024-01-24 09:40:10.000705270 -0800
@@ -17,10 +17,10 @@
 
 #
 # NTP server (list one or more) to synchronize with:
-#server 0.pool.ntp.org iburst
-#server 1.pool.ntp.org iburst
-#server 2.pool.ntp.org iburst
-#server 3.pool.ntp.org iburst
+pool 0.pool.ntp.org iburst
+pool 1.pool.ntp.org iburst
+pool 2.pool.ntp.org iburst
+pool 3.pool.ntp.org iburst
 
 #
 # Full path of a directory where statistics files should be created
@@ -69,6 +69,9 @@
 restrict default limited kod nomodify notrap nopeer noquery
 restrict -6 default limited kod nomodify notrap nopeer noquery
 
+restrict source  limited kod nomodify notrap        noquery limited
+tos maxclock 5 minsane 2
+
 #
 # Use these lines instead if you do want to serve time and stats to
 # other machines on the network:

Last edited by lazardo; 01-24-2024 at 11:58 AM.
 
Old 01-24-2024, 11:53 AM   #5
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Rep: Reputation: 172Reputation: 172
See also: docs.slackware.com/howtos:network_services:ntp
 
Old 01-24-2024, 12:07 PM   #6
lazardo
Member
 
Registered: Feb 2010
Location: SD Bay Area
Posts: 275

Original Poster
Rep: Reputation: Disabled
Very complete and uptodate howto.

I wonder why PV is still using the server model?
 
Old 01-24-2024, 12:51 PM   #7
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,854

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
They recommend a single pool command, not four:
Code:
pool pool.ntp.org iburst
 
Old 01-24-2024, 01:38 PM   #8
lazardo
Member
 
Registered: Feb 2010
Location: SD Bay Area
Posts: 275

Original Poster
Rep: Reputation: Disabled
Side note for the security-minded.

Consider devices with hard-coded NTP, or that ignore DHCP offered NTP
Code:
IoT device -> gateway -> unknown server -> gateway -> time or malware
vs managed NTP
Code:
IoT device -> LAN NTP server -> time
Given a designated LAN-based NTP server, you may want to an experiment on your gateway by redirecting outbound udp port 123 to your NTP server, something like this dd-wrt specific example:
Code:
iptables -I PREROUTING -t nat -i br0 -p udp ! -s <NTP server IP> --dport 123 -j DNAT --to <NTP server IP>
Code:
if packet is outbound udp port 123 and not LAN NTP server, redirect to LAN NTP server
Common offenders: roku, appletv, webcam et al. Could be phone-home mechanism similar to hard coded DNS/DoH. Small-brained deivces typically have no resources for ntp/chrony or battery-backed nvram, and so make a lot of updates.
 
  


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: pool and nopeer in ntp.conf (-current) drumz Slackware 2 04-13-2021 03:47 PM
Does RANDOM entrpy pool init ensure /dev/urandom entrpy pool init ? RV11 Linux - General 4 04-01-2015 06:43 AM
SAN storage pool for VM Guest OS images - which pool type is best practice myc5 Linux - Virtualization and Cloud 1 11-23-2014 09:14 PM
ntp drift file in /etc/ntp instead of /var/lib/ntp - suggestion for a patch in Slack niels.horn Slackware 16 05-07-2009 07:35 PM
/etc/hosts, /etc/resolve.conf and /etc/host.conf config probs below_average Linux - Networking 1 12-08-2004 10:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:55 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