■NTPのインストール ・ソースのダウンロード ftp://ftp.udel.edu/pub/ntp/ntp4 から最新のものを取得。 ・解凍、configure,make (適当なディレクトリで行う) # tar zxf ntp-4.1.1a.tar.gz # cd ntp-4.1.1a ; pwd # ./configure >& configure.log # tail -10 configure.log # make >& make.log # tail -10 make.log ・インストール # make install >& install.log # tail -10 install.log インストール終了 ・設定ファイルを修正 /etc/ntp.conf NTP サーバーを福岡大のに設定する場合。 --- 福岡大のタイムサーバー -------------------------------------------- *bash-2.05a# host 133.100.9.2 2.9.100.133.IN-ADDR.ARPA domain name pointer clock.nc.fukuoka-u.ac.jp ----------------------------------------------------------------------- # cd /etc ; pwd # cp -ip ntp.conf ntp.conf.org # vi ntp.conf server 133.100.9.2 ・/etc/rc.conf を修正 # cp -ip rc.conf rc.conf.`date +%Y%m%d` # vi rc.conf ntpdate_enable="YES" ntpdate_flags="133.100.9.2" ntpdate_program="ntpdate" xntpd_enable="YES" xntpd_program="/usr/local/bin/ntpd" # path to ntpd xntpd_flags="-p /var/run/ntpd.pid -c /etc/ntp.conf" --> 簡単に解説。 実行プログラムが、/usr/local/bin/ntpd オプションとして、 -p で pidファイル、/var/run/ntpd.pid を指定、 -c で configファイル、/etc/ntp.conf を指定。 /etc/rc.conf を設定したら、サーバを再起動。 再起動後は、上記で設定した内容が反映されている。 ・再起動後、プロセスを確認。 bash-2.05a# ps awwx | grep ntp 75511 ?? Ss 0:00.03 /usr/local/bin/ntpd -p /var/run/ntpd.pid -c /etc/ntp.conf このようになっていればOK. ・/var/log/messagesを確認 Dec 8 19:20:34 joe ntpd[79]: ntpd exiting on signal 1 Dec 8 19:28:12 joe ntpd[75511]: ntpd 4.1.1a@1.791 Mon Sep 16 23:42:44 JST 2002 (1) Dec 8 19:28:12 joe ntpd[75511]: kernel time discipline status 2040 Dec 8 19:32:43 joe ntpd[75511]: time set 0.003646 s ・デバッグモードで試す。 bash-2.05a# ntpdate -d 133.100.9.2 8 Dec 18:12:42 ntpdate[74301]: ntpdate 4.1.0-a Wed Aug 14 18:56:48 GMT 2002 (1) transmit(133.100.9.2) transmit(133.100.9.2) receive(133.100.9.2) receive: pkt.org and peer.xmt differ receive(133.100.9.2) transmit(133.100.9.2) receive(133.100.9.2) transmit(133.100.9.2) receive(133.100.9.2) transmit(133.100.9.2) server 133.100.9.2, port 123 stratum 1, precision -16, leap 00, trust 000 refid [GPS], delay 0.08383, dispersion 8.00072 transmitted 4, in filter 4 reference time: c19d8b80.0000218e Sun, Dec 8 2002 18:12:32.000 originate timestamp: c19d8b8b.abcb2000 Sun, Dec 8 2002 18:12:43.671 transmit timestamp: c19d8b8b.a2747d80 Sun, Dec 8 2002 18:12:43.634 filter delay: 0.00000 0.08530 0.08383 0.08896 0.00000 0.00000 0.00000 0.00000 filter offset: 0.000000 0.002876 0.002381 0.004293 0.000000 0.000000 0.000000 0.000000 delay 0.08383, dispersion 8.00072 offset 0.002381 8 Dec 18:12:43 ntpdate[74301]: adjust time server 133.100.9.2 offset 0.002381 sec ・ntpqで確認 bash-2.05a# ntpdc -p remote local st poll reach delay offset disp ======================================================================= =clock.nc.fukuok 192.168.1.2 1 64 1 1.05684 0.502476 7.93750 bash-2.05a# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== clock.nc.fukuok .GPS. 1 u 45 64 1 1056.84 502.476 0.000 ・詳しくは、http://www.bsddiary.net/doc/ntpd.html back