1.執行下列指令安裝

  sudo apt-get install ntp

2.修改ntp設定檔

  sudo nano /etc/ntp.conf

   (1)找到  #statsdir /var/log/ntpstats

        將 #字號拿掉 開啟紀錄功能

   (2)設定外界NTP Server

        台灣區的NTP伺服器如下

            參考資料 

                http://www.stdtime.gov.tw/Time/ntp/resource.htm

                http://www.ntp.org/

              tock.stdtime.gov.tw

              tick.stdtime.gov.tw

              time.stdtime.gov.tw

              clock.stdtime.gov.tw

              watch.stdtime.gov.tw

           

     找到

     server 0.ubuntu.pool.ntp.org

     server 1.ubuntu.pool.ntp.org

     server 2.ubuntu.pool.ntp.org

     server 3.ubuntu.pool.ntp.org

 

     設定你想使用的台灣區NTP伺服器,請選擇伺服器速度快且穩定的NTP伺服器,依據優先性設定0~3四個NTP伺服器

 

     server tock.stdtime.gov.tw 

     server tick.stdtime.gov.tw 

     server time.stdtime.gov.tw 

     server clock.stdtime.gov.tw

3.修改要廣播更新時間的子網段假設我的網段是192.168.2.0/24

 

   可於設定檔找到下列說明 

   # If you want to provide time to your local subnet, change the next line.
   # (Again, the address is an example only.)
   #broadcast 192.168.123.255

  broadcast 192.168.2.255

4.重新啟動NTP服務 

   sudo service ntp restart

5.檢查NTP服務是否同步

  sudo ntpq -c lpeer

  執行後會出現步驟2.設定的網域對應的IP資料與

6.檢查NTP服務同步紀錄檔是否正常寫入

  sudo tail -f /var/log/syslog

7.記得檢查UDP 123 port是否開啟

 

arrow
arrow
    文章標籤
    NTP ubuntu
    全站熱搜

    K 發表在 痞客邦 留言(0) 人氣()