HGIGA Service Docs 
» 遊客:  註冊 | 登錄 | 統計 | 幫助
RSS 訂閱當前論壇  

上一主題 下一主題
       
標題: 如何架設公用的NTP主機  
  本主題由 service.support 於 2009-2-12 13:58 移動 
 
service.support





UID 14
精華 0
積分 0
帖子 523
閱讀權限 200
註冊 2006-10-2
狀態 離線
如何架設公用的NTP主機

編輯/etc/ntp.conf

restrict default nomodify notrap noquery
restrict 127.0.0.1
restrict 192.168.1.55
restrict 192.168.0.0 mask 255.255.0.0 nomodify notrap
restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
server 220.130.158.52
server 128.250.36.2 prefer
server 142.3.100.2 prefer
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server asia.pool.ntp.org
restrict 220.130.158.52
restrict 128.250.36.2
restrict 142.3.100.2
restrict 0.asia.pool.ntp.org
restrict 1.asia.pool.ntp.org
restrict 2.asia.pool.ntp.org
restrict 3.asia.pool.ntp.org
restrict 0.pool.ntp.org
restrict 1.pool.ntp.org
restrict 2.pool.ntp.org
restrict asia.pool.ntp.org
server 127.127.1.0
fudge 127.127.1.0 stratum 10
keys    /etc/ntp/keys
driftfile /var/lib/ntp/drift
broadcastdelay  0.008

編輯 /etc/rc.d/init.d/xntpd ,  在 start 的 daemon xntpd -A 加上 -g

# xntpd         This shell script takes care of starting and stopping
#               xntpd (NTPv3 daemon).
#
# chkconfig: - 55 10
# description: xntpd is the NTPv3 daemon.

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x /usr/sbin/xntpd -a -f /etc/ntp.conf ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Adjust time to make life easy for xntpd
        if [ -f /etc/ntp/step-tickers ]; then
                echo -n "Syncing time for xntpd. "
                /usr/sbin/ntpdate -s -b -p 8 -u `cat /etc/ntp/step-tickers`
        fi
        # Start daemons.
        echo -n "Starting xntpd: "
        daemon xntpd -A -g
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xntpd
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down xntpd: "
        killproc xntpd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/xntpd
        ;;
  status)
        status xntpd
        RETVAL=$?
        ;;
  restart|reload)
        $0 stop
        $0 start
        RETVAL=$?
        ;;
  *)
        echo "Usage: xntpd {start|stop|restart|status}"
        exit 1
esac

exit $RETVAL
2009-2-12 13:49#1
查看資料  Blog  發短消息  Yahoo!  頂部
       


  可打印版本 | 推薦給朋友 | 訂閱主題 | 收藏主題  


 

   Powered by Discuz! 4.1.0  © 2001-2006 Transformed by wxxslt for HGIGA Inc. / Service Support
Processed in 0.016728 second(s), 9 queries , Gzip enabled

所有時間為 GMT+8, 現在時間是 2024-11-1 10:25