ntpd의 긴 동기화 시간 문제를 해결하는 방법은 무엇입니까?

ntpd의 긴 동기화 시간 문제를 해결하는 방법은 무엇입니까?

나는 현재 ntpd에서 엄청나게 긴 동기화 지연을 경험하고 있으며 많은 인터넷 검색 후에 "해결 방법"이 효과가 없었기 때문에 새 스레드를 시작하기로 결정했습니다.

문제의 머신은 Raspi OS "Buster"(2021년 5월 7일 Lite/비 GUI 이미지)를 실행하는 Raspberry Pi 3B입니다. 소규모 클러스터의 헤드 노드이므로 2개의 NIC가 있습니다. eth0(내장 NIC 및 내부 인터페이스)은 192.168.4.100/24로 설정되고 eth1(USB 동글 및 외부 인터페이스)은 192.168로 설정됩니다. 1.220/24. 현재 dhcpcd를 사용하여 /etc/resolvconf.conf에서 인터페이스를 구성하고 네임서버를 정의하고 있습니다. 엔테푸드~ 할 것이다결국 동기화되었지만 불과 몇 시간 후 Pi를 재부팅했을 때 ntpd는 첫 번째 위치로 돌아가서 fake-hwclock이 /etc/fake-hwclock.data에 시간을 절약하는 한 다시 시작했습니다. 몇 시간의 동기화 프로세스. /etc/fake-hwclock에 저장된 시간은 시간대 조정 시간이 아니라 UTC 시간이라는 점에 유의해야 하지만 이것이 ntpd의 동기화 시간에 영향을 미치지 않을 것이라고 생각합니다.

아래는 내 /etc/ntp.conf 파일입니다. "tinker Patrick 0" 줄의 주석 처리를 제거해도 동기화에는 전혀 영향을 미치지 않는 것 같습니다.

전체적으로 내 질문은 다음과 같습니다.

  1. 동기화 시간 지연을 줄이는 방법은 무엇입니까?

  2. ntpd가 동기화된 후 Pi를 다시 시작하면 "date" 명령을 실행하면 정확한 시간이 제공되지만 ntpd는 첫 번째 위치로 돌아가서 동기화하는 데 몇 시간이 걸립니다. 이 상황을 피하는 방법은 무엇입니까? (논리적으로 로컬 시간과 원격 시간이 몇 초만 차이가 나는 경우 로컬 시간과 원격 시간을 조정하는 데 시간이 오래 걸리지 않아야 합니다.)

systemd-timesyncd 예장애가 있는.


/etc/ntp.conf

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

#tinker panic 0

driftfile /var/lib/ntp/ntp.drift

# Leap seconds definition provided by tzdata
leapfile /usr/share/zoneinfo/leap-seconds.list

# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# You do need to talk to an NTP server or two (or three).

server time-a-g.nist.gov iburst
server time-a-wwv.nist.gov iburst

server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1

# Needed for adding pool entries
restrict source notrap nomodify noquery

# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)

broadcast 192.168.4.255

CDT 오전 11시 7분에 "uptime" 및 "ntpq -p" 출력(내 MacBook Pro 시계 기준):

charles@Chimera-Head-Node:~ $ uptime
 10:12:52 up 34 min,  1 user,  load average: 0.00, 0.00, 0.00
charles@Chimera-Head-Node:~ $ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 192.168.4.255   .XFAC.          16 B    -   64    0    0.000    0.000   0.002
 time-a-g.nist.g .INIT.          16 u    - 1024    0    0.000    0.000   0.000
 time-a-wwv.nist .INIT.          16 u    - 1024    0    0.000    0.000   0.000
 ec.sedley.net   .INIT.          16 u    - 1024    0    0.000    0.000   0.000
 ntp1.doctor.com .INIT.          16 u    - 1024    0    0.000    0.000   0.000

참고: Pi를 부팅/재부팅할 때마다 브로드캐스트 주소는 항상 .XFAC로 표시됩니다. 재장착용. 간단한 "sudo service ntp restart"를 수행하면 refid가 .BCST로 변경됩니다. (필요한 것). 아직 이 문제를 해결하지 못했습니다. 비록 다른 스레드에 대한 질문이지만 어떤 제안이라도 환영합니다 :-)

시작 시 시스템 로그 출력(ntpd/dhcpcd가 아닌 항목이 제거됨):

Sep  1 09:38:53 Chimera-Head-Node ntpd[546]: ntpd [email protected] (1): Starting
Sep  1 09:38:53 Chimera-Head-Node ntpd[546]: Command line: /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 109:114
Sep  1 09:38:53 Chimera-Head-Node systemd[1]: Started Network Time Service.
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: proto: precision = 1.458 usec (-19)
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: leapsecond file ('/usr/share/zoneinfo/leap-seconds.list'): good hash s
ignature
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: leapsecond file ('/usr/share/zoneinfo/leap-seconds.list'): loaded, exp
ire=2021-12-28T00:00:00Z last=2017-01-01T00:00:00Z ofs=37
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: Listen and drop on 0 v6wildcard [::]:123
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: Listen and drop on 1 v4wildcard 0.0.0.0:123
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: Listen normally on 2 lo 127.0.0.1:123
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: Listen normally on 3 eth1 192.168.1.220:123
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: Listen normally on 4 lo [::1]:123
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: Listen normally on 5 eth0 [fe80::ba27:ebff:fed5:8e4d%2]:123
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: Listen normally on 6 eth1 [fe80::1f2d:3bb6:af44:5cbb%3]:123
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: Listening on routing socket on fd #23 for interface updates
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
Sep  1 09:38:53 Chimera-Head-Node ntpd[554]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
Sep  1 09:38:54 Chimera-Head-Node dhcpcd[541]: eth0: using static address 192.168.4.100/24
Sep  1 09:38:54 Chimera-Head-Node dhcpcd[541]: eth0: adding route to 192.168.4.0/24
Sep  1 09:38:55 Chimera-Head-Node ntpd[554]: Listen normally on 7 eth0 192.168.4.100:123
Sep  1 09:38:55 Chimera-Head-Node ntpd[554]: 192.168.4.255 local addr 192.168.1.220 -> 192.168.4.100
Sep  1 09:38:55 Chimera-Head-Node ntpd[554]: new interface(s) found: waking up resolver
Sep  1 09:39:01 Chimera-Head-Node dhcpcd[541]: eth1: no IPv6 Routers available
Sep  1 09:39:03 Chimera-Head-Node dhcpcd[541]: eth0: no IPv6 Routers available

답변1

(원래 질문 텍스트의 일부에서 여기로 이동되었습니다.)

문제는 해결되었습니다(지금까지 이 글을 게시할 기회가 없었습니다). 솔루션은 두 부분으로 나뉩니다.

  1. 내 Synology RT-2600ac 라우터가 NTP 서비스를 활성화하는 경우그리고, 이론적으로는 포트 123이 열려 있고, 서비스를 끈 다음 방화벽 규칙을 만들었습니다.분명히모든 IP 주소에서 모든 IP 주소로 UDP 포트 123을 엽니다.

  2. 아래는 현재 제가 사용하고 있는 ntp.conf 파일입니다. 헤드 노드의 ntp.conf 상단에 있는 인터페이스 명령을 제거할 수 있는지는 모르겠지만 192.168.4.0 네트워크에 대한 제한 라인이 192.168.4.0의 NTP 배포 문제를 해결할 것이라고 확신합니다. 회로망.


클러스터 헤드 노드 ntp.conf

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

# default to listening to nothing
#
interface ignore all

# Listen on the inside interface
#
interface listen 192.168.4.100/24

# Listen on the outside interface
#
interface listen 192.168.1.220/24


driftfile /var/lib/ntp/ntp.drift

leapfile /usr/share/zoneinfo/leap-seconds.list

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable


server time-a-g.nist.gov iburst
server time-a-wwv.nist.gov iburst

server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1

restrict 192.168.4.0 mask 255.255.255.0 nomodify

# Needed for adding pool entries
restrict source notrap nomodify noquery

클러스터 컴퓨팅 노드 ntp.conf

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift

# Leap seconds definition provided by tzdata
leapfile /usr/share/zoneinfo/leap-seconds.list

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable


# You do need to talk to an NTP server or two (or three).

server 192.168.4.100 iburst


# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1

# Needed for adding pool entries
restrict source notrap nomodify noquery

위 파일은 지금까지 제대로 작동하는 것 같습니다.

관련 정보