NTP(ntpd)の設定を変更して日本時間で同期させる

ntp.conf の設定変更

/etc/ntp.conf ファイルを編集します。
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server -4 ntp.nict.jp iburst
server -4 ntp.nict.jp iburst
server -4 ntp.nict.jp iburst
とします。-4 を指定することでIPv4で接続します。

コマンドによる時刻の同期

/etc/rc.d/init.d/ntpd stop
コマンドでntpdを停止させます。

ntpdate ntp.nict.jp
コマンドで時刻を同期します。
12 May 00:38:48 ntpdate[2820]: step time server 133.243.238.244 offset 6.083416 sec
と表示されれば同期完了です。

ハードウェアクロックの同期

hwclock --systohc
コマンドでハードウェアクロックの同期ができます。

ntpd の起動

/etc/rc.d/init.d/ntpd start
コマンドでntpdを起動します。
著者
かつて日本を代表したスーパーエンジニア (自称)
ハードウェア、電気設備、ガーデニング関係の記事を担当。
最終更新日: 2024-01-06
作成日: 2011-05-12
iPentec all rights reserverd.