【Ubuntu 16.04 LTS Server】NTP時刻同期

スポンサーリンク

NTPd をインストールして、時刻同期のための NTP サーバーを構築。

インストール

$ sudo apt install ntp
$ sudo apt install ntpdate

一旦、NTPサービスを停止して、ntpdateで時刻同期

$ sudo service ntp stop
$ sudo ntpdate ntp.nict.jp

/etc/ntp.conf ファイルの編集

国内のサーバに変更。ntp.confファイルを編集。

$ sudo nano /etc/ntp.conf
# 18行目:コメント化
# pool 0.ubuntu.pool.ntp.org iburst
# pool 1.ubuntu.pool.ntp.org iburst
# pool 2.ubuntu.pool.ntp.org iburst
# pool 3.ubuntu.pool.ntp.org iburst
# pool ntp.ubuntu.com

# 同期をとるサーバーを指定
server ntp.nict.jp iburst
server ntp1.jst.mfeed.ad.jp iburst 
server ntp2.jst.mfeed.ad.jp iburst 
server ntp3.jst.mfeed.ad.jp iburst 

ntpサービスを起動する

$ sudo service ntp start

時刻同期の確認

$ ntpq -p

*がついているサーバが同期しているサーバ

補足

  • NTP は 「123/UDP」ポートを使用。
  • 私は後記事で紹介しているように、ヤマハルータをntpサーバにしているので、下記行を設定。
    server 192.168.1.1 iburst

参考

  1. Ubuntu 16.04 LTS : NTPサーバーの設定(NTPd) : Server World
  2. Ubuntu NTPインストールと時刻同期 – Selection for my Life

コメント

タイトルとURLをコピーしました