LinuxでNTPサーバを構築する方法です
OSのバージョンはRHEL6.4で検証しています。
[root@node01 ~]# yum -y install ntp
NTPがインストールされていない場合はインストールします。
[root@node01 ~]# vi /etc/ntp.conf
# Hosts on local network are less restricted.
restrict 172.17.9.0 mask 255.255.255.0 nomodify notrap
#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst
server ntp.nict.jp
server ntp.jst.mfeed.ad.jp
server s2csntp.miz.nao.ac.jp
NTPの設定ファイル(/etc/ntp.conf)を編集します。
時刻同期を許可するクライアントの範囲(restrict~)、上位のNTPサーバ(server~)を指定します。
[root@node01 ~]# service ntpd restart
ntpd を停止中: [ OK ]
ntpd を起動中: [ OK ]
ntpサービスを再起動します。
[root@node01 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
ntp-a2.nict.go. .NICT. 1 u 8 64 1 4.288 -398940 0.000
ntp2.jst.mfeed. 133.243.236.17 2 u 7 64 1 3.796 -398940 0.000
133.40.41.135 133.40.41.133 2 u 7 64 1 15.752 -398941 0.000
ntpq -pコマンドで時刻同期の状態を確認します。
server~で指定したNTPサーバが表示されています。
[root@node01 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*ntp-a2.nict.go. .NICT. 1 u 61 64 17 4.455 1.575 1.111
+ntp2.jst.mfeed. 133.243.236.17 2 u 5 64 37 3.866 2.073 1.379
+133.40.41.135 133.40.41.133 2 u 5 64 37 15.950 1.389 1.411
数分すると左側に「+」か「*」が表示されます。
この表示により時刻同期が行なわれたことが確認できます。
OSのバージョンはRHEL6.4で検証しています。
[root@node01 ~]# yum -y install ntp
NTPがインストールされていない場合はインストールします。
[root@node01 ~]# vi /etc/ntp.conf
# Hosts on local network are less restricted.
restrict 172.17.9.0 mask 255.255.255.0 nomodify notrap
#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst
server ntp.nict.jp
server ntp.jst.mfeed.ad.jp
server s2csntp.miz.nao.ac.jp
NTPの設定ファイル(/etc/ntp.conf)を編集します。
時刻同期を許可するクライアントの範囲(restrict~)、上位のNTPサーバ(server~)を指定します。
[root@node01 ~]# service ntpd restart
ntpd を停止中: [ OK ]
ntpd を起動中: [ OK ]
ntpサービスを再起動します。
[root@node01 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
ntp-a2.nict.go. .NICT. 1 u 8 64 1 4.288 -398940 0.000
ntp2.jst.mfeed. 133.243.236.17 2 u 7 64 1 3.796 -398940 0.000
133.40.41.135 133.40.41.133 2 u 7 64 1 15.752 -398941 0.000
ntpq -pコマンドで時刻同期の状態を確認します。
server~で指定したNTPサーバが表示されています。
[root@node01 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*ntp-a2.nict.go. .NICT. 1 u 61 64 17 4.455 1.575 1.111
+ntp2.jst.mfeed. 133.243.236.17 2 u 5 64 37 3.866 2.073 1.379
+133.40.41.135 133.40.41.133 2 u 5 64 37 15.950 1.389 1.411
数分すると左側に「+」か「*」が表示されます。
この表示により時刻同期が行なわれたことが確認できます。
コメント