본문
NTP 서버 설정
리눅스 & 네트워크설정 2019. 8. 14. 18:13
NTP는 기본적으로 서버에 설치되어있고, 포트는 UDP123이 고정으로 된다.
※ ntp 설치: yum install -y ntp
A. /etc/ntp.conf
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
##Copy from SORIA-DEV
driftfile /var/lib/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
# Specify one or more NTP servers.
server 127.127.1.0
fudge 127.127.1.0 stratum 10
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server time.bora.net
server time.nuri.net
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com
# 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
B. 인바운드 설정
iptables -I INPUT 1 -p udp --dport 123 -j ACCEPT
※ NTP default port: 123
C. 리눅스 로컬서버 열린 포트 확인 (UDP)
netstat -unl
netstat -an | grep -v grep | grep ":port"
ex) netstat -an | grep -v grep | grep ":123"
D. NTP Server 기동 명령
# service ntpd start
# service ntpd stop
NTP 서버 동작 확인하기
Windows OS에서 Target Server NTP 기능 점검
w32tm /stripchart /computer:example-host-ip /dataonly
※ NTP 서버 통신이 실패한다면 - 포트 점검필요
→ 포트 및 방화벽 확인 및 포트 열기: https://server-engineer.tistory.com/418
댓글