공유할 서비스 선택

TECH


TECH

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

페이지 정보

작성자 partner_test 아이디로 검색 전체게시물 댓글 0건 조회 12,556회 좋아요 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 목록
번호 제목 작성자 작성일 조회수
30 OS Leesangwoo 아이디로 검색 전체게시물 03-29 10995
[Cluster] RHEL(Centos) 7 Pacemaker 운영 매뉴얼

카테고리 : OS

10,995 0
작성자 : Leesangwoo 20/03/29
29 OS Leesangwoo 아이디로 검색 전체게시물 03-17 8301
[Linux] Repository Server 구성

카테고리 : OS

8,301 0
작성자 : Leesangwoo 20/03/17
28 OS LeeHyongDong 아이디로 검색 전체게시물 03-16 5927
[Linux] split-brain 현상

카테고리 : OS

5,927 0
작성자 : LeeHyongDong 20/03/16
27 OS Chojunhyung 아이디로 검색 전체게시물 03-13 11055
[Cluster] Pacemaker 설치

카테고리 : OS

11,055 0
작성자 : Chojunhyung 20/03/13
26 OS LeeHyongDong 아이디로 검색 전체게시물 03-12 9489
[Linux] 오픈소스 모니터링툴 제품 특징

카테고리 : OS

9,489 0
작성자 : LeeHyongDong 20/03/12
25 OS Chojunhyung 아이디로 검색 전체게시물 03-02 6708
[Linux] RHEL 6.X --> RHEL 7.X 업그레이드 방법

카테고리 : OS

6,708 0
작성자 : Chojunhyung 20/03/02
24 OS LeeHyongDong 아이디로 검색 전체게시물 02-24 4643
[Linux] 한글설정 및 배너설정

카테고리 : OS

4,643 0
작성자 : LeeHyongDong 20/02/24
23 OS LeeHyongDong 아이디로 검색 전체게시물 01-31 8002
[Linux] Kernel Patch

카테고리 : OS

8,002 0
작성자 : LeeHyongDong 20/01/31
22 OS LeeHyongDong 아이디로 검색 전체게시물 01-22 9080
[Linux] Network 설정 및 인터페이스명 변경

카테고리 : OS

9,080 0
작성자 : LeeHyongDong 20/01/22
21 OS Leesangwoo 아이디로 검색 전체게시물 01-20 9611
[Cluster] RHEL 7 Pacemaker constraint 설정

카테고리 : OS

9,611 0
작성자 : Leesangwoo 20/01/20
Total 80건
게시물 검색

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