ntpの設定

ntpdateの設定

ntpの設定を行う前に、手動で時刻を合わせるためにntpdateをインストールします。

# yum install ntpdate

NTPでの時刻同期の際にサーバ内のハードウェアクロックを更新するために、次のように設定を変更しておきます。

# diff /etc/sysconfig/ntpdate.org /etc/sysconfig/ntpdate
5c5
< SYNC\_HWCLOCK=no
—
> SYNC\_HWCLOCK=yes

設定後、ntpdateを用いて手動更新しておく。

# ntpdate ntp.nict.jp

ntpの設定

ntpをインストールする。

# yum install ntp

外部からサーバのntpdサービスの利用を無効化するとともに、さくらインターネットの場合は、用意してくれているNTPサーバ ntp1.sakura.ad.jp を参照するように、次のようにntp.confを変更しておきます。

$ diff /etc/ntp.conf.org /etc/ntp.conf
8,9c8,11
< restrict default kod nomodify notrap nopeer noquery
< restrict -6 default kod nomodify notrap nopeer noquery
—
> #restrict default kod nomodify notrap nopeer noquery
> restrict default ignore
> #restrict -6 default kod nomodify notrap nopeer noquery
> restrict -6 default ignore
15a18
> restrict ntp1.sakura.ad.jp kod nomodify notrap nopeer noquery
22,24c25,28
< server 0.rhel.pool.ntp.org
< server 1.rhel.pool.ntp.org
< server 2.rhel.pool.ntp.org
—
> #server 0.rhel.pool.ntp.org
> #server 1.rhel.pool.ntp.org
> #server 2.rhel.pool.ntp.org
> server ntp1.sakura.ad.jp

ntpdを起動します。

# service ntpd start

ntpdがサーバ起動時に自動的に起動されるように設定しておきます。

# /sbin/chkconfig ntpd on

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です