時刻同期

Debian TS-WXL

ntp を使って時刻を同期する。

ntp のインストール

tswxl:~# apt-get install ntp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libcap1 libedit2
Suggested packages:
  ntp-doc
The following NEW packages will be installed:
  libcap1 libedit2 ntp
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 533kB of archives.
After this operation, 1315kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.jp.debian.org lenny/main libedit2 2.11~20080614-1 [64.5kB]
Get:2 http://ftp.jp.debian.org lenny/main libcap1 1:1.10-14 [9074B]
Get:3 http://ftp.jp.debian.org lenny/main ntp 1:4.2.4p4+dfsg-8lenny3 [459kB]
Fetched 533kB in 1s (349kB/s)
Selecting previously deselected package libedit2.
(Reading database ... 9738 files and directories currently installed.)
Unpacking libedit2 (from .../libedit2_2.11~20080614-1_armel.deb) ...
Selecting previously deselected package libcap1.
Unpacking libcap1 (from .../libcap1_1%3a1.10-14_armel.deb) ...
Selecting previously deselected package ntp.
Unpacking ntp (from .../ntp_1%3a4.2.4p4+dfsg-8lenny3_armel.deb) ...
Processing triggers for man-db ...
Setting up libedit2 (2.11~20080614-1) ...
Setting up libcap1 (1:1.10-14) ...
Setting up ntp (1:4.2.4p4+dfsg-8lenny3) ...
Starting NTP server: ntpd.
tswxl:~#

/etc/ntp.conf の修正

tswxl:~# cd /etc
tswxl:/etc# mv ntp.conf{,.orig}
tswxl:/etc# cp ntp.conf{.orig,}
tswxl:/etc# vi ntp.conf
	:
	:
tswxl:/etc# !cp:s/cp/diff -c/
diff -c ntp.conf{.orig,}
*** ntp.conf.orig       Mon Nov 23 03:05:50 2009
--- ntp.conf    Fri May 14 23:02:51 2010
***************
*** 14,27 ****

  # You do need to talk to an NTP server or two (or three).
  #server ntp.your-provider.example

  # pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
  # pick a different set every time it starts up.  Please consider joining the
  # pool: 
! server 0.debian.pool.ntp.org iburst dynamic
! server 1.debian.pool.ntp.org iburst dynamic
! server 2.debian.pool.ntp.org iburst dynamic
! server 3.debian.pool.ntp.org iburst dynamic


  # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
--- 14,31 ----

  # You do need to talk to an NTP server or two (or three).
  #server ntp.your-provider.example
+ server ntp3.jst.mfeed.ad.jp
+ server ntp2.jst.mfeed.ad.jp
+ server ntp1.jst.mfeed.ad.jp
+ server mt.yamasita.jp

  # pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
  # pick a different set every time it starts up.  Please consider joining the
  # pool: 
! # server 0.debian.pool.ntp.org iburst dynamic
! # server 1.debian.pool.ntp.org iburst dynamic
! # server 2.debian.pool.ntp.org iburst dynamic
! # server 3.debian.pool.ntp.org iburst dynamic


  # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
tswxl:/etc#

ntp の再起動

tswxl:/etc# /etc/init.d/ntp restart
Stopping NTP server: ntpd.
Starting NTP server: ntpd.
tswxl:/etc#

確認

tswxl:/etc# ntpq -p
Name or service not known
tswxl:/etc#

restrict ::1 ?

/var/log/daemon.log を見てみたら。。。。
tswxl:/etc# less /var/log/daemon.log
	:
	:
May 14 23:04:05 tswxl ntpd[1098]: getaddrinfo: "::1" invalid host address, ignored
	:
	:
というエラーが出ている。

localhost が解決できてない???

tswxl:/etc# grep localhost /etc/hosts
grep: /etc/hosts: No such file or directory
tswxl:/etc#
ぐはー

/etc/hosts の作成

tswxl:/etc# cat > hosts
127.0.0.1       localhost localhost.localdomain
192.168.2.70    tswxl   # TS-WXL
tswxl:/etc#
さて、、、
tswxl:/etc# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+ntp3.jst.mfeed. 210.173.160.56   2 u   19   64  177   13.012    3.683   0.627
*ntp2.jst.mfeed. 133.243.236.18   2 u   23   64  177   13.150    3.178   0.431
+ntp1.jst.mfeed. 210.173.160.86   2 u   18   64  177   12.976    3.958   0.625
 mt.yamasita.jp  210.173.160.87   3 u   17   64  177    0.491    2.882   0.469
tswxl:/etc# /etc/init.d/ntp restart
Stopping NTP server: ntpd.
Starting NTP server: ntpd.
tswxl:/etc#
できた。

やれやれ



TS-WXL
楽天市場
amazon
Yahoo ショッピング
Livedoor デパート


バックアップ
ハックの記録
LinkStation/玄箱 をハックしよう

/boot の整理

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