![로컬 NTP 서비스 사용](https://rvso.com/image/36015/%EB%A1%9C%EC%BB%AC%20NTP%20%EC%84%9C%EB%B9%84%EC%8A%A4%20%EC%82%AC%EC%9A%A9.png)
나는 LAN에 있는 다른 시스템에서 시간을 얻기 위해 외부 인터넷 액세스가 없는 시스템(A)을 얻으려고 합니다(B).
A의 ntp.conf(전체 내용은 맨 아래에 있음)에 다음을 추가했습니다.
server 192.168.2.102
restrict 192.168.2.102
B의 IP를 참조합니다. 한 시간 동안 매뉴얼 페이지를 읽고 온라인 예제 등을 살펴본 후에는 해당 로컬 서버를 사용하고 무엇이든 신뢰한다는 의미일 것입니다.
그러나 작동하지 않습니다. 에서 두 개의 교환 시간을 볼 수 wireshark
있으며 ntpq -p
A 쇼에서 실행됩니다.
remote refid st t when poll reach delay offset jitter
==============================================================================
192.168.2.102 .INIT. 16 u 16 64 0 0.000 0.000 0.000
ntpd
A에서 중지하고 시도하면 ntpd -gq
다시 Wireshark에서 앞뒤로 볼 수 있지만 1~2분 후에 "서버를 찾을 수 없습니다"라는 메시지와 함께 명령 시간이 초과됩니다.
나는 A의 conf에 추가하려고 시도했습니다.
fudge 192.168.2.102 stratum 1
아무런 차이가 없습니다.
ntpd가 특정 서버의 시간을 설정하도록 하려면 어떻게 해야 합니까?ntpdate
이전 에는 감가 상각되고 시스템에 존재하지 않는 --를 사용하면 충분히 쉬웠던 것 같습니다 .
여기에 머신 A의 전체 ntp.conf가 있습니다. 이것은 기본 데비안 wheezy입니다. 내가 변경한 유일한 변경 사항은 192.168.2.102와 관련된 행을 추가하고 데비안 풀 서버를 주석 처리하여 혼란을 없애려고 노력한 것입니다. 그러면 어쨌든 연결할 수 없습니다.
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
# 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 ntp.your-provider.example
server 192.168.2.102
restrict 192.168.2.102
fudge 192.168.2.102 stratum 1
# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will
# pick a different set every time it starts up. Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
#server 0.debian.pool.ntp.org iburst
#server 1.debian.pool.ntp.org iburst
#server 2.debian.pool.ntp.org iburst
#server 3.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.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust
# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255
# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines. Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient
답변1
다음과 같이 작동해야 합니다.
restrict default ignore
restrict 127.0.0.1 nomodify
restrict 192.168.2.102 mask 255.255.255.0 nomodify notrap noquery
server 192.168.2.102 burst iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 10
답변2
나는 그것을 작동시켰으므로 후세를 위해 #ntp
(freenode)의 누군가가 B가 자신을 동기화된 것으로 보고하지 않으면 머신 A가 만족스럽지 않을 수 있다고 말했습니다. 이는 ntpq -p
B에서 별표가 앞에 붙은 서버를 표시하지 않는 경우 관찰할 수 있습니다 .
로컬 소스 퍼징비(시스템 시계를 검사하여 실제로 동기화를 수행함) 다음을 수정했습니다.
server 127.127.1.0
fudge 127.127.1.0 stratum 10
그러나 다음이 중요합니다.~ 아니다그 일을 해ㅏ왜냐하면 "로컬 동기화된" 머신 B를 무엇으로 간주하든지 Stratum 10을 더 신뢰하기 때문입니다.