ntpd のインストール

玄柴(KURO-SHEEVA)

時刻同期のため、ntpd をインストールする。

ntpd のインストール

root@debian:~# apt-get install ntp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libx11-data libxcb1 libxau6 libxdmcp6 libxcb-xlib0 libx11-6
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libcap2 libgdbm3 perl perl-modules
Suggested packages:
  ntp-doc perl-doc libterm-readline-gnu-perl libterm-readline-perl-perl
The following NEW packages will be installed:
  libcap2 libgdbm3 ntp perl perl-modules
0 upgraded, 5 newly installed, 0 to remove and 9 not upgraded.
Need to get 8211kB of archives.
After this operation, 29.7MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ports.ubuntu.com jaunty/main libcap2 2.11-2 [11.0kB]
Get:2 http://ports.ubuntu.com jaunty/main libgdbm3 1.8.3-4 [22.7kB]
Get:3 http://ports.ubuntu.com jaunty/main perl-modules 5.10.0-19ubuntu1 [3182kB]
Get:4 http://ports.ubuntu.com jaunty/main perl 5.10.0-19ubuntu1 [4531kB]
Get:5 http://ports.ubuntu.com jaunty/main ntp 1:4.2.4p4+dfsg-7ubuntu5 [464kB]
Fetched 8211kB in 5s (1515kB/s)
Selecting previously deselected package libcap2.
(Reading database ... 10310 files and directories currently installed.)
Unpacking libcap2 (from .../libcap2_2.11-2_armel.deb) ...
Selecting previously deselected package libgdbm3.
Unpacking libgdbm3 (from .../libgdbm3_1.8.3-4_armel.deb) ...
Selecting previously deselected package perl-modules.
Unpacking perl-modules (from .../perl-modules_5.10.0-19ubuntu1_all.deb) ...
Selecting previously deselected package perl.
Unpacking perl (from .../perl_5.10.0-19ubuntu1_armel.deb) ...
Selecting previously deselected package ntp.
Unpacking ntp (from .../ntp_1%3a4.2.4p4+dfsg-7ubuntu5_armel.deb) ...
Setting up libcap2 (2.11-2) ...

Setting up libgdbm3 (1.8.3-4) ...

Setting up ntp (1:4.2.4p4+dfsg-7ubuntu5) ...
 * Starting NTP server ntpd                                              [ OK ]

Setting up perl-modules (5.10.0-19ubuntu1) ...
Setting up perl (5.10.0-19ubuntu1) ...

Processing triggers for libc6 ...
ldconfig deferred processing now taking place
root@debian:~#

ntp.conf の修正

インストールしたままでも、まぁ動くが、 NTP サーバを変更しておく
root@debian:~# cd /etc
root@debian:/etc# mv ntp.conf ntp.conf.orig
root@debian:/etc# cp ntp.conf.orig ntp.conf
root@debian:/etc# ls -l ntp.conf*
-rw-r--r-- 1 root root 1633 Jan  9 23:38 ntp.conf
-rw-r--r-- 1 root root 1633 Mar 21  2009 ntp.conf.orig
root@debian:/etc# vi ntp.conf
	:
	:
root@debian:/etc# diff -u ntp.conf.orig ntp.conf
--- ntp.conf.orig       2009-03-21 10:47:02.000000000 +0900
+++ ntp.conf    2010-01-09 23:39:24.000000000 +0900
@@ -13,8 +13,10 @@


 # You do need to talk to an NTP server or two (or three).
-server ntp.ubuntu.com
-
+#server ntp.ubuntu.com
+server  ntp1.jst.mfeed.ad.jp
+server  ntp2.jst.mfeed.ad.jp
+server  ntp3.jst.mfeed.ad.jp

 # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
 # details.  The web page 
root@debian:/etc#

ntpd の再起動

/etc/ntp.conf の変更を有効にするために ntpd を再起動する。
root@debian:/etc# /etc/init.d/ntp restart
 * Stopping NTP server ntpd                                              [ OK ]
 * Starting NTP server ntpd                                              [ OK ]
root@debian:/etc#

確認

ntpq を用いて確認する
root@debian:/etc# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 ntp1.jst.mfeed. 210.173.160.56   2 u   54   64    1   14.736    0.384   0.002
 ntp2.jst.mfeed. 210.173.160.86   2 u   53   64    1   14.288    0.139   0.002
 ntp3.jst.mfeed. 210.173.160.86   2 u   52   64    1   14.373    0.476   0.002
root@debian:/etc#
少し待てば、そのうち同期する
root@debian:/etc# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*ntp1.jst.mfeed. 133.243.236.18   2 u    6   64   17   14.555    4.909   3.420
 ntp2.jst.mfeed. 210.173.160.56   2 u    2   64   17   14.246    1.877   1.958
 ntp3.jst.mfeed. 210.173.160.86   2 u    1   64   17   14.087    1.805   1.754
root@debian:/etc#


KURO-SHEEVA
楽天市場

←(前のページ)
ELECOM の Web カメラ
当月のハックの記録
SheevaPlug/玄柴(KURO-SHEEVA)をハックしよう トップ
(次のページ)→
D02HW でダイアルアップ

Copyright (C) 2003-2010 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市