공유할 서비스 선택

TECH


TECH

OS [Linux] RHEL7 ntp서버 시간 동기화

페이지 정보

작성자 partner_test 아이디로 검색 전체게시물 댓글 0건 조회 12,539회 좋아요 1회 작성일 19-05-29 07:32

본문

 

timedatectl’명령은 시스템의 현재 시간, 시간대 및 NTP 동기화 설정을 포함하여 현재 시간과 관련된 시스템 설정의 개요를 표시
 

[root@localhost ~]# timedatectlLocal time: Thu 2017-09-21 00:12:58 KSTUniversal time: Wed 2017-09-20 15:12:58 UTC
RTC time: Wed 2017-09-20 15:12:58

Time zone: Asia/Seoul (KST, +0900)

NTP enabled: yes

NTP synchronized: no

RTC in local TZ: no

DST active: n/a

 

list-timezones 옵션을 사용하면 설정가능한 시간대 목록을 출력.

[root@localhost ~]# timedatectl list-timezonesAfrica/AbidjanAfrica/Accra
Africa/Addis_Ababa

Africa/Algiers

Africa/Asmara

Africa/Bamako

Africa/Bangui

Africa/Banjul

Africa/Bissau

Africa/Blantyre

 

시간대를 서울로 변경

[root@localhost ~]# timedatectl set-timezone Asia/Seoul
[root@localhost ~]# timedatectl

Local time: Thu 2017-09-21 00:12:58 KST

Universal time: Wed 2017-09-20 15:12:58 UTC

RTC time: Wed 2017-09-20 15:12:58

Time zone: Asia/Seoul (KST, +0900)

NTP enabled: yes

NTP synchronized: no

RTC in local TZ: no

DST active: n/a

 

 

set-ntp 옵션은 자동 시간 조정을 위한 NTP 동기화를 활성화 또는 비활성화합니다.

timedatectl set-ntp true / false

 

chronyd 서비스 : 일반적으로 부정확한 로컬 하드웨어 클록(RTC)을 구성된 NTP 서버에 동기화하면서 계속 추적합니다. 네트워크 연결이 불가능한 경우에는 /etc/chrony.conf 구성 파일에 지정된 driftfile에 기록되는 계산된 RTC 클록 드리프트에 동기화합니다.

 

/etc/chrony.conf 파일

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).

server 0.rhel.pool.ntp.org iburst

server 1.rhel.pool.ntp.org iburst

server 2.rhel.pool.ntp.org iburst

server 3.rhel.pool.ntp.org iburst

 

# Ignore stratum in source selection.

stratumweight 0

 

# Record the rate at which the system clock gains/losses time.

driftfile /var/lib/chrony/drift

 

# Enable kernel RTC synchronization.

rtcsync

 

# In first three updates step the system clock instead of slew

# if the adjustment is larger than 10 seconds.

makestep 10 3

 

# Allow NTP client access from local network.

#allow 192.168/16

 

# Listen for commands only on localhost.

bindcmdaddress 127.0.0.1

bindcmdaddress ::1

 

# Serve time even if not synchronized to any NTP server.

#local stratum 10

 

keyfile /etc/chrony.keys

 

# Specify the key used as password for chronyc.

commandkey 1

 

# Generate command key if missing.

generatecommandkey

 

# Disable logging of client accesses.

noclientlog

 

# Send a message to syslog if a clock adjustment is larger than 0.5 seconds.

logchange 0.5

 

logdir /var/log/chrony

#log measurements statistics tracking

 

server 행의 첫 번째 인수는 NTP 서버의 IP 주소나 DNS 이름입니다. IP나 DNS주소 뒤에 서버의 옵션들이 나열될 수 있습니다. 서비스가 시작된 후에는 보다 정확한 초기 클록 동기화를 위해 네 가지 측정이 이루어지므로 iburst 옵션을 사용하는 것이 좋습니다.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).server xxx.xxx.xxx.xxx iburstserver ntp.server.domain iburst
 

systemctl restart chronyd 재시작

 

chronyc 명령어는 chronyd의 클라이언트 역할을 한다. NTP 서버가 시스템 클록을 동기화되었는지 확인해야한다.

chronyc sources -v를 사용하여 확인

[root@localhost ~]# chronyc sources -v210 Number of sources = 0
.– Source mode ‘^’ = server, ‘=’ = peer, ‘#’ = local clock.

/ .- Source state ‘*’ = current synced, ‘+’ = combined , ‘-‘ = not combined,

| / ‘?’ = unreachable, ‘x’ = time may be in error, ‘~’ = time too variable.

|| .- xxxx [ yyyy ] +/- zzzz

|| Reachability register (octal) -. | xxxx = adjusted offset,

|| Log2(Polling interval) –. | | yyyy = measured offset,

|| \ | | zzzz = estimated error.

|| | | \

MS Name/IP address Stratum Poll Reach LastRx Last sample

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

^* ntp.server.domain 8 6 17 23 -497ns[-7000ns] +/- 956us

ntp.server.domain ntp서버가 정상적으로 ^* 동기화 되었음을 나타낸다. 

댓글목록

등록된 댓글이 없습니다.

TECH 목록
번호 제목 작성자 작성일 조회수
188 OS OSworker 아이디로 검색 전체게시물 01-23 251
Red Hat 업무별 직군들에 대해 알아보겠습니다. #AM #GPS #TSE #TAM

카테고리 : OS

251 0
작성자 : OSworker 24/01/23
187 Middleware 미들웨어 아이디로 검색 전체게시물 01-19 177
(오픈소스 활용-26) scouter 2.22 에서 Weblogic14 모니터링 등록 중 이슈 조치방법

카테고리 : Middleware

177 0
작성자 : 미들웨어 24/01/19
186 OS OSworker 아이디로 검색 전체게시물 01-15 513
[보안취약점] OpenSSH 보안이슈 `cve-2023-48795`

카테고리 : OS

513 0
작성자 : OSworker 24/01/15
185 Middleware 미들웨어 아이디로 검색 전체게시물 01-06 250
(오픈소스 활용-25) scouter 2.22 에서 JEUS8 모니터링 등록 하는 방법

카테고리 : Middleware

250 0
작성자 : 미들웨어 24/01/06
184 OS OSworker 아이디로 검색 전체게시물 12-30 201
Red Hat z-stream 패키지를 어떻게 구분하나요? 또 z-stream이란 무엇인가요?

카테고리 : OS

201 0
작성자 : OSworker 23/12/30
183 OS OSworker 아이디로 검색 전체게시물 12-24 275
[issue] RHEL8 버전 설치시 swap 이 최대 128G 까지만 된다?

카테고리 : OS

275 0
작성자 : OSworker 23/12/24
182 Middleware 미들웨어 아이디로 검색 전체게시물 12-22 223
(오픈소스 활용-24) 리눅스 java, python 우선순위 설정방법 - (update-alternatives 명령어)

카테고리 : Middleware

223 0
작성자 : 미들웨어 23/12/22
181 OS OSworker 아이디로 검색 전체게시물 12-17 594
OS 모니터링 하실 때 많이 사용되는 SAR에 대해 아시죠?

카테고리 : OS

594 0
작성자 : OSworker 23/12/17
180 Middleware 미들웨어 아이디로 검색 전체게시물 12-07 395
(Apache) Apache 2.4.37 & Weblogic-14 연동방법 (mod_wl_24.so 활용)

카테고리 : Middleware

395 0
작성자 : 미들웨어 23/12/07
179 OS OSworker 아이디로 검색 전체게시물 11-27 651
요즘 이슈인 SUSE Liberty VS Red Hat Enterprise Linux 에 대해 들어보셨나요?

카테고리 : OS

651 0
작성자 : OSworker 23/11/27
Total 198건
게시물 검색

주식회사 클럭스| 대표 : 이찬호| 사업자등록번호 : 107-87-27655
주소 : 서울특별시 영등포구 국회대로 800, 여의도파라곤
E-mail : sales@chlux.co.kr
Copyright © 클럭스 www.chlux.co.kr All rights reserved.
상단으로Top