ラズベリーパイ

ラズベリーパイ

Raspberry Piは、Centos7サーバーに属する単一の外部IP(すべてのポートを含む)にのみアクセスできるように構成されたファイアウォールの背後にあります。

Raspberry PiのUTC時間が常に正確になるように2つのデバイスを設定する方法です。

私が取った措置...

  1. サーバーでntpを構成し、サーバー0.us.pool.ntp.orgを指す、ファイアウォールを構成するなどのタスクを実行します。
  2. Piクライアントでプライマリサーバーをコメントアウトし、マイサーバーをポイントして再起動します。

ただし、約1時間程度の休憩時間があります。クライアントアクセスを許可するにはまだサーバーを構成する必要がありますか?それでは、すべてのクライアントを許可できますか?それとも私のクライアントだけを許可する必要がありますか?

ラズベリーパイ

michael@pi:~ $ ntpq -c lpeer
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 12.345.67.890   .INIT.          16 u    -   64    0    0.000    0.000   0.000
michael@pi:~ $ date -R
Tue, 20 Jun 2017 10:37:17 +0000

約24時間後

michael@pi:~ $ ntpq -c lpeer
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 74.208.80.161   .INIT.          16 u    - 1024    0    0.000    0.000   0.000
michael@pi:~ $ date -R
Wed, 21 Jun 2017 11:29:08 +0000

michael@pi:~ $ grep '^[^ #]' /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
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 12.345.67.890    #This is the Centos server
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1

中央オペレーティングシステム

[michael@centos7 ~]$ ntpq -np
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+104.156.99.226  192.12.19.20     2 u   21 1024  377   68.864    0.518   0.930
+108.59.2.24     130.133.1.10     2 u   68 1024  377   56.934   -0.234   0.881
+66.7.96.1       216.218.254.202  2 u  480 1024  367   71.228    0.149   1.752
*97.107.128.58   209.51.161.238   2 u   87 1024  377   52.881    1.430   1.507
[michael@centos7 ~]$

約12時間後

[michael@centos7 ~]$ ntpq -np
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+104.156.99.226  204.123.2.72     2 u  432 1024  377   68.857    0.466   0.128
+108.59.2.24     130.133.1.10     2 u  838 1024  377   56.550   -0.114   0.083
*66.7.96.1       216.218.192.202  2 u  911 1024  377   73.391    0.920   1.763
-97.107.128.58   209.51.161.238   2 u  655 1024  377   56.110    2.394   0.125
[michael@centos7 ~]$ date -R
Wed, 21 Jun 2017 12:30:44 +0000

[michael@centos7 ~]$ grep '^[^ #]' /etc/ntp.conf
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
server 3.us.pool.ntp.org
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
logfile /var/log/ntp.log

ベストアンサー1

DS3231 RTCモジュール(I2C)を使用し、NTPサーバーで時刻を更新します。高度なビジネスノートブックに組み込まれているRTCよりも正確です。

Raspberry Pi RTCボードAmazon用次世代DS3231リアルタイムクロックモジュール

注:カソードがバッテリーのプラス端子に直接接続されているマイクロSMDダイオードを切断/はんだ付けします。これを見つけるには、DMMで200オーム/連続性テストを使用してください。小さなガラス玉のように見えました。バッテリーを充電する必要はありませんが、一部のモジュールはまだ充電しています。

Raspberry PiにDS3231リアルタイムクロックを追加

DS1307を使用しないでください。月に数分ずつ漂流します。

アップデート:Si4703モジュールを使用して時間と日付を取得することもできます。 SparkFunsサイトをチェックしてください。

おすすめ記事