공유할 서비스 선택

TECH


TECH

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

페이지 정보

작성자 partner_test 아이디로 검색 전체게시물 댓글 0건 조회 12,542회 좋아요 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 목록
번호 제목 작성자 작성일 조회수
60 OS OSworker 아이디로 검색 전체게시물 08-30 1332
Red Hat Linux lifecycle

카테고리 : OS

1,332 0
작성자 : OSworker 23/08/30
59 OS OSworker 아이디로 검색 전체게시물 08-20 554
Live kernel patch - 온라인 커널 업데이트

카테고리 : OS

554 0
작성자 : OSworker 23/08/20
58 OS OSworker 아이디로 검색 전체게시물 08-12 688
Red Hat Enterprise Linux 9 의 새로운기능에 대해 알아보기 part -2 : Session Recording

카테고리 : OS

688 0
작성자 : OSworker 23/08/12
57 OS OSworker 아이디로 검색 전체게시물 07-31 943
OpenSSH 'CVE-2023-38408' 보안 취약점 안내

카테고리 : OS

943 1
작성자 : OSworker 23/07/31
56 OS OSworker 아이디로 검색 전체게시물 07-28 453
Red Hat Enterprise Linux 9 의 새로운기능에 대해 알아보기 part -1

카테고리 : OS

453 0
작성자 : OSworker 23/07/28
55 OS osgusu 아이디로 검색 전체게시물 07-23 486
[Storage / Filesystem] VDO(Virtual Data Optimizer)란 무엇인가?

카테고리 : OS

486 0
작성자 : osgusu 23/07/23
54 OS leechanho 아이디로 검색 전체게시물 05-23 1012
[쉘스크립트] RHEL8 리눅스 보안설정 자동화 스크립트

카테고리 : OS

1,012 0
작성자 : leechanho 23/05/23
53 OS leechanho 아이디로 검색 전체게시물 04-24 839
[Linux] RHEL-HA_운영 메뉴얼

카테고리 : OS

839 0
작성자 : leechanho 23/04/24
52 OS leechanho 아이디로 검색 전체게시물 03-15 1938
[쉘스크립트] 리눅스 시스템 정보수집 스크립트

카테고리 : OS

1,938 1
작성자 : leechanho 23/03/15
51 OS LeeHyongDong 아이디로 검색 전체게시물 07-01 3181
[Linux] RHEL 9.0 변경 사항

카테고리 : OS

3,181 0
작성자 : LeeHyongDong 22/07/01
Total 80건
게시물 검색

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