红联Linux门户
Linux帮助

Using ntp with Red Hat Linux/Fedora

发布时间:2007-11-04 00:43:20来源:红联作者:radio
Here are the steps to configure Network Time Protocol (ntp) with Red Hat Linux/Fedora.

1. Choose three stratum 2 time servers, preferably in geographically disparate locations.

2. Edit /etc/ntp.conf and add the time servers in the “OUR TIMESERVERS” section. In this example, I am using the three timeserver 128.101.101.101, 199.240.130.1, and 216.204.156.2.

vi /etc/ntp.conf
/OUR TIMESERVERS

Add:
restrict 128.101.101.101 mask 255.255.255.255 nomodify notrap noquery
restrict 199.240.130.1 mask 255.255.255.255 nomodify notrap noquery
restrict 216.204.156.2 mask 255.255.255.255 nomodify notrap noquery
server 128.101.101.101
server 199.240.130.1
server 216.204.156.2

3. Before starting the ntpd daemon, run ntpdate to synchronize your clock with a time server. ntpd will not synchronize your clock with a time server if your system clock is significantly off NTP time.
ntpdate -u 128.101.101.101

As an alternative, you can add your time servers to /etc/ntp/step-tickers. You do not need to manually run ntpdate to synchronize your clock as ntpd will query these time servers if your clock is significantly off NTP time.

4. Start the ntpd daemon.
/sbin/service ntpd start

The graphical user interface utility redhat-config-date (Red Hat Linux) or system-config-date (Fedora Core) may also be used to administer ntp.

下面的方法可以手动调整时间
对照linux时间和bios时间
[root@mrtg root]# date ; /sbin/hwclock -r
Fri Apr 22 15:13:48 CST 2005
Fri 22 Apr 2005 03:13:49 PM CST -0.410841 seconds
调整时间为:2005年4月22号15:11分
[root@mrtg root]#date 042215112005
写入bios
[root@mrtg root]#/sbin/hwclock -w
文章评论

共有 2 条评论

  1. 堕落kiss 于 2009-09-29 01:15:20发表:

    为什么那么多英文。。。。。。。

  2. cnmmom 于 2009-09-28 14:42:41发表:

    怎 么好像没写完?