• 2007-07-12

    ntp配置

    版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
    http://happyman-bruce.blogbus.com/logs/6635378.html

    There is a wonderful net standard called NTP that can synchronize system clocks. You may already have followed someone's advice and used 'ntpdate' or 'rdate' to set the time on your server. But NTP is really designed to keep a large network of clocks perfectly synchronized. Not just accurate to the second, but to the millisecond! Here's how to set it up.

    First, make sure you have some kind of firewall running. This is generic information really, not specific to NTP, but you should always run a firewall if you have a publically available server. In this case, it may protect you from yet-undiscovered flaws in your NTP client.

    Now to properly use NTP, you need to have the full set of NTP tools. You may already have them installed; you can check by running the following as root:

    rpm -q ntp

    If it says it is not installed, then you need to download and install the appropriate RPMs. Head over to http://www.rpmfind.net/linux/rpm2htm....php?query=ntp and find the right package for your operating system. Download the RPM, and install it as root:

    rpm -ivh ntp-*.rpm


    Now, you have to configure it. I've done all the hard work and found some reliable servers with open access policies ... all you have to do is copy my files!

    You need to edit your /etc/ntp.conf file and REPLACE the contents with the following:

    PHP Code:
    restrict default nomodify notrap noquery
    restrict 127.0.0.1
    server now
    .okstate.
    edu
    server clock
    .nyc.he.
    net
    server clock
    .via.
    net
    server ntp
    -2.vt.
    edu
    server  127.127.1.0     
    # local clock
    fudge   127.127.1.0 stratum 10
    driftfile 
    /etc/ntp/
    drift 
    Also edit your /etc/ntp/step-tickers file and REPLACE the contents with:

    PHP Code:
    now.okstate.edu
    clock
    .nyc.he.
    net
    clock
    .via.
    net
    ntp
    -2.vt.
    edu 

    Now run the following:

    chkconfig --level 345 ntpd on
    service ntpd restart


    And you're all done! The ntpd program is running in the background, accurately keeping time down to the millisecond, with absolutely no drift. Your clock will always be accurate!

    收藏到:Del.icio.us