본문 바로가기

리눅스-기초명령어/시스템 설정

NTP(Network Time Protocol)

시스템 시계를 원격 NTP 서버 또는 피어와 동기화하는 데 사용을 한다.

1. chronyc

명령행에서 사용되는 chrony 데몬의 정보 확인 및 변경하는 명령어이다.

 

사용법

chronyc [option] [command]

 

주요 옵션

옵션 설명
-v chronyc(chrony) 버전 정보 출력(이옵션은 명령어 없이 단독으로 사용된다)

 

주요 명령

명령 설명
sources chronyd 데몬이 접근하는 서버들에 대한 정보를 
출력한다 이 명령어 뒤에 -v옵션을 사용하면 필드에 대한 설명을 볼 수 있다.
tracking 시간을 받아오는 서버에 대한 다양한 파라미터 
정보를 출력한다.

 

chronyd는 시간 동기화에 대한 NTP(Network Time Protocol)를 사용하며, 인터넷에서 공개적으로 사용 가능한 NTP 서버에 연결하여 정확한 시간을 동기화한다.






예시

chrony.conf 수정

[root@Linux ~]# vi /etc/chrony.conf

 

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (https://www.pool.ntp.org/join.html).
pool 2.rocky.pool.ntp.org iburst
server 1.kr.pool.ntp.org iburst

#ntp설정 변경
# Use NTP servers from DHCP.

재시작

[root@Linux ~]# systemctl restart chronyd

서버 소스 상태확인

[root@Linux ~]# chronyc sources -v
                            .- Number of sample points in measurement set.
                            /    .- Number of residual runs with same sign.
                          |    /    .- Length of measurement set (time).
                          |   |    /      .- Est. clock freq error (ppm).
                          |   |   |      /           .- Est. error in freq.
                          |   |   |     |           /         .- Est. offset.
                          |   |   |     |          |          |   On the -.
                          |   |   |     |          |          |   samples. \
                          |   |   |     |          |          |             |
Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
==============================================================================
121.174.142.81              4   3     6    +16.237    806.035  -2917us   149us
106.247.248.106             4   3     6    +16.041    332.193  +5279us    52us
193.123.243.2               4   3     6    -15.404    198.318   -636us    31us
ec2-13-209-84-50.ap-nort>   4   3     6   +189.300  30616.184  -9229us  3223us
send.mx.cdnetworks.com      4   3     6    +30.899    177.594  +1257us    22us




tracking

[root@Linux ~]# chronyc tracking
Reference ID    : D3E9284E (send.mx.cdnetworks.com)
Stratum         : 3
Ref time (UTC)  : Thu May 04 08:14:51 2023
System time     : 0.000088790 seconds slow of NTP time
Last offset     : +0.000009794 seconds
RMS offset      : 0.000801291 seconds
Frequency       : 7.984 ppm slow
Residual freq   : -0.001 ppm
Skew            : 0.144 ppm
Root delay      : 0.012142266 seconds
Root dispersion : 0.016662013 seconds
Update interval : 256.9 seconds
Leap status     : Normal

 

 

2. localectl

일종의 표시언어 및 키보드 레이아웃에 해당하는 시스템 로케일 정보를 확인거나 설정하는 명령

 

사용법

localectl [command] [설정값]



명령어

명령설명
status 시스템에 설정된 로케일 정보를 출력한다 별도의 입력이 없으면 기본값이다
list-locales 설정 가능한 로케일 목록 정보를 출력한다.
set-locale 로케일을 설정할 때 사용한다.



예시

[root@Linux ~]# localectl list-locales 
                 설정가능한 로케일 목록 정보를 출력한다
C.UTF-8
aa_DJ.UTF-8
aa_ER.UTF-8
aa_ER.UTF-8@saaho
aa_ET.UTF-8
af_ZA.UTF-8
agr_PE.UTF-8
ak_GH.UTF-8
am_ET.UTF-8
an_ES.UTF-8
anp_IN.UTF-8
[root@linux ~]# localectl set-locale ko_KR.UTF-8 

                       표시 언어 및 키보드 레이아웃을 한국어로 변경
[root@linux ~]# localectl status     변경 내용 확인

System Locale: LANG=ko_KR.UTF-8
      VC Keymap: us
      X11 Layout: us

 

'리눅스-기초명령어 > 시스템 설정' 카테고리의 다른 글

hostnamectl  (0) 2023.09.01
timedate  (1) 2023.09.01