1. NTP
- 시간을 맞추기 위한 통신망 시간 프로토콜
- UDP 123을 사용, 포트 오픈 필요
- 우리나라에서 운영되는 NTP 서버
kr.pool.ntp.org
time.bora.net
time.nuri.net
2. NTP 설치
$ yum install ntp
3. ntpd 사용 설정
$ systemctl enable ntpd
4. NTP 설정
- 시간 동시화를 받기위한 peer 설정
- /etc/ntp.conf에서 기본 설정을 주석처리 후, 국내 NTP 서버 또는 IP 입력
vi /etc/ntp.conf
...
#server 2.centos.pool.ntp.org
server time.bora.net
server 192.168.56.100
5. ntpd 재시작
$ systemctl restart ntpd
6. NTP 확인
$ ntpq -pn
* : 현재 sync 중
+ : 접속은 가능하지만, sync하고 있지는 않음
- : 접속은 가능하지만, sync 가능 리스트에서 제외
blank : 접속이 불가능 함
참고1. ntpdate 명령어 사용하여 시간 동기화
(1) ntp 데몬 중지
$ service ntpd stop
(2) 시간 동기화
$ ntpdate 10.10.100.100
참고2. ntp 서버와 시간 차이 확인방법
ntpdate -d 10.10.100.100
참고3. 매일 새벽에 시간동기화 Crontab 등록
(1) ntp 데몬 중지, disable
$ service ntpd stop
$ systemctl disable ntpd.service
(2) 스크립트 작성
/application/script/ntp.sh |
#!/bin/bash
/usr/sbin/ntpdate 10.10.10.1 >> /app/script/ntp.log 2>&1
(3) Crontab 등록
$ crontab -e
30 3 * * * /application/script/ntp.sh
'Linux' 카테고리의 다른 글
[CentOS7] 마운트설정 fstab, rc.local (0) | 2020.06.24 |
---|---|
[Linux] CentOS repository 설정 (0) | 2020.05.21 |
[Linux] CentOS7 default gateway 설정 (0) | 2020.03.18 |
[Linux] CentOS7 ssh 포트 변경 (0) | 2020.03.17 |
[Linux] shutdown, reboot 명령어 (0) | 2020.03.16 |