컴퓨터 / Computer

NTPD를 이용한 시간 동기화

공유지기 1 4,146 2017.12.19 16:14

0_fivEmSUN_cafc0046fceae53820e6e11ed19a3a0d3034ec3c.jpg 


서버의 경우 시간 설정이 매우 중요하다. date 명령으로 해당 시간을 확인해 보면 가끔 안 맞는 경우가 있다. 한두 번 수정하는 건 rdate 명령으로 가능한데, 계속 틀린다면 동기화를 시켜 줘야 한다. 이럴 때 Network Time Protocol, 즉 NTP를 사용한다.

CentOS 기준으로 설명한다.

 

 

1. NTP 설치 

 

 

 yum install ntp 

 

 

2. NTP 설정

설정파일 : /etc/ntp.conf

 

아래 내용을 제거한다.

 

 

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

 

국내 서버로 대체한다. (목록은 http://webdir.tistory.com/120 에서 가져옴)

 

 

server kr.pool.ntp.org 

server time.bora.net 

server time.kornet.net

 

 

3. NTP 등록 

 

 

chkconfig ntpd on

 

 

4. 동작 여부 확인 

 

아래와 같이 입력하면 등록된 서버들을 보여준다.

 

 

ntpq -p 

 

 

결과 화면.

 

 

     remote           refid      st t when poll reach   delay   offset  jitter

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

*dadns.cdnetwork 204.123.2.5      2 u   52   64   77    1.613   -7.979   4.190

 time.bora.net   204.123.2.5      2 u  123   64   72    2.663    7.502   5.621

 

 

 

dadns.cdnetwork 에 "*"이 붙어 있으면 동기화 중이라고 한다.

 

 

이상. 

 

 

 

 

Comments

공유지기 2020.02.13 09:55
한국 시간대로 변경하기

timedatectl set-timezone Asia/Seoul

출처 : https://www.fun25.co.kr/blog/linux-centos-7-change-timezone/?category=001