본문 바로가기

NTP Server, Client 구축

오토씨 2014. 1. 21.
참고 URL : http://annyung.oops.org/?m=white&p=ntp

1. 구축 구성도(간단)

실제 구축 대상은 Stratum3, peer 이다. 


2. Stratum3, NTP 설치

# yum -y install ntp


3. Stratum3, ntp.conf 설정

# vi /etc/ntp.conf
...

restrict default nomodify notrap noquery

restrict 127.0.0.1

restrict -6 ::1

restrict 59.*.*.0 mask 255.255.255.0 nomodify notrap

server time.bora.net

server ntp1.epidc.co.kr

server time2.kriss.re.kr

server time.wonkwang.ac.kr

* restrict default nomodify notrap noquery -> restrict 설정은 peer 들이 서보로 sync 하는 것을 제한 한다. 이 설정은 기본으로 모든 권한을 주지 않음을 의미 한다.
* restrict 127.0.0.1 -> 서버 자신에서는 모든 권한을 가진다.
* restrict 59.*.*.0 mask 255.255.255.0 nomodify notrap -> 해당 범위에서는 질의를 할 수 있는 권한을 가지도록 설정한다.
* server time.bora.net -> 시간을 동기화할 Stratum2 서버를 등록한다.

# service ntpd start
# chkconfig ntpd on 


4. Stratum3, ntpq 명령으로 sync 확인

# ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter

================================================================

+time.bora.net   90.1.14.51       2 u  476  512  137    4.500    3.572   3.962

*ntp1.sjtel.net  192.168.18.6     2 u    -  512  377    5.412   -3.176   1.696

-210.98.16.101   210.98.16.100    3 u  344  512  137    5.852   -1.631   1.064

+mrtg.wonkwang.a 129.6.15.28      2 u  315  512  377    6.941    1.117   1.247 

ntpd 를 실행하고 5분 정도 기다리면 sync가 진행된다.
* remote -> sync를 하는 Stratum2 서버 주소이다.
* refid -> 각 Stratum2 서버가 현재 sync 하고 있는 Stratum1 서버 정보이다.
* st -> 각 라인의 remote의 Stratum 정보가 표시된다. st가 16일 경우 해당 서버에 접속할 수 없을을 뜻한다.

** remote 앞에 붙는 기호의 의미
"*" -> 현재 sync를 잘 받고 있음을 의미 한다.
"+" -> ntp 알고리즘에 의해 접속은 가능하지만 sync를 하고 있지 않음을 의미 한다.
"-" -> ntp 알고리즘에 의해 접속은 가능하지만 sync 가능 리스트에서 제외 되었음을 의미 한다.
blank -> 접속이 불가능함을 의미 한다.

sync를 잘 받고 있는 서버가 없을 경우 peer에서 시간 동기화 시도하면 아래와 같은 메세지가 발생한다.

# ntpdate 59.*.*.54
21 Jan 21:08:06 ntpdate[3005]: no server suitable for synchronization found 


5. peer, 설정(crontab)

# crontab -e
0 * * * * /usr/sbin/ntpdate -s -b -p 8 -u 59.*.*.54 > /dev/null 2>&1 



댓글