LS-GL:debian:ntp の設定


ntp を使って LS-GL の時刻をインターネット標準時に同期する

ntpd のインストール

hackkit:~# apt-get update
Hit http://security.debian.org sarge/updates/main Packages
Hit http://security.debian.org sarge/updates/main Release
Hit http://security.debian.org sarge/updates/contrib Packages
Hit http://security.debian.org sarge/updates/contrib Release
Hit http://security.debian.org sarge/updates/non-free Packages
Hit http://security.debian.org sarge/updates/non-free Release
Hit http://ftp.jp.debian.org sarge/main Packages
Hit http://ftp.jp.debian.org sarge/main Release
Hit http://ftp.jp.debian.org sarge/contrib Packages
Hit http://ftp.jp.debian.org sarge/contrib Release
Hit http://ftp.jp.debian.org sarge/non-free Packages
Hit http://ftp.jp.debian.org sarge/non-free Release
Hit http://ftp.jp.debian.org sarge/non-US/main Packages
Hit http://ftp.jp.debian.org sarge/non-US/main Release
Hit http://ftp.jp.debian.org sarge/non-US/contrib Packages
Hit http://ftp.jp.debian.org sarge/non-US/contrib Release
Hit http://ftp.jp.debian.org sarge/non-US/non-free Packages
Hit http://ftp.jp.debian.org sarge/non-US/non-free Release
Hit http://ftp.jp.debian.org sarge/main Sources
Hit http://ftp.jp.debian.org sarge/main Release
Hit http://ftp.jp.debian.org sarge/contrib Sources
Hit http://ftp.jp.debian.org sarge/contrib Release
Hit http://ftp.jp.debian.org sarge/non-free Sources
Hit http://ftp.jp.debian.org sarge/non-free Release
Hit http://ftp.jp.debian.org sarge/non-US/main Sources
Hit http://ftp.jp.debian.org sarge/non-US/main Release
Hit http://ftp.jp.debian.org sarge/non-US/contrib Sources
Hit http://ftp.jp.debian.org sarge/non-US/contrib Release
Hit http://ftp.jp.debian.org sarge/non-US/non-free Sources
Hit http://ftp.jp.debian.org sarge/non-US/non-free Release
Reading Package Lists... Done
hackkit:~# apt-get install ntpd
Reading Package Lists... Done
Building Dependency Tree... Done
E: Couldn't find package ntpd
hackkit:~# apt-get install ntp
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  perl perl-modules psmisc
Suggested packages:
  ntpdate ntp-doc libterm-readline-gnu-perl libterm-readline-perl-perl
Recommended packages:
  ntp-server perl-doc
The following NEW packages will be installed:
  ntp perl perl-modules psmisc
0 upgraded, 4 newly installed, 0 to remove and 1 not upgraded.
Need to get 5613kB of archives.
After unpacking 22.1MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.jp.debian.org sarge/main perl-modules 5.8.4-8sarge5 [2179kB]
Get:2 http://ftp.jp.debian.org sarge/main perl 5.8.4-8sarge5 [3133kB]
Get:3 http://ftp.jp.debian.org sarge/main psmisc 21.5-1 [43.5kB]
Get:4 http://ftp.jp.debian.org sarge/main ntp 1:4.2.0a+stable-2sarge1 [257kB]
Fetched 5613kB in 13s (425kB/s)
Selecting previously deselected package perl-modules.
(Reading database ... 9633 files and directories currently installed.)
Unpacking perl-modules (from .../perl-modules_5.8.4-8sarge5_all.deb) ...
Selecting previously deselected package perl.
Unpacking perl (from .../perl_5.8.4-8sarge5_arm.deb) ...
Selecting previously deselected package psmisc.
Unpacking psmisc (from .../archives/psmisc_21.5-1_arm.deb) ...
Selecting previously deselected package ntp.
Unpacking ntp (from .../ntp_1%3a4.2.0a+stable-2sarge1_arm.deb) ...
Setting up psmisc (21.5-1) ...

Setting up perl-modules (5.8.4-8sarge5) ...
Setting up ntp (4.2.0a+stable-2sarge1) ...

Setting up perl (5.8.4-8sarge5) ...

hackkit:~# ls /usr/sbin/ntp*
/usr/sbin/ntp-keygen
hackkit:~#
あれ?
そうか、ntp-server をインストールしないといけないのか。
hackkit:~# apt-get install ntp-server
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  ntp-simple
Suggested packages:
  ntpdate ntp-doc
The following NEW packages will be installed:
  ntp-server ntp-simple
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 159kB of archives.
After unpacking 459kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.jp.debian.org sarge/main ntp-simple 1:4.2.0a+stable-2sarge1 [128kB]
Get:2 http://ftp.jp.debian.org sarge/main ntp-server 1:4.2.0a+stable-2sarge1 [31.4kB]
Fetched 159kB in 0s (196kB/s)
Selecting previously deselected package ntp-simple.
(Reading database ... 10964 files and directories currently installed.)
Unpacking ntp-simple (from .../ntp-simple_1%3a4.2.0a+stable-2sarge1_arm.deb) ...
Selecting previously deselected package ntp-server.
Unpacking ntp-server (from .../ntp-server_1%3a4.2.0a+stable-2sarge1_arm.deb) ...
 Removing any system startup links for /etc/init.d/ntp-simple ...
 Removing any system startup links for /etc/init.d/ntp-refclock ...
 Removing any system startup links for /etc/init.d/ntp ...
ntpd: no process killed
Setting up ntp-simple (4.2.0a+stable-2sarge1) ...

Setting up ntp-server (4.2.0a+stable-2sarge1) ...
Starting NTP server: ntpd.

hackkit:~#
Starting NTP server って、どこをサーバにしたの?
hackkit:~# less /etc/ntp.conf
	:
hackkit:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 hog.internews-b 147.231.100.5    3 u    -   64    7  357.618  22216.8  96.417
 LOCAL(0)        LOCAL(0)        13 l   64   64    3    0.000    0.000   0.015
pool.ntp.org か。

ntp.conf の設定

自分の NTP サーバを指定する
hackkit:~# cd /etc/
hackkit:/etc# mv ntp.conf ntp.conf.orig
hackkit:/etc# cp ntp.conf.orig ntp.conf
hackkit:/etc# ls -l ntp.conf*
-rw-r--r--  1 root root 1792 Oct 14 09:47 ntp.conf
-rw-r--r--  1 root root 1792 Aug 27  2005 ntp.conf.orig
hackkit:/etc#
hackkit:/etc# diff -c ntp.conf.orig ntp.conf
*** ntp.conf.orig       Sat Aug 27 19:13:20 2005
--- ntp.conf    Sat Oct 14 09:48:53 2006
***************
*** 19,25 ****
  # Your server will pick a different set every time it starts up.
  #  *** Please consider joining the pool! ***
  #  ***    ***
! server pool.ntp.org
  #server pool.ntp.org
  ## uncomment for extra reliability

--- 19,33 ----
  # Your server will pick a different set every time it starts up.
  #  *** Please consider joining the pool! ***
  #  ***    ***
! server  ntp3.jst.mfeed.ad.jp
! server  ntp2.jst.mfeed.ad.jp
! server  ntp1.jst.mfeed.ad.jp
! server  ntp2.wakwak.com
! server  ntp1.wakwak.com
! server  link.yamasita.jp
! server  giga.yamasita.jp
! server  gawa.yamasita.jp
! #server pool.ntp.org
  #server pool.ntp.org
  ## uncomment for extra reliability

hackkit:/etc#

ntpd の再起動

hackkit:/etc# /etc/init.d/ntp-server restart
Restarting NTP server: ntpd... done.
hackkit:/etc# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 ntp3.jst.mfeed. 210.173.160.86   2 u   23   64    1   31.807  22470.3   0.015
 ntp2.jst.mfeed. 210.173.160.56   2 u   23   64    1   31.653  22469.9   0.015
 ntp1.jst.mfeed. 210.173.160.56   2 u   22   64    1   32.710  22470.0   0.015
 ntp2.wakwak.com .INIT.          16 u    -   64    0    0.000    0.000 4000.00
 ntp1.wakwak.com .INIT.          16 u    -   64    0    0.000    0.000 4000.00
 192.168.1.30    210.173.160.57   3 u   19   64    1   10.526  22520.1   0.015
 192.168.1.2     210.173.160.87   3 u   18   64    1    0.414  22436.7   0.015
 192.168.1.32    .INIT.          16 u    -   64    0    0.000    0.000 4000.00
 192.168.1.37    .INIT.          16 u    -   64    0    0.000    0.000 4000.00
 LOCAL(0)        LOCAL(0)        13 l   15   64    1    0.000    0.000   0.015
hackkit:/etc#
22 秒ほど遅れている。

すこしして、、、、

hackkit:/etc# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 ntp3.jst.mfeed. 210.173.160.86   2 u   57   64    7   32.903   65.696  60.244
 ntp2.jst.mfeed. 210.173.160.56   2 u   61   64    7   31.815   66.971  36.046
 ntp1.jst.mfeed. 210.173.160.56   2 u   56   64    7   32.039   65.425  60.950
 ntp2.wakwak.com .STEP.          16 u    -  256    0    0.000    0.000 4000.00
 ntp1.wakwak.com .STEP.          16 u    -  256    0    0.000    0.000 4000.00
 192.168.1.30    210.173.160.87   3 u   60   64    7    0.412   73.214  23.858
 192.168.1.2     210.173.160.57   3 u   58   64    7    0.322    6.528  23.477
 192.168.1.32    .STEP.          16 u    -  256    0    0.000    0.000 4000.00
 192.168.1.37    .STEP.          16 u    -  256    0    0.000    0.000 4000.00
 LOCAL(0)        LOCAL(0)        13 l   57   64    7    0.000    0.000   0.015
hackkit:/etc#
同期してきた。


LS-GL:debian:カーネル
ハックの記録
LinkStation/玄箱 をハックしよう

LS-GL:IDE HDD 内蔵

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