CentOS 6.5 ntp설치

os/UNIX_LINUX 2016. 12. 8. 19:37
반응형



ntp설치

[root@localhost]# yum -y install ntp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.cdnetworks.com
 * extras: centos.mirror.cdnetworks.com
 * updates: centos.mirror.cdnetworks.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.6p5-10.el6.centos.1 will be installed
--> Processing Dependency: ntpdate = 4.2.6p5-10.el6.centos.1 for package: ntp-4.2.6p5-10.el6.centos.1.x86_64
--> Running transaction check
---> Package ntpdate.x86_64 0:4.2.6p5-10.el6.centos.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================
 Package                      Arch    Version                 Repository  Size
===============================================================================
Installing:
 ntp                          x86_64  4.2.6p5-10.el6.centos.1 updates    598 k
Installing for dependencies:
 ntpdate                      x86_64  4.2.6p5-10.el6.centos.1 updates     78 k

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

Total download size: 677 k
Installed size: 1.8 M
Downloading Packages:
(1/2): ntp-4.2.6p5-10.el6.centos.1.x86_64.rpm                    | 598 kB     00:00
(2/2): ntpdate-4.2.6p5-10.el6.centos.1.x86_64.rpm                |  78 kB     00:00
----------------------------------------------------------------------------------------
Total                                                   129 kB/s | 677 kB     00:05
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ntpdate-4.2.6p5-10.el6.centos.1.x86_64                               1/2
  Installing : ntp-4.2.6p5-10.el6.centos.1.x86_64                                   2/2
  Verifying  : ntpdate-4.2.6p5-10.el6.centos.1.x86_64                               1/2
  Verifying  : ntp-4.2.6p5-10.el6.centos.1.x86_64                                   2/2

Installed:
  ntp.x86_64 0:4.2.6p5-10.el6.centos.1

Dependency Installed:
  ntpdate.x86_64 0:4.2.6p5-10.el6.centos.1

Complete!

[root@localhost]#


시간동기화할 서버 설정.
동기화할 서버 주소 :  http://www.pool.ntp.org/ 에서 확인 가능.

[root@localhost]# vi /etc/ntp.conf

# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst

server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org

#broadcast 192.168.1.255 autokey        # broadcast server
#broadcastclient                        # broadcast client
#broadcast 224.0.1.1 autokey            # multicast server
#multicastclient 224.0.1.1              # multicast client
#manycastserver 239.255.254.254         # manycast server
#manycastclient 239.255.254.254 autokey # manycast client

# Enable public key cryptography.
#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys

# Specify the key identifiers which are trusted.
#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.
#requestkey 8

# Specify the key identifier to use with the ntpq utility.
#controlkey 8

# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats


ntp 서비스를 사용할 수 있도록 방화벽을 설정
[root@localhost]# vi /etc/sysconfig/iptables


ntp 서비스 시작
[root@localhost]# service ntpd start


시스템 재부팅시에도 서비스가 시작할수 있도록 설정.
[root@localhost]# chkconfig --list                 ## 재부팅시 서비스 시작 목록 확인.
[root@localhost]# chkconfig --level 2345 ntpd on   ## 재부팅시 서비스 시작하도록 설정.


ntp 작동 여부 확인 - 시간 동기화 여부 확인
[root@localhost]# ntpq -p




반응형
Posted by 공간사랑
,