우분투 18.04 LTS NTP 클라이언트 설정

우분투 18.04 LTS에 NTP를 설치하여 시간을 동기화합니다.


NTP 설치

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo apt install ntp
$ sudo apt install ntp
$ sudo apt install ntp

NTP 설정

사용할 서버를 선택합니다.

pool.ntp.org의 NTP 서버를 사용하겠습니다.
한국 pool: https://www.ntppool.org/zone/kr

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
1.kr.pool.ntp.org
1.asia.pool.ntp.org
0.asia.pool.ntp.org
1.kr.pool.ntp.org 1.asia.pool.ntp.org 0.asia.pool.ntp.org
1.kr.pool.ntp.org
1.asia.pool.ntp.org
0.asia.pool.ntp.org

NTP 설정을 변경합니다.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo nano /etc/ntp.conf
$ sudo nano /etc/ntp.conf
$ sudo nano /etc/ntp.conf
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
pool 0.ubuntu.pool.ntp.org iburst
pool 1.ubuntu.pool.ntp.org iburst
pool 2.ubuntu.pool.ntp.org iburst
pool 3.ubuntu.pool.ntp.org iburst
# Use Ubuntu's ntp server as a fallback.
pool ntp.ubuntu.com
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board # on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for # more information. pool 0.ubuntu.pool.ntp.org iburst pool 1.ubuntu.pool.ntp.org iburst pool 2.ubuntu.pool.ntp.org iburst pool 3.ubuntu.pool.ntp.org iburst # Use Ubuntu's ntp server as a fallback. pool ntp.ubuntu.com
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
pool 0.ubuntu.pool.ntp.org iburst
pool 1.ubuntu.pool.ntp.org iburst
pool 2.ubuntu.pool.ntp.org iburst
pool 3.ubuntu.pool.ntp.org iburst

# Use Ubuntu's ntp server as a fallback.
pool ntp.ubuntu.com

미리 설정되어 있던 서버들을 주석 처리한 뒤 선택한 서버의 주소를 입력합니다.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# Specify one or more NTP servers.
server 1.kr.pool.ntp.org
server 1.asia.pool.ntp.org
server 0.asia.pool.ntp.org
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
#pool 0.ubuntu.pool.ntp.org iburst
#pool 1.ubuntu.pool.ntp.org iburst
#pool 2.ubuntu.pool.ntp.org iburst
#pool 3.ubuntu.pool.ntp.org iburst
# Use Ubuntu's ntp server as a fallback.
#pool ntp.ubuntu.com
# Specify one or more NTP servers. server 1.kr.pool.ntp.org server 1.asia.pool.ntp.org server 0.asia.pool.ntp.org # Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board # on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for # more information. #pool 0.ubuntu.pool.ntp.org iburst #pool 1.ubuntu.pool.ntp.org iburst #pool 2.ubuntu.pool.ntp.org iburst #pool 3.ubuntu.pool.ntp.org iburst # Use Ubuntu's ntp server as a fallback. #pool ntp.ubuntu.com
# Specify one or more NTP servers.

server 1.kr.pool.ntp.org
server 1.asia.pool.ntp.org
server 0.asia.pool.ntp.org

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
#pool 0.ubuntu.pool.ntp.org iburst
#pool 1.ubuntu.pool.ntp.org iburst
#pool 2.ubuntu.pool.ntp.org iburst
#pool 3.ubuntu.pool.ntp.org iburst

# Use Ubuntu's ntp server as a fallback.
#pool ntp.ubuntu.com

Ctrl + XYEnter 하여 저장합니다.


NTP 서비스를 재시작합니다.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo service ntp restart
$ sudo service ntp restart
$ sudo service ntp restart

동기화 확인

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
+ec2-13-124-227- 131.130.251.107 2 u 31 64 37 12.167 0.067 3.915
time.cloudflare 10.51.8.5 3 u 297 64 20 34.039 -7.609 0.000
*send.mx.cdnetwo 216.239.35.8 2 u 32 64 37 3.745 3.930 3.948
$ sudo ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== +ec2-13-124-227- 131.130.251.107 2 u 31 64 37 12.167 0.067 3.915 time.cloudflare 10.51.8.5 3 u 297 64 20 34.039 -7.609 0.000 *send.mx.cdnetwo 216.239.35.8 2 u 32 64 37 3.745 3.930 3.948
$ sudo ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+ec2-13-124-227- 131.130.251.107  2 u   31   64   37   12.167    0.067   3.915
 time.cloudflare 10.51.8.5        3 u  297   64   20   34.039   -7.609   0.000
*send.mx.cdnetwo 216.239.35.8     2 u   32   64   37    3.745    3.930   3.948

첫 번째 column이 ‘*‘인 서버가 현재 동기화 중인 서버입니다.

Top