"How to NTP server configureration"

오늘은 리눅스[linux] 에서 시간동기화를 위한 NTP server 구축하는 방법에 대하여 알아보겠습니다. NTP 서버설정은 매우 간단합니다.

제일 먼저 해야 할 일은 NTP 패키지가 설치되어 있는지 확인 합니다.

linux NTP server

 패키지를 확인하는 명령어는 rpm -qa | grep ntp 입니다.

현재 그림 상에는 패키지가 설치 되어 있습니다. 그러나 업데이트를 위해 패키지를 다시 설치 합니다.

linux NTP server

NTP 패키지 설치 명령어는 yum install ntp 입니다.

linux NTP server

NTP패키지가 성공적으로 설지 되었습니다.

linux NTP server

NTP 설정파일을 VI edit로 수정을 합니다.

# 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).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap [클라이언트 허용 IP대역 추가]

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst [주석처리]
#server 1.centos.pool.ntp.org iburst  [주석처리]
#server 2.centos.pool.ntp.org iburst [주석처리]
#server 3.centos.pool.ntp.org iburst [주석처리]
server 127.127.1.0 #local clock  [로컬 서버설정 추가]

#broadcast 192.168.1.255 autokey        # broadcast server
#broadcastclient                        # broadcast client
#broadcast 224.0.1.1 autokey            # multicast server
#multicastclient 224.0.1.1              # multicast client
#manycastserver 239.255.254.254         # manycast server

위 설정만 하면 NTP 서버 설정이 완료 됩니다.

서비스 시작 명령어는 service ntpd start 입니다.

linux NTP server

NTP 확인명령어는  ntpq -pn 입니다.

linux NTP server

부팅시 NTP 데몬 자동 시작 명령어는 chkconfig ntpd on 입니다.

 

 

 

 

+ Recent posts