ntp クライアント

ntp クライアント設定は、すごくカンタン。

設定ファイル: /etc/inet/ntp.conf に時刻同期サーバを設定するだけ。

たまに「/etc/inet/ntp.conf がありません。」ってハナシを聞きます。

もちろん、一から作ってもいいのですが、ちゃんと「雛形」が用意されていますです。

コレ↓
 /etc/inet/ntp.client

コピって使いましょう。


 # cp -p /etc/inet/ntp.client /etc/inet/ntp.conf

編集します。

 # vi /etc/inet/ntp.client
 # ident "@(#)ntp.client 1.3 00/07/17 SMI"
 #
 # /etc/inet/ntp.client
 #
 # An example file that could be copied over to /etc/inet/ntp.conf; it
 # provides a configuration for a host that passively waits for a server
 # to provide NTP packets on the ntp multicast net.
 #
 
 ###multicastclient 224.0.1.1 <-★ コメントアウト

 server 210.173.160.27

設定はコレだけ。

xntpd を起動します。

 # svcadm -v enable ntp
 svc:/network/ntp:default が有効になりました。 <-★ 起動完了メッセージ

おわり。

あー。ntpd が、起動していると ntpdate は使えませんよー。

 # ntpdate 210.173.160.27
xxxxxxxxxx ntpdate[2199]: the NTP socket is in use, exiting

どうしても手動で ntpdate したいってときは、ntp を止めましょう。

 # svcadm -v disable ntp
 svc:/network/ntp:default が無効になりました。

で、もういちど ntpdate 実行!

 # ntpdate 210.173.160.27
xxxxxxxxxx ntpdate[2192]: adjust time server 210.173.160.27 offset -0.001709 sec

これで桶。