"CentOS ntp 설치"의 두 판 사이의 차이

112번째 줄: 112번째 줄:
<source lang='dos'>
<source lang='dos'>
[root@jmnote ~]# ntpdate time.windows.com
[root@jmnote ~]# ntpdate time.windows.com
</source>
==차이 보기==
;명령어
<source lang='bash'>
ntpdate -d 서버주소
</source>
;실행 예시
<source lang='dos'>
[root@jmnote ~]# ntpdate -d time.windows.com
2 Oct 02:08:06 ntpdate[3166]: ntpdate 4.2.4p8@1.1612-o Tue Nov 29 00:09:13 UTC 2011 (1)
Looking for host time.windows.com and service ntp
host found : wwwco1test13.microsoft.com
transmit(65.55.21.21)
receive(65.55.21.21)
transmit(65.55.21.21)
receive(65.55.21.21)
transmit(65.55.21.21)
receive(65.55.21.21)
transmit(65.55.21.21)
receive(65.55.21.21)
transmit(65.55.21.21)
server 65.55.21.21, port 123
stratum 2, precision -6, leap 00, trust 000
refid [65.55.21.21], delay 0.19615, dispersion 0.00293
transmitted 4, in filter 4
reference time:    d4144c6a.71b59070  Tue, Oct  2 2012  2:07:54.444
originate timestamp: d4144c77.e83cbb72  Tue, Oct  2 2012  2:08:07.907
transmit timestamp:  d4144c77.cca0c88c  Tue, Oct  2 2012  2:08:07.799
filter delay:  0.22122  0.19688  0.19693  0.19615
        0.00000  0.00000  0.00000  0.00000
filter offset: 0.010714 0.029665 0.029863 0.030388
        0.000000 0.000000 0.000000 0.000000
delay 0.19615, dispersion 0.00293
offset 0.030388
2 Oct 02:08:07 ntpdate[3166]: adjust time server 65.55.21.21 offset 0.030388 sec
</source>
</source>



2012년 10월 2일 (화) 02:08 판

ntp 설치

1 설치 확인

설치 안됨
[root@jmnote ~]# rpm -qa ntp*
설치됨
[root@jmnote ~]# rpm -qa ntp*
ntpdate-4.2.4p8-2.el6.centos.x86_64
ntp-4.2.4p8-2.el6.centos.x86_64

2 설치

[root@jmnote ~]# yum install ntp -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.4p8-2.el6.centos will be installed
--> Processing Dependency: ntpdate = 4.2.4p8-2.el6.centos for package: ntp-4.2.4p8-2.el6.centos.x86_64
--> Running transaction check
---> Package ntpdate.x86_64 0:4.2.4p8-2.el6.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================
 Package           Arch             Version                           Repository      Size
===========================================================================================
Installing:
 ntp               x86_64           4.2.4p8-2.el6.centos              Daum           444 k
Installing for dependencies:
 ntpdate           x86_64           4.2.4p8-2.el6.centos              Daum            58 k

Transaction Summary
===========================================================================================
Install       2 Package(s)

Total download size: 501 k
Installed size: 1.2 M
Downloading Packages:
(1/2): ntp-4.2.4p8-2.el6.centos.x86_64.rpm                          | 444 kB     00:00     
(2/2): ntpdate-4.2.4p8-2.el6.centos.x86_64.rpm                      |  58 kB     00:00     
-------------------------------------------------------------------------------------------
Total                                                      571 kB/s | 501 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ntpdate-4.2.4p8-2.el6.centos.x86_64                                     1/2 
  Installing : ntp-4.2.4p8-2.el6.centos.x86_64                                         2/2 
  Verifying  : ntp-4.2.4p8-2.el6.centos.x86_64                                         1/2 
  Verifying  : ntpdate-4.2.4p8-2.el6.centos.x86_64                                     2/2 

Installed:
  ntp.x86_64 0:4.2.4p8-2.el6.centos                                                        

Dependency Installed:
  ntpdate.x86_64 0:4.2.4p8-2.el6.centos                                                    

Complete!

3 설치 위치

[root@jmnote ~]# whereis ntp
ntp: /etc/ntp /etc/ntp.conf
[root@jmnote ~]# which ntpq
/usr/sbin/ntpq
[root@jmnote ~]# which ntpdate
/usr/sbin/ntpdate
[root@jmnote ~]# which ntpd
/usr/sbin/ntpd
[root@jmnote ~]# service ntpd status
ntpd is stopped
  • 설정파일 ntp.conf는 /etc에 있다.
  • ntpq, ntpdate, ntpd는 /usr/sbin에 있다.
  • ntpd는 중지된 상태이다.

4 동기화 서버 설정

chkconfig ntpd on
echo driftfile /var/lib/ntp/drift > /etc/ntp.conf
echo restrict default kod nomodify notrap nopeer noquery >> /etc/ntp.conf
echo restrict -6 default kod nomodify notrap nopeer noquery >> /etc/ntp.conf
echo restrict 127.0.0.1 >> /etc/ntp.conf
echo restrict -6 ::1 >> /etc/ntp.conf
echo server 1.kr.pool.ntp.org >> /etc/ntp.conf
echo server 1.asia.pool.ntp.org >> /etc/ntp.conf
echo server 2.asia.pool.ntp.org >> /etc/ntp.conf
echo includefile /etc/ntp/crypto/pw >> /etc/ntp.conf
echo keys /etc/ntp/keys >> /etc/ntp.conf
service ntpd restart
ntpq -p

5 즉시 동기화

명령어
ntpdate 서버주소
실행 예시
[root@jmnote ~]# ntpdate time.windows.com

6 차이 보기

명령어
ntpdate -d 서버주소
실행 예시
[root@jmnote ~]# ntpdate -d time.windows.com
 2 Oct 02:08:06 ntpdate[3166]: ntpdate 4.2.4p8@1.1612-o Tue Nov 29 00:09:13 UTC 2011 (1)
Looking for host time.windows.com and service ntp
host found : wwwco1test13.microsoft.com
transmit(65.55.21.21)
receive(65.55.21.21)
transmit(65.55.21.21)
receive(65.55.21.21)
transmit(65.55.21.21)
receive(65.55.21.21)
transmit(65.55.21.21)
receive(65.55.21.21)
transmit(65.55.21.21)
server 65.55.21.21, port 123
stratum 2, precision -6, leap 00, trust 000
refid [65.55.21.21], delay 0.19615, dispersion 0.00293
transmitted 4, in filter 4
reference time:    d4144c6a.71b59070  Tue, Oct  2 2012  2:07:54.444
originate timestamp: d4144c77.e83cbb72  Tue, Oct  2 2012  2:08:07.907
transmit timestamp:  d4144c77.cca0c88c  Tue, Oct  2 2012  2:08:07.799
filter delay:  0.22122  0.19688  0.19693  0.19615 
         0.00000  0.00000  0.00000  0.00000 
filter offset: 0.010714 0.029665 0.029863 0.030388
         0.000000 0.000000 0.000000 0.000000
delay 0.19615, dispersion 0.00293
offset 0.030388

 2 Oct 02:08:07 ntpdate[3166]: adjust time server 65.55.21.21 offset 0.030388 sec

7 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}