NTPサーバ(Ntpd) - CentOS|Systems Engineer Wiki

Systems Engineer Wiki

訪問者:23,221,772 人目

<< 2024年03月 

12
3456789
10111213141516
17181920212223
24252627282930
31
お知らせ・メンテナンス情報
  >  
  >  
NTPサーバ(Ntpd)

NTPサーバ(Ntpd)

投稿日:2015-01-10 01:43:41

NTPサーバ(Ntpd)

ローカルで開発を仮想環境の時刻がずれる為、時刻同期が行える等にタイムサーバをインストールしてみた。 まず、タイムサーバがインストールされているかを確認する。

# yum list installed ntp 読み込んだプラグイン:fastestmirror Loading mirror speeds from cached hostfile * base: www.ftp.ne.jp * epel: mirror.premi.st * extras: www.ftp.ne.jp * rpmforge: ftp.riken.jp * updates: www.ftp.ne.jp エラー: 表示するパッケージはありません

検索対象のモジュールが見つからない場合は、「エラー: 表示するパッケージはありません」とエラーメッセが表示されます。 モジュールが見つからない場合は、yumコマンドを利用してモジュールのインストールを行います。

# yum install ntp

次にタイムサーバの時刻同期先を設定します。 タイムサーバの設定ファイルを開きます。

# vi /etc/ntp.conf

日本国内のタイプサーバを設定します。 今回は、NICT(独立行政法人情報通信研究機構)のタイムサーバで同期を行います。 タイムサーバ:ntp.nict.jp

# For more information about this file, see the man pages # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5). driftfile /var/lib/ntp/drift # Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery # Permit all access over the loopback interface. This could # be tightened as well, but to do so would effect some of # the administrative functions. restrict 127.0.0.1 restrict -6 ::1 # Hosts on local network are less restricted. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap # 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 iburst #server 1.centos.pool.ntp.org iburst #server 2.centos.pool.ntp.org iburst #server 3.centos.pool.ntp.org iburst server ntp.nict.jp #broadcast 192.168.1.255 autokey # broadcast server #broadcastclient # broadcast client #broadcast 224.0.1.1 autokey # multicast server #multicastclient 224.0.1.1 # multicast client #manycastserver 239.255.254.254 # manycast server #manycastclient 239.255.254.254 autokey # manycast client # Enable public key cryptography. #crypto includefile /etc/ntp/crypto/pw # Key file containing the keys and key identifiers used when operating # with symmetric key cryptography. keys /etc/ntp/keys # Specify the key identifiers which are trusted. #trustedkey 4 8 42 # Specify the key identifier to use with the ntpdc utility. #requestkey 8 # Specify the key identifier to use with the ntpq utility. #controlkey 8 # Enable writing of statistics records. #statistics clockstats cryptostats loopstats peerstats

タイムサーバを起動します。

# /etc/init.d/ntpd start

タイムサーバの自動起動設定をします。

# # chkconfig ntpd on