chrony 서버 구축 및 동기화

ITKHJ·2022년 10월 19일

Server

목록 보기
8/32
post-thumbnail

chrony 설치

yum -y install chrony --downloadonly --downloaddir=/tmp/chrony

다운로드 받은 패키지 rpm -ivh chrony-3.5-2.el8.x86_64.rpm 로 설치

ntp 서버 설정

vi /etc/chrony.conf 파일에 해당 사항 기입

  • 외부 NTP 참조할 서버
    server time.bora.net iburst
    server ntp2.kornet.net iburst
    server 1.kr.pool.ntp.org iburst

  • 이 NTP 서버를 참조할 IP 대역
    allow 192.168.0.0/24

NTP 동기화

  • 상태 확인
    timedatectl status - 커맨드 입력

               Local time: 일 2020-12-13 21:55:32 EST
           Universal time: 월 2020-12-14 02:55:32 UTC
                 RTC time: 월 2020-12-14 02:55:32
                Time zone: America/New_York (EST, -0500)

    System clock synchronized: yes
    NTP service: active
    RTC in local TZ: no

  • System clock synchronized: no 일경우
    timedatectl set-ntp yes

ntp 시간대 설정

  • 동기화 실행
    timedatectl set-ntp true

  • 시간대 설정
    timedatectl set-timezone Asia/Seoul

  • 지역별 시간대 확인
    tzselect - 커맨드 입력
    4 → 23 → yes

  • 최종 상태 확인
    timedatectl status - 커맨드 입력
    정상 시간 출력되면 완료

방화벽 등록

firewall-cmd --add-service=ntp --permanent
firewall-cmd --permanent --zone=public --add-port=123/udp

chrony 클라이언트 동기화

chrony 설치

yum -y install chrony --downloadonly --downloaddir=/tmp/chrony

다운로드 받은 패키지 rpm -ivh chrony-3.5-2.el8.x86_64.rpm 로 설치

chrony 서버 타임 서버로 등록

vi /etc/chrony.conf
server 192.168.0.191

※ 로컬 타임 서버 구축 시(폐쇄망 인터넷 연결 안될 시)
server 127.127.1.0 iburst

local stratum 10

allow 127.0.0.0/8

클라이언트 방화벽 등록

firewall-cmd --add-service=ntp --permanent
firewall-cmd --permanent --zone=public --add-port=123/udp
firewall-cmd --reload
firewall-cmd --list-all

ntp 서버 호스트 등록

/etc/hosts
ntp-server 172.16.100.124

chrony 기동 및 부팅시 자동 활성화

systemctl start chronyd
systemctl enable chronyd
systemctl status chronyd

즉시 동기화 명령

timedatectl set-ntp yes
timedatectl set-ntp true
chronyc -a makestep

chrony 재기동

systemctl restart chronyd

동기화 확인

chronyc sources
chronyc tracking
timedatectl status

profile
모든 업무 지식 작성하자!

0개의 댓글