CentOS에서 NTP 서버 구축하기 (타임서버)
CentOS에서 NTP 서버 구축하기
공통
CentOS 6.8에서 구축
Server : 192.168.0.127
Client : 192.168.0.124
##NTP 관련 패키지 설치 여부 확인
[root@localhost ~]# rpm -qa | grep ntp
[root@localhost ~]# yum -y install ntp
설정(Server)
[root@localhost ~]# vi /etc/ntp.conf
# 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
## 위 내용 추가 192.168.0.대역의 IP NTP 허용
# 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
설정(Client)
[root@localhost ~]#
# 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에서 확인
[root@localhost ~]# ntpq -pn
remote refid st t when poll reach delay offset jitte r
==============================================================================
*127.127.1.0 .LOCL. 5 l 51 64 17 0.000 0.000 0.00 0
우선순위
[root@localhost ~]# vi /etc/ntp.conf
...
restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
# local clock
server 127.127.1.0
fudge 127.127.1.0 stratum 10
127.127.1.0 이 localtime이고 stratum이 우선 순위이다. 낮을 수록 우선하게 되는데 10을 줌으로써 localtime의 우선순위를 낮춘다.
혹은
[root@localhost ~]# vi /etc/ntp.conf
/etc/ntp.conf
...
server 192.168.0.127 prefer
prefer 옵션을 주면 기준이 된다.