프린트 하기

OS환경 : Oracle Linux 7.5 (64bit)


방법 : Oracle Linux 7에서 NTP 설정

NTP란?

NTP(Network Time Protocol)는 인터넷상의 시간을 정확하게 유지시켜 주기 위한 통신망 시간 규약임

라디오나 원자시계에 맞추어 시간을 조정하며 밀리초 1/1000초 단위까지 시간을 맞출 수 있음

Oracle RAC 설치 시에 정확한 시간 동기화를 위해 설정할 수 있음



NTP 설정

NTP 패키지 설치

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# yum install -y ntp
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.6p5-25.0.1.el7_3.2 will be installed
--> Processing Dependency: libopts.so.25()(64bit) for package: ntp-4.2.6p5-25.0.1.el7_3.2.x86_64
--> Running transaction check
---> Package autogen-libopts.x86_64 0:5.18-5.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
=============================================================================================================================================================
 Package                                  Arch                            Version                                         Repository                    Size
=============================================================================================================================================================
Installing:
 ntp                                      x86_64                          4.2.6p5-25.0.1.el7_3.2                          ol7                          547 k
Installing for dependencies:
 autogen-libopts                          x86_64                          5.18-5.el7                                      ol7                           65 k
 
Transaction Summary
=============================================================================================================================================================
Install  1 Package (+1 Dependent package)
 
Total download size: 611 k
Installed size: 1.5 M
Downloading packages:
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                         90 MB/| 611 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 
  Installing : autogen-libopts-5.18-5.el7.x86_64 [                                                                                                     ] 1/2
  Installing : autogen-libopts-5.18-5.el7.x86_64 [#############################################                                                        ] 1/2
  Installing : autogen-libopts-5.18-5.el7.x86_64 [##########################################################################################           ] 1/2
  Installing : autogen-libopts-5.18-5.el7.x86_64 [#############################################################################################        ] 1/2
  Installing : autogen-libopts-5.18-5.el7.x86_64 [##################################################################################################   ] 1/2
  Installing : autogen-libopts-5.18-5.el7.x86_64 [###################################################################################################  ] 1/2
  Installing : autogen-libopts-5.18-5.el7.x86_64                                                                                                         1/2 
 
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [                                                                                                     ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [#                                                                                                    ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [#####                                                                                                ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [########                                                                                             ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [############                                                                                         ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [#################                                                                                    ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [######################                                                                               ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [##########################                                                                           ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [###############################                                                                      ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [###################################                                                                  ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [########################################                                                             ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [############################################                                                         ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [#################################################                                                    ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [#####################################################                                                ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [##########################################################                                           ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [###############################################################                                      ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [###################################################################                                  ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [######################################################################                               ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [###########################################################################                          ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [###############################################################################                      ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [##################################################################################                   ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [#######################################################################################              ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [########################################################################################             ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [#########################################################################################            ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [#############################################################################################        ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [##############################################################################################       ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [###############################################################################################      ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [################################################################################################     ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [#################################################################################################    ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [##################################################################################################   ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64 [###################################################################################################  ] 2/2
  Installing : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64                                                                                                         2/2 
 
  Verifying  : ntp-4.2.6p5-25.0.1.el7_3.2.x86_64                                                                                                         1/2 
 
  Verifying  : autogen-libopts-5.18-5.el7.x86_64                                                                                                         2/2 
 
Installed:
  ntp.x86_64 0:4.2.6p5-25.0.1.el7_3.2                                                                                                                        
 
Dependency Installed:
  autogen-libopts.x86_64 0:5.18-5.el7                                                                                                                        
 
Complete!



NTP 설정파일 수정

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
기존
# vi /etc/ntp.conf
"/etc/ntp.conf" 58L, 1992C# For more information about this file, see the man pages
.
.
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
.
.
 
변경
# vi /etc/ntp.conf
"/etc/ntp.conf" 58L, 1992C# For more information about this file, see the man pages
.
.
#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
server 1.kr.pool.ntp.org
server 0.asia.pool.ntp.org
server 2.asia.pool.ntp.org
.
.
.

기존 server 구문 주석 후 server 구문 3줄 추가



서버 기동시 실행되게끔 NTP 서비스 등록

1
2
# systemctl enable ntpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.



*참고

Linux 6 이하 버전에서 서비스 등록 명령 및 시작 명령

1
2
# chkconfig ntpd on
/etc/init.d/ntpd start



NTP 서비스 기동

1
# systemctl start ntpd.service



NTP 상태 확인

1
2
3
4
5
6
# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 send.mx.cdnetwo 216.239.35.8     2 u   21   64    1    8.237    0.106   0.000
 cdns-lhr-02.ptc 195.43.74.123    2 u   20   64    1  177.489   19.140   0.000
 203.107.6.88    10.137.55.181    2 u   19   64    1   53.948    4.282   0.000

* : 현재 sync 를 받고 있음을 의미

+ : ntp 알고리즘에 의해 접속은 가능하지만 sync 를 하고 있지는 않음을 의미

- : ntp 알고리즘에 의해 접속은 가능하지만 sync 가능 리스트에서 제외

blank : 접속이 불가능함을 의미



remote는 sync 를 하는 straum 2 서버주소를 가리키며, 

refid는 각 straum 2 서버가 현재 sync 를 하고 있는 straum 1 서버를 보여줌

st가 16일 경우 해당 서버에 접속 할 수 없음을 의미함



(타 블로그는 remote의 주소 앞에 *이나 +이 붙는데 현재 나는 아무것도 나오지않음)



참조 : https://webdir.tistory.com/120

http://blog.naver.com/wizardkyn/220840483581