You are not logged in.

#1 2024-01-01 00:28:19

vorlket
Member
Registered: 2017-09-30
Posts: 112

[SOLVED] NTP synchronization

I have two machines: server and miniserver and ran the following commands

server:

sudo pacman -S openmpi
cd ~/.ssh
ssh-keygen -t rsa
cp id_rsa.pub authorized_keys
chmod 600 authorized_key
sssh-copy-id miniserver
sudo vi /etc/ssh/sshd_config: Add the following lines
	PubkeyAuthentication yes
	RSAAuthentication yes
sudo pacman -S ntp
sudo vi /etc/ntp.conf: Add the following lines
	tos orphan 15
	logfile /var/log/ntp.log
sudo ntpd -u ntp:ntp
sudo systemctl start ntpd.service
sudo systemctl enable ntpd.service
sudo pacman -S nfs-utils
mkdir ~/sharedfolder
chmod 777 ~/sharedfolder
sudo vi /etc/exports:
	/home/vorlket/sharedfolder      miniserver(rw,sync)
sudo exportfs -arv
sudo systemctl start nfs-server.service
sudo systemctl enable nfs-server.service

miniserver:

sudo pacman -S openmpi
cd ~/.ssh
ssh-keygen -t rsa
cp id_rsa.pub authorized_keys
chmod 600 authorized_key
sssh-copy-id server
sudo vi /etc/ssh/sshd_config:
	PubkeyAuthentication yes
	RSAAuthentication yes
sudo pacman -S ntp
sudo pacman -S nfs-utils
mkdir ~/sharedfolder
chmod 777 ~/sharedfolder
sudo mount server:/home/vorlket/sharedfolder /home/vorlket/sharedfolder

Now, I want to know: how to get miniserver synchronize to the ntpd running on server.

Last edited by vorlket (2024-01-05 14:48:16)

Offline

#2 2024-01-01 14:01:30

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,096

Re: [SOLVED] NTP synchronization

We prefer one questioin per topic and your 3 questions are not related. please create seperate threads.

Let's keep this thread about the nptd question .

1. how to get miniserver synchronize to the ntpd running on server;

server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 3.pool.ntp.org iburst

replace the addresses / names in those lines with the ones used by your server .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2024-01-01 20:29:22

vorlket
Member
Registered: 2017-09-30
Posts: 112

Re: [SOLVED] NTP synchronization

Both miniserver and server are not connected to the internet.

Last edited by vorlket (2024-01-01 20:29:43)

Offline

#4 2024-01-01 22:31:02

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,048

Re: [SOLVED] NTP synchronization

So?

If you want to use the ntp server on "server" as ntp server on "miniserver", you'll have to configure the "miniservers" /etc/ntp.conf to use the "server" as server, whether by domain or IP.
Whether there's an internet connection doesn't matter, but there needs to be *some* network connection (same LAN segment, local router, …)

NTP is the "Network Time Protocol", it doesn't make any sense w/o a network.

Offline

#5 2024-01-01 22:55:57

vorlket
Member
Registered: 2017-09-30
Posts: 112

Re: [SOLVED] NTP synchronization

Ok. They are connected in a LAN and connected to the internet when needed, i.e. not always connected to the internet. Let me change the configuration file and check. Thanks.

Offline

#6 2024-01-02 01:58:40

vorlket
Member
Registered: 2017-09-30
Posts: 112

Re: [SOLVED] NTP synchronization

$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 server          .XFAC.          16 u    2   64    0    0.000   +0.000   0.000

Is this a correct setup?

10 mins later:

$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*server          220.158.215.20   3 u   15   64   77    0.379   +0.251   0.630

Last edited by vorlket (2024-01-02 02:12:03)

Offline

#7 2024-01-02 10:00:02

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,048

Re: [SOLVED] NTP synchronization

Your "server" gets resolved to a publically routable IP that belongs to telesmart.co.nz?

Offline

#8 2024-01-03 05:19:13

vorlket
Member
Registered: 2017-09-30
Posts: 112

Re: [SOLVED] NTP synchronization

When not connected to the internet:

[vorlket@server ~]$ ntpq -p
No association ID's returned
[vorlket@miniserver ~]$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 server          .XFAC.          16 u   34  128    0    0.000   +0.000   0.000

When connected to the internet:

[vorlket@server ~]$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 180-150-99-115. .STEP.          16 u    -   64    0    0.000   +0.000   0.000
*time.cloudflare 10.236.8.7       3 u   36   64    1    7.479   +0.015   0.530
 pauseq4vntp2.da .STEP.          16 u  966   64    0    0.000   +0.000   0.000
 220.158.215.20  .STEP.          16 u  805   64    0    0.000   +0.000   0.000
[vorlket@miniserver ~]$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 server          162.159.200.123  4 u   11  256    1    0.714  -371.62   0.000

Offline

#9 2024-01-03 08:02:48

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,048

Re: [SOLVED] NTP synchronization

Maybe post your /etc/ntp.conf and the output of "ping -c1 server"
"nmap -p 123 server" will btw tell you whether "server" listens on the NTP port

Offline

#10 2024-01-03 09:53:55

vorlket
Member
Registered: 2017-09-30
Posts: 112

Re: [SOLVED] NTP synchronization

[vorlket@server ~]$ cat /etc/ntp.conf
# Please consider joining the pool:
#
#     http://www.pool.ntp.org/join.html
#
# For additional information see:
# - https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon
# - http://support.ntp.org/bin/view/Support/GettingStarted
# - the ntp.conf man page

# Associate to Arch's NTP pool
server 0.arch.pool.ntp.org iburst
server 1.arch.pool.ntp.org iburst
server 2.arch.pool.ntp.org iburst
server 3.arch.pool.ntp.org iburst

tos orphan 15

# By default, the server allows:
# - all queries from the local host
# - only time queries from remote hosts, protected by rate limiting and kod
restrict default kod limited nomodify nopeer noquery notrap
restrict 127.0.0.1
restrict ::1

# Location of drift file
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

[vorlket@miniserver ~]$ cat /etc/ntp.conf
# Please consider joining the pool:
#
#     http://www.pool.ntp.org/join.html
#
# For additional information see:
# - https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon
# - http://support.ntp.org/bin/view/Support/GettingStarted
# - the ntp.conf man page

# Associate to Arch's NTP pool
#server 0.arch.pool.ntp.org
#server 1.arch.pool.ntp.org
#server 2.arch.pool.ntp.org
#server 3.arch.pool.ntp.org

server 192.168.1.3

# By default, the server allows:
# - all queries from the local host
# - only time queries from remote hosts, protected by rate limiting and kod
restrict default kod limited nomodify nopeer noquery notrap
restrict 127.0.0.1
restrict ::1

# Location of drift file
driftfile /var/lib/ntp/ntp.drift
[vorlket@miniserver ~]$ ping -c1 server
PING server (192.168.1.3) 56(84) bytes of data.
64 bytes from server (192.168.1.3): icmp_seq=1 ttl=64 time=0.246 ms

--- server ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.246/0.246/0.246/0.000 ms
[vorlket@miniserver ~]$ nmap -p 123 server
Starting Nmap 7.94 ( https://nmap.org ) at 2024-01-03 20:53 AEDT
Nmap scan report for server (192.168.1.3)
Host is up (0.00079s latency).

PORT    STATE  SERVICE
123/tcp closed ntp

Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds

Offline

#11 2024-01-03 13:24:30

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,048

Re: [SOLVED] NTP synchronization

Well, 123 is closed on that host, not even filtered.
On the server, check

ss -tulpen | grep 123

Offline

#12 2024-01-03 16:21:56

just4arch
Member
Registered: 2023-01-07
Posts: 126

Re: [SOLVED] NTP synchronization

NTP uses udp

nmap -sU -p 123 server

ntpd can be finicky you might need a line like

restrict *serverip*

on miniserver. And probably a "prefer" on the server line as well.

If you want to keep serving wih no internet:

server 127.127.1.0
fudge 127.127.1.0 stratum 10

in the server's ntp.conf but your clocks WILL drift by the server drift.


That said, is there a requirement for using ntpd instead of just systemd-timesyncd.service on the miniserver?

Offline

#13 2024-01-05 00:21:16

vorlket
Member
Registered: 2017-09-30
Posts: 112

Re: [SOLVED] NTP synchronization

[vorlket@miniserver ~]$ sudo nmap -sU -p 123 server
Starting Nmap 7.94 ( https://nmap.org ) at 2024-01-05 11:19 AEDT
Nmap scan report for server (192.168.1.3)
Host is up (0.00022s latency).

PORT    STATE SERVICE
123/udp open  ntp
MAC Address: 00:0A:F7:7A:14:12 (Broadcom)

Nmap done: 1 IP address (1 host up) scanned in 0.27 seconds
[vorlket@server ~]$ ntpq -p
No association ID's returned
[vorlket@miniserver ~]$ ntpq -p                                                      remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 server          .XFAC.          16 u  261 1024    0    0.000   +0.000   0.000

No requirement, the NFS page says install NTP.

Offline

#14 2024-01-05 05:16:49

vorlket
Member
Registered: 2017-09-30
Posts: 112

Re: [SOLVED] NTP synchronization

Restarted my servers and now,

[vorlket@server ~]$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*LOCAL(0)        .LOCL.          10 l   35   64  377    0.000   +0.000   0.000

[vorlket@miniserver ~]$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 server          LOCAL(0)        11 u    6   64    7    0.396  -1687.2   1.732

Offline

#15 2024-01-05 08:10:48

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,048

Re: [SOLVED] NTP synchronization

No requirement, the NFS page says install NTP.

wtf are you talking about?

The Wiki wrote:

It is highly recommended to use a time synchronization daemon to keep client/server clocks in sync. Without accurate clocks on all nodes, NFS can introduce unwanted delays.

Is this a massive https://en.wikipedia.org/wiki/XY_problem
You don't have to run your own NTP server to use NFS, just make sure the system times are correct on all nodes.

Offline

#16 2024-01-05 14:47:39

vorlket
Member
Registered: 2017-09-30
Posts: 112

Re: [SOLVED] NTP synchronization

Ok, thanks.

Offline

Board footer

Powered by FluxBB