非エンジニアのエンジニア道

非エンジニアからエンジニアに転向!その勉強の軌跡を載せていきます。

時間を設定する

時間がずれていて、気持ち悪いので、NTPを設定して時刻を合わせる

NTPとは

Network Time Protocol
コンピュータの内部時計を、ネットワークを介して正しく調整するプロトコル。

設定ファイル編集

# yum -y install ntp                                        インストール
# vi /etc/ntp.conf                                          設定ファイルをインストール

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap     コメントアウトをはずす
# server 0.rhel.pool.ntp.org                                コメントアウトする
# server 1.rhel.pool.ntp.org
# server 2.rhel.pool.ntp.org
server -4 ntp.nict.jp                                       追加する
server -4 ntp1.jst.mfeed.ad.jp
server -4 ntp2.jst.mfeed.ad.jp

設定を有効にする

# ntpdate ntp.nict.jp                                       手動で時間を合わせる
# /etc/rc.d/init.d/ntpd start                               サーバー起動
# chkconfig ntpd on                                         自動起動設定

接続状態確認

しばらくたつと、先頭に * + が追加される。

# ntpq -p