ntp 설치
yum으로 ntp 를 설치한다.
[root@localhost ~]# yum -y install ntpLoaded plugins: fastestmirror...Dependency Installed: autogen-libopts.x86_64 0:5.18-5.el7 ntpdate.x86_64 0:4.2.6p5-19.el7.centos.1Complete!
ntp 서버 환경을 설정
환경 파일 위치
/etc/ntp.conf
편집기로 화일을 수정하자.
[root@localhost ~]# vi /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).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 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.1restrict ::1# Hosts on local network are less restricted.# 18번째줄의 시각 동기를 허용하는 범위를 설정하자. restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap# 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 iburstserver 1.kr.pool.ntp.org
실행 및 서비스 등록
서비스 실행
[root@localhost ~]# systemctl start ntpd
서비스 등록
[root@localhost ~]# systemctl enable ntpd
동작확인
- 올바르게 동작하는지 학인해 보자.
[root@localhost ~]# ntpq -p
remote refid st t when poll reach delay offset jitter==============================================================================*dadns.cdnetwork 133.100.8.2 2 u 24 64 1 2.903 -0.610 0.000
tag : ntp, centos