R.A. Epigonos et al.

[debian] ntpd のインストールと設定確認

ntpd はずれている時間を徐々に正確な時間に戻していくのに対して、ntpdate はずれている時間をすぐに正確な時間に戻す。これが ntpd と ntpdate の違い。いきなり時間が変わると問題の出てくるシステムでは ntpd を使ったほうがいいと思うのだがどうだろう。

ntpdate は ntpd と比較してリソース使用量が少ないとはいうものの、時間が急激に変わるのは良くないので、ntpd を使う。ntp でパッケージ検索。

# apt-cache search --names-only ntp
antpm - ANT+ information retrieval client for Garmin GPS products
antpm-dbg - ANT+ information retrieval client for Garmin GPS products
chntpw - NT SAM password recovery utility
cyrus-nntpd - Cyrus mail system - NNTP support
cyrus-nntpd-2.4 - Cyrus mail system - NNTP support [dummy package]
jamnntpd - NNTP Server allowing newsreaders to access a JAM messagebase
jamnntpd-dbg - debugging symbols for jamnntpd
libnet-ntp-perl - Perl module to query NTP servers
libnews-nntpclient-perl - Perl module to access NNTP servers
mountpy - script for quick mounting of removable devices
ntp - Network Time Protocol daemon and utility programs
ntp-doc - Network Time Protocol documentation
ntpdate - client for setting system time from NTP servers
python-ntplib - Python NTP library
ntpstat - show network time protocol (ntp) status
openntpd - OpenBSD NTP daemon
php-net-nntp - PHP Pear module for NNTP
puppet-module-puppetlabs-ntp - Puppet module for ntp
raintpl - easy and fast template engine for PHP
sinntp - tiny non-interactive NNTP client

色々出てくるけど、今回インストールするのは ntp パッケージ。

# apt-get --no-install-recommends install ntp
(snip)

インストールが完了すると自動的に ntpd が走り始める。どうやら時刻あわせの 1 回目ではいきなり動かすみたいだ。さっきといってること違うじゃない。

# systemctl --lines 100 --full status ntp
● ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp)
   Active: active (running) since *** ****-**-** **:**:** ***; 7min ago
   CGroup: /system.slice/ntp.service
           └─1246 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 105:110

*** ** **:**:** ************** ntp[1239]: Starting NTP server: ntpd.
*** ** **:**:** ************** ntpd[1246]: proto: precision = 0.154 usec
*** ** **:**:** ************** ntpd[1246]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
*** ** **:**:** ************** ntpd[1246]: Listen and drop on 1 v6wildcard :: UDP 123
*** ** **:**:** ************** ntpd[1246]: Listen normally on 2 lo 127.0.0.1 UDP 123
*** ** **:**:** ************** ntpd[1246]: Listen normally on 3 eth2 ***.***.***.*** UDP 123
*** ** **:**:** ************** ntpd[1246]: Listen normally on 4 eth3 ***.***.***.*** UDP 123
*** ** **:**:** ************** ntpd[1246]: Listen normally on 5 eth4 ***.***.***.*** UDP 123
*** ** **:**:** ************** ntpd[1246]: Listen normally on 6 ppp0 ***.***.***.*** UDP 123
*** ** **:**:** ************** ntpd[1246]: Listen normally on 7 lo ::1 UDP 123
*** ** **:**:** ************** ntpd[1246]: Listen normally on 8 eth1 ****:****:****:****:****:**** UDP 123
*** ** **:**:** ************** ntpd[1246]: Listen normally on 9 eth4 ****:****:****:****:****:**** UDP 123
*** ** **:**:** ************** ntpd[1246]: Listen normally on 10 eth1 ****:****:****:****:****:****:****:**** UDP 123
*** ** **:**:** ************** ntpd[1246]: peers refreshed
*** ** **:**:** ************** ntpd[1246]: Listening on routing socket on fd #27 for interface updates

ntpd が正しく動いているかどうか確認するには ntpq -p を使う。

$ date
(snip)
$ ntpq -p -n
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-54.64.6.78      133.243.238.163  2 u   51   64  177   19.847  -36.917   9.665
*210.140.66.77   133.243.238.163  2 u   45   64  377   20.718  -18.939  13.742
+129.250.35.251  249.224.99.213   2 u   12   64  377   17.995  -29.666   7.537
+116.91.118.97   133.243.238.164  2 u   12   64  377   22.067  -22.347  11.515

リファレンス

  1. ntpd ntpdate - Google 検索
  2. UNIX/Linuxコマンドリファレンス サーバ運用管理BLOG: ntpdとntpdateの違い
  3. ntpd lenny - Google 検索

ソーシャルブックマーク

  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us

ChangeLog

  1. Posted: 2009-02-14T15:43:57+09:00
  2. Modified: 2009-02-14T15:43:57+09:00
  3. Generated: 2023-08-27T23:09:13+09:00