LoginSignup
1
1

More than 5 years have passed since last update.

CentOS7.3にNTPサーバを立てる

Last updated at Posted at 2018-05-14

概要

・NICTに時刻同期を行い、所定のネットワークにあるマシンからの時刻同期要求を受け付ける

導入・構築

1.NTPDのインストール

[root@servername]# yum -yinstall ntp

2.NTPDの設定編集

①設定ファイルを開く

[root@servername]# vi /etc/ntp.conf

②同期を取るサーバを変更する

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 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 minpoll 6 maxpoll 10
server ntp1.jst.mfeed.ad.jp minpoll 6 maxpoll 10
server ntp2.jst.mfeed.ad.jp minpoll 6 maxpoll 10

minpoll..最小ポーリング間隔
maxpoll..最大ポーリング間隔
時刻同期が指定のNTPサーバとズレが無くなってきたら、最大ポーリング間隔まで時刻同期のタイミングを遅らせることができる。

③時刻同期を許可するネットワークを定義する

ntp.conf
# Host on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
restrict xxx.xxx.xxx.xxx mask xxx.xxx.xxx.xxx nomodify notrap

3.NTPサービス開始&スタートアップ登録

# サービス開始
[root@servername]# systemctl start ntpd

# OS起動時にサービスを開始する(スタートアップ登録)
[root@servername]# systemctl enable ntpd

4.NTP通信をfirewallに通す

[root@servername]# firewall-cmd --add-service=ntp --permanent
success
[root@servername]# firewall-cmd --reload
success

5.動作確認

[root@servername]# ntpq -p

remote                refid     st t when poll reach  delay  offset  jitter
============================================================================
*ntp-b2.nict.go. .NICT.          1 u   31   64  377   7.641  -20.779  5.652
+ntp1.jst.mfeed. 133.243.236.17  2 u   28   64  377   5.827  -10.895  7.063
+ntp2.jst.mfeed. 133.243.236.17  2 u   21   64  377   6.632  -13.189  4.819

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1