OpenNTPd가 알파인 Linux에서 작동하지 않습니다.

OpenNTPd가 알파인 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를 쿼리하도록 설정할 수도 있으며 연결 오류를 보고해야 합니다.

관련 정보