หมายถึงเรื่อง Syslog-ng หรือว่า Network Time Protocol (NTP) ครับ สำหรับ NTP ผมใช้ Linux (ntpd) และ Cisco Router ครับ ก็ไม่ซับซ้อนมากหรอกครับ เดี่ยวจะ update ให้ครับ
NTP ปกติจะติดตั้งมากับ Linux Distribution ต่างๆ อยู่แล้ว ที่ผมใช้ก็คือ Fedora Core 6 up และ CentOS 5.2
ทำการแก้ไขไฟล์ config ที่ /etc/ntp.conf ใช้ vi /etc/ntp.conf
=================================================================
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (
www.pool.ntp.org/join.html).
# Server ที่เรา Link ด้วย
server clock.thaicert.nectec.or.th #Stratum 1
server ntp.xbsd.kr #stratum 1 KOREA
server ntp.i2t.ehu.es #stratum 1 SPAIN
# Peering กับ Server ของเรากันเอง
peer 192.168.1.24
peer 192.168.1.22
peer 192.168.1.70
#broadcast 192.168.1.255 key 42 # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 key 42 # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 key 42 # manycast client
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
# Drift file. Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
driftfile /var/lib/ntp/drift
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
# Specify the key identifiers which are trusted.
#trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
#requestkey 8
# Specify the key identifier to use with the ntpq utility.
#controlkey 8
#ไม่อนุญาติให้ Server query time จากเรา
restrict clock.thaicert.nectec.or.th mask 255.255.255.255 nomodify notrap noquery
restrict ntp.xbsd.kr mask 255.255.255.255 nomodify notrap noquery
restrict ntp.i2t.ehu.es mask 255.255.255.255 nomodify notrap noquery
#Allow hosts in local network to query for time
restrict 192.168.0.0 mask 255.255.0.0 nomodify notrap
================================================================
อย่าลืมเปิด UDP port 123 ที่ Firewall หลัก และที่ server ด้วยนะครับ
ถ้ายังไม่เคย run ntp มาก่อนต้อง initial มัน ก่อน ครั้งเดียวพอก่อน start
[bash]# ntpdate -b clock.thaicert.nectec.org
เพิ่ม ntp เป็น service (Start at Boot time) และ Start มัน
[bash]# chkconfig --level 2345 ntpd on
[bash]# /etc/init.d/ntpd restart
กว่ามันจะทำการ Synch กันได้อาจจะใช้เวลามากกว่า 5 นาที
ทำการตรวจสอบโดย (ตัวอย่าง)
[bash]# ntpq -pn
remote refid st t when poll reach delay offset jitter
=================================================================
*80.26.104.184 217.127.32.90 2 u 66 256 377 470.247 32.058 33.497
+128.95.231.7 140.142.2.8 3 u 254 256 377 217.646 -3.832 2.734
+64.112.189.11 128.10.252.6 2 u 2 256 377 258.208 2.395 47.246
127.127.1.0 LOCAL(0) 10 l 56 64 377 0.000 0.000 0.002
เครือ่งหมาย * คือ server ที่เรา Synchronized ด้วย + คือ Candidate
refid คือ reference source ของ Server ที่เรา synch ด้วย
st คือ Stratum level = 1,2,3,4 ....
เวลาเลือก server ต้องตรวจสอบด้วยนะครับว่า เขาอนุญาติให้เราเชื่อมต่อหรือไม่ (OpenAccess) และ Service Area ตรงกับเรา มันมี web site ที่ให้ List ของ Stratum One อยู่น่ะครับ