เรื่องเวลาที่ตรงเป็นสิ่งสำคัญมากสำหรับ IT Environment.
Network Time Protocol (NTP) คือ เป็นโปรโตคอลที่ใช้เทียบเวลา (Sync) ระหว่างอุปกรณ์ที่ให้บริการเทียบเวลา(Time Server Sync) กับอุปกรณ์อื่นๆ (Client Time Sync) โดยใช้ UDP Protocol พอร์ต 123 เรามาเริ่มกันเลย
สำหรับ NTP ของไทย ดูรายชื่อจาก th.pool.ntp.org ได้เลยครับลอง nslookup ดูก็ได้
1 2 3 4 5 6 7 8 9 10 11 12 13 |
C:\> C:\>nslookup th.pool.ntp.org Server: NULL Address: 192.168.1.1 Non-authoritative answer: Name: th.pool.ntp.org Addresses: 113.53.247.3 124.109.2.169 202.151.5.10 203.158.118.2 C:\> C:\> |
ส่วนมากผมจะใช้ NTP ดังนี้
ม.เกษตร ntp.ku.ac.th
มาตรวิทยาแห่งชาติ time1.nimt.or.th, time2.nimt.or.th, time3.nimt.or.th
CAT Telecom ntp1.cat.net.th, ntp2.cat.net.th
*** ตัวไหนเสถียรก็พยายามใช้ตัวนั้นแหละครับ ****
1. ทำการติดตั้ง NTPD และเพิ่ม NTP Pool Server ไทยเข้าไปครับ
1 2 3 4 5 6 7 8 9 10 11 12 |
[root@thaiops01 ~]# yum -y update [root@thaiops01 ~]# yum -y install ntp [root@thaiops01 ~]# [root@thaiops01 ~]# vi /etc/ntp.conf .................................................................................. # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server ntp.ku.ac.th iburst server time1.nimt.or.th iburst ...................................................................... [root@thaiops01 ~]# |
2. ทำการ Start NTPD บน CentOS7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[root@thaiops01 ~]# systemctl start ntpd [root@thaiops01 ~]# [root@thaiops01 ~]# systemctl status ntpd ● ntpd.service - Network Time Service Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled) Active: active (running) since Fri 2017-03-17 20:26:45 +07; 6h left Process: 2360 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS) Main PID: 2361 (ntpd) CGroup: /system.slice/ntpd.service └─2361 /usr/sbin/ntpd -u ntp:ntp -g Mar 17 20:26:45 thaiops01.thaiops.com ntpd[2361]: Listen normally on 2 lo 127.0.0.1 UDP 123 Mar 17 20:26:45 thaiops01.thaiops.com ntpd[2361]: Listen normally on 3 ens160 172.25.1.146 UDP 123 ................................................................................................................ [root@thaiops01 ~]# |
3. ทำการตรวจสอบ Sync Time
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
[root@thaiops01 ~]# ntpstat synchronised to NTP server (203.185.69.59) at stratum 2 time correct to within 92 ms polling server every 64 s [root@thaiops01 ~]# [root@thaiops01 ~]# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== +ntp.ku.ac.th 113.53.247.3 2 u 704 64 0 13.159 9.087 0.000 *203.185.69.59 .IRIG. 1 u 23 64 363 12.254 15.278 4.468 [root@thaiops01 ~]# [root@thaiops01 ~]# date Sun Mar 19 23:27:58 +07 2017 [root@thaiops01 ~]# [root@thaiops01 ~]# cal March 2017 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 [root@thaiops01 ~]# |
เรียบร้อยแล้วครับ
อ้างอิงข้อมูลเพิ่มเติม
http://www.pool.ntp.org/zone/th