OpenNTPd は Alpine Linux では動作しません。

OpenNTPd は Alpine Linux では動作しません。

Clean Alpine Linuxインストールで実行

apk add openntpd
service openntpd start
rc-update add openntpd

/etc/ntpd.conf次に、次のように修正します。

# $OpenBSD: ntpd.conf,v 1.16 2019/11/06 19:04:12 deraadt Exp $
#
# See ntpd.conf(5) and /etc/examples/ntpd.conf

servers pool.ntp.org
server time.cloudflare.com
sensor *

constraint from "9.9.9.9"              # quad9 v4 without DNS
constraint from "2620:fe::fe"          # quad9 v6 without DNS
constraints from "www.google.com"      # intentionally not 8.8.8.8

listen on 0.0.0.0

そして走る

service openntpd restart

別のコンピュータでサーバーに対してポートチェックを実行すると、そのnmapコンピュータがNTP要求を受信して​​いないため、正常に動作しないように見えます。

サーバーを再起動するときのマイログ、カーネルログのフィルタリング、古いログの削除、sshdログイン行のフィルタリング

Feb  3 12:05:40 ns1 user.debug : Will stop /usr/sbin/ntpd
Feb  3 12:05:40 ns1 user.debug : Will stop PID 2480
Feb  3 12:05:40 ns1 user.debug : Sending signal 15 to PID 2480
Feb  3 12:05:59 ns1 daemon.info init: starting pid 2815, tty '': '/sbin/openrc shutdown'
Feb  3 12:05:59 ns1 user.debug : Will stop /usr/sbin/sshd
Feb  3 12:05:59 ns1 user.debug : Will stop PID 2526
Feb  3 12:05:59 ns1 user.debug : Sending signal 15 to PID 2526
Feb  3 12:05:59 ns1 auth.info sshd[2526]: Received signal 15; terminating.
Feb  3 12:05:59 ns1 auth.info sshd[2739]: Exiting on signal 15
Feb  3 12:05:59 ns1 user.debug : Will stop /usr/sbin/ntpd
Feb  3 12:05:59 ns1 user.debug : Will stop PID 2796
Feb  3 12:05:59 ns1 user.debug : Sending signal 15 to PID 2796
Feb  3 12:06:00 ns1 user.debug : Will stop PID 2451
Feb  3 12:06:00 ns1 user.debug : Sending signal 15 to PID 2451
Feb  3 12:06:00 ns1 user.debug : Will stop /usr/sbin/crond
Feb  3 12:06:00 ns1 user.debug : Will stop PID 2416
Feb  3 12:06:00 ns1 user.debug : Sending signal 15 to PID 2416
Feb  3 12:06:00 ns1 user.debug : Will stop /sbin/syslogd
Feb  3 12:06:00 ns1 user.debug : Will stop PID 2363
Feb  3 12:06:00 ns1 syslog.info syslogd exiting
Feb  3 12:06:18 ns1 syslog.info syslogd started: BusyBox v1.36.1
Feb  3 12:06:18 ns1 daemon.info init: starting pid 2343, tty '': '/sbin/openrc default'
Feb  3 12:06:18 ns1 cron.info crond[2389]: crond (busybox 1.36.1) started, log level 8
Feb  3 12:06:19 ns1 auth.info sshd[2501]: Server listening on 0.0.0.0 port 22.
Feb  3 12:06:19 ns1 auth.info sshd[2501]: Server listening on :: port 22.
Feb  3 12:06:19 ns1 daemon.info init: starting pid 2502, tty '/dev/tty1': '/sbin/getty 38400 tty1'
Feb  3 12:06:19 ns1 daemon.info init: starting pid 2503, tty '/dev/tty2': '/sbin/getty 38400 tty2'
Feb  3 12:06:19 ns1 daemon.info init: starting pid 2507, tty '/dev/tty3': '/sbin/getty 38400 tty3'
Feb  3 12:06:19 ns1 daemon.info init: starting pid 2511, tty '/dev/tty4': '/sbin/getty 38400 tty4'
Feb  3 12:06:19 ns1 daemon.info init: starting pid 2514, tty '/dev/tty5': '/sbin/getty 38400 tty5'
Feb  3 12:06:19 ns1 daemon.info init: starting pid 2518, tty '/dev/tty6': '/sbin/getty 38400 tty6'
Feb  3 12:06:19 ns1 daemon.info init: starting pid 2523, tty '/dev/ttyS0': '/sbin/getty -L 0 ttyS0 vt100'

この設定がNTPサーバーにならないのはなぜですか?

ベストアンサー1

反対の唯一のソースが稼働しているため、NTP サーバーが稼働している可能性があります。地図(1).に定めるようにhttps://superuser.com/a/1656244地図デフォルトではTCPポートのみがテストされ、NTPはUDPを使用します。

ただし、ファイアウォールを使用する場合(例:ウプボ(8)NTPポートは着信接続を許可するように明示的に設定する必要があります。たとえば、次のコマンドを使用します。

# ufw allow ntp

または同様です。

残念ながら、現在OpenNTPDにはサーバーが実際に動作しているかどうかをテストするための直接コマンドは含まれていませんが、他のプログラムを使用してテストすることは可能です。例えば、日付(8)(およびntpdate -q)、NTPクライアントあるいは、同様のプログラムを使用することもできます。他のオペレーティングシステム(Windowsなど)を使用するネットワークピアは、日付と時刻のコントロールパネルでサーバーにNTPを照会するように設定することもでき、接続エラーを報告する必要があります。

おすすめ記事