Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music
All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => all application on unix knowledges by golfreeze => Topic started by: golfreeze on มกราคม 24, 2011, 11:58:36 am
-
#cd /usr/ports/net/ntp
#make install clean
vi /etc/ntp.conf
#server ntplocal.example.com prefer
#server timeserver.example.org
#server ntp2a.example.net
server clock.nectec.or.th
server 127.127.1.0
server xxx.xxx.com
fudge 127.127.1.0 stratum 13
restrict 202.142.213.0 mask 255.255.255.0
driftfile /var/db/ntp.drift
------------------------------------------------------
#vi /etc/rc.conf
ntpd_enable="YES"
------------------------------------------------------
สั่งให้ service ทำงาน
/etc/rc.d/ntpd stop
/etc/rc.d/ntpd start
###test
#ntpq -p
#ntpdate 202.142.213.172
-
สำหรับ debian เวลาจะ อัฟเดท เวลาให้ตรงกับเวลา ท้องถิ่นก็
cd /usr/share/zoneinfo/เลือกประเทศ /etc/localtime
แล้วใช้ตำสั่ง
#ntpdate หาserverท้องถิ่น
#ntpdate sg.pool.ntp.org
แค่นี้ครับแล้วลอง ตรวจสอบดู
#date
ตัวย่อประเทศ ต้องตรงกันด้วยน่ะครับ MYT (Malaysia)
จะให้ sync ทุกครั้งที่ restart ใหม่ก็
#vi /etc/rc.local
add
ntpdate sg.pool.ntp.org
-
วิธีการลง NTP (Network Time Protocol) Server ใน CentOS 5 ครับ
step ที่ 1
#yum install ntp
step 2
# crontab -e
step 3
# vi /etc/ntp.conf
สำหรับบันทัดนี้ มันจะเป็นแหล่งที่เรา ไป sync กับตัว หลัก
server clock.nectec.or.th prefer
บันทัดนี้ สำหรับ server รอง
server 202.142.213.175
อนุญาติให้ ทุกๆ client ติดต่อสั่ง ntpdate ได้
restrict 0.0.0.0 mask 0.0.0.0 nomodify
step 4
# chkconfig ntpd on
# vi /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes
(write the sync time to CMOS)
Final
# pgrep ntpd
(checking the ntpd process ID)
# netstat -ntlup
(checking the sync status)
# ntpq -p
(checking the port’s status)
configure the firewall rule, make sure the UDP:123 is accept.
#service ntpd start
(start the ntp server)
Client may get the ntpserver time after 5~10 min.
-
สำหรับ debian เวลาจะ อัฟเดท เวลาให้ตรงกับเวลา ท้องถิ่นก็
cp /usr/share/zoneinfo/เลือกประเทศ /etc/localtime
แล้วใช้ตำสั่ง
#ntpdate หาserverท้องถิ่น
#ntpdate sg.pool.ntp.org
ถ้ายังไม่มี tool ntpdate ก็ลงได้โดย
#apt-get install ntpdate
แค่นี้ครับแล้วลอง ตรวจสอบดู
#date
ตัวย่อประเทศ ต้องตรงกันด้วยน่ะครับ MYT (Malaysia)
จะให้ sync ทุกครั้งที่ restart ใหม่ก็
#vi /etc/rc.local
add
ntpdate sg.pool.ntp.org