Ntp配置
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Ntp配置手册
目录
一.Ntp介绍 (3)
二.Ntp安装 (3)
2.1安装准备 (3)
2.2软件安装 (3)
三.Ntp配置 (3)
3.1Ntp配置 (3)
3.2 NTP初始同步源配置 (5)
3.3 CMOS时钟同步配置 (5)
3.4客户端同步配置 (5)
四.Ntp管理 (6)
4.1Ntp管理 (6)
4.2Ntp同步测试 (6)
4.3设置NTP系统自启动 (6)
4.4查看日志 (6)
五.Ntp问题总结 (7)
一.Ntp介绍
Ntp的更多介绍请参见网络,主要是负责所有机器的时间一直,现在内部环境尤其是数据库和同步对时间要求非常高,否则容易导致失败或者错误,故内部配置时间服务器。
二.Ntp安装
2.1安装准备
安装环境:Linux varsphinx01 2.6.32-19.el6.x86_64 #1 SMP Tue Mar 9 17:48:46 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
IP地址:192.168.10.7
备用IP地址:192.168.10.16
软件准备:
由于系统是64位,所以软件也是。
ntp.x86_64
ntpdate.x86_64
2.2软件安装
软件安装,为了保证软件安装包的依赖性,建议采用yum安装:
1.默认安装已有Ntp默认配置,只是没有启动,
2.如果系统没有安装,请按如下步骤安装,本次安装与配置以此为准
yum update
服务端安装如下:
yum install ntp.x86_64
客户端安装如下:
yum install ntpdate.x86_64
三.Ntp配置
3.1Ntp配置
修改配置文件如下:
cat /etc/ntp.conf
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
#新增允许同步网段
restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap
restrict 192.168.20.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the project.
# Please consider joining the pool (/join.html). server
server
server
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
#server 127.127.1.0 # local clock
#fudge 127.127.1.0 stratum 10
# Enable public key cryptography.
#crypto
includefile /etc/ntp/crypto/pw
# Key file containing the keys and key identifiers used when operating # with symmetric key cryptography.
keys /etc/ntp/keys
# Specify the key identifiers which are trusted.
#trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
#requestkey 8
# Specify the key identifier to use with the ntpq utility.
#controlkey 8
# Enable writing of statistics records.