---
title: "以本地时钟配置NTP"
author: "woodmuch"
date: "2010-05-05T13:57:00Z"
tags: []
categories: ["非技术"]
slug: "ntp"
draft: false
lastmod: "2011-04-15T21:35:38Z"
id: 1004625
url: "https://2009wangdawei.iteye.com/blog/1004625"
---

[http://www.qbov.com/a/fuwuqi/Linuxfuwuqi/20100406/391.html](http://www.qbov.com/a/fuwuqi/Linuxfuwuqi/20100406/391.html)

 

下述设置以时钟源服务器IP地址为192.168.0.1为例。可以命令ntpstat 和 ntpq -p 查看本机NTPD服务状态。配置完成后，均需要重新启动NTPD服务 service ntpd restart

【服务器端设置】

1.将/etc/下的文件ntp.conf修改如下：

server 127.127.1.0 minpoll 4 maxpoll 5

fudge 127.127.1.0 stratum 2

restrict 127.0.0.1

driftfile /var/lib/ntp/drift

2.将/etc/ntp下的文件ntpservers内容置空

3.将/etc/ntp下的文件step-tickers修改如下：

127.127.1.0

【客户端设置】

1.将/etc/下的文件ntp.conf修改如下：

server 192.168.0.1 minpoll 4 maxpoll 5

fudge 127.127.1.0 stratum 3

restrict 127.0.0.1

driftfile /var/lib/ntp/drift

logfile /etc/ntp.log

restrict 192.168.0.1 mask 255.255.255.255

2.将/etc/ntp下的文件ntpservers内容置空

3.将/etc/ntp下的文件step-tickers修改如下：

192.168.0.1

[http://hi.baidu.com/way2rhce/blog/item/d5cbb80346b5fbe708fa9306.html](http://hi.baidu.com/way2rhce/blog/item/d5cbb80346b5fbe708fa9306.html)

 

安装包那些过程在此不表

配置文件：/etc/ntp.conf

server 127.127.1.0  
fudge 127.127.1.0 stratum 5  
restrict 9.75.131.0 mask 255.255.255.0 nomodify notrap

测试：

\# watch ntpq -p  
出现：

Every 2.0s: ntpq -p Tue Jan 12 10:54:54 2010

remote refid st t when poll reach delay offset jitter  
\==============================================================================  
\*LOCAL(0) .LOCL. 5 l 16 64 377 0.000 0.000 0.001

表示正确。