ntpサーバ構築 | ぼぶろぐ

ぼぶろぐ

以前は、あいらぶLinux♪というタイトルでしたが、
最近はLinux以外のことも書いているので、タイトルを変更しました。
ぼぶちゃんのぶろぐでぼぶろぐです。

◆ntpサーバ構築

[root@localhost ~]# yum -y install ntp
Loaded plugins: downloadonly, fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* fedora: ftp.riken.jp
* updates: ftp.riken.jp
fedora | 2.8 kB 00:00
updates | 3.4 kB 00:00
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package ntp.i386 0:4.2.4p7-1.fc10 set to be updated
--> Processing Dependency: ntpdate = 4.2.4p7-1.fc10 for package: ntp-4.2.4p7-1.fc10.i386
--> Running transaction check
---> Package ntpdate.i386 0:4.2.4p7-1.fc10 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================
Package Arch Version Repository Size
=========================================================================================
Updating:
ntp i386 4.2.4p7-1.fc10 updates 1.4 M
Updating for dependencies:
ntpdate i386 4.2.4p7-1.fc10 updates 55 k

Transaction Summary
=========================================================================================
Install 0 Package(s)
Update 2 Package(s)
Remove 0 Package(s)

Total download size: 1.4 M
Downloading Packages:
(1/2): ntp-4.2.4p7-1.fc10.i386.rpm | 1.4 MB 00:18
(2/2): ntpdate-4.2.4p7-1.fc10.i386.rpm | 55 kB 00:00
-----------------------------------------------------------------------------------------
Total 69 kB/s | 1.4 MB 00:20
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : ntpdate-4.2.4p7-1.fc10.i386 1/4
Updating : ntp-4.2.4p7-1.fc10.i386 2/4
Cleanup : ntpdate-4.2.4p6-1.fc10.i386 3/4
Cleanup : ntp-4.2.4p6-1.fc10.i386 4/4

Updated:
ntp.i386 0:4.2.4p7-1.fc10

Dependency Updated:
ntpdate.i386 0:4.2.4p7-1.fc10

Complete!
[root@localhost ~]# cp -p /etc/ntp.conf /etc/ntp.conf.org
[root@localhost ~]# vi /etc/ntp.conf

変更箇所
[root@localhost ~]# diff /etc/ntp.conf /etc/ntp.conf.org
18c18
< restrict 192.168.11.0 mask 255.255.255.0 nomodify notrap
---
> #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
22,24c22,24
< server -4 ntp.nict.jp
< server -4 ntp.nict.jp
< server -4 ntp.jst.mfeed.ad.jp
---
> server 0.fedora.pool.ntp.org
> server 1.fedora.pool.ntp.org
> server 2.fedora.pool.ntp.org

[root@localhost ~]# ntpdate ntp.nict.jp
24 Jun 22:16:34 ntpdate[4860]: step time server 133.243.238.163 offset -233.667627 sec
[root@localhost ~]# /etc/rc.d/init.d/ntpd start
ntpd を起動中: [ OK ]
[root@localhost ~]# chkconfig ntpd on
[root@localhost ~]# chkconfig --list ntpd
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*ntp.nict.jp .NICT. 1 u 11 64 17 19.074 2.093 0.571
+ntp2.jst.mfeed. 210.173.160.56 2 u 10 64 17 17.279 3.588 1.508

※ntpq -pは10分くらいたったあとに実行すると上位のntpサーバと
同期をとりはじめていることが確認できます。