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

(元の質問テキストの一部からここに移動しました。)

問題は解決しました(これまでこの記事を投稿する機会はありませんでした)。解決策は2つの部分に分けられます。

  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

上記のファイルはこれまで正しく機能しているようです。

おすすめ記事