由于有些服务和实验须要多台机器的时间同步,因此就有了搭建NTP的前提条件了,具体步骤以下:服务器
1,安装ntp服务网络
yum install ntp.i* -yide
2,修改/etc/ntp.confrest
restrict default kod nomodify notrap nopeer noquery #
restrict -6 default kod nomodify notrap nopeer noquery #针对ipv6设置 日志
#这是ntp的默认设置server
# 容许本地全部操做
restrict 127.0.0.1
restrict -6 ::1
# 容许的局域网络段
restrict 10.0.0.0 mask 255.0.0.0 nomodify motrap
restrict 192.168.0.0 mask 255.255.0.0 nomodify motrap
# 使用上层的internet ntp服务器
restrict 207.46.232.182 mask 255.255.255.255 nomodify notrap noquery
server 207.46.232.182
# 若是没法与上层ntp server通讯以本地时间为标准时间
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
# 计算本ntp server 与上层ntpserver的频率偏差
driftfile /var/lib/ntp/drift
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
#日志文件
logfile /var/log/ntp.log事件
#说明:ip
restrict <IP 地址> <子网掩码> |<网段> <子网掩码> [ignore|noquery|notrap|nomodiy|notrust|nokod]同步
ignore :关闭全部ntp服务it
noquery:不提供ntp服务
notrap:不提供trap远程事件登陆的功能
nomodiy:表示客户端不能更改ntp服务器的时间参数,但能够经过ntp服务器进行时间矫正
notrust:拒绝没有经过认证的客户端
nokod:kod技术能够组织一种dos***
2,在修改/etc/ntp/step-tickers文件
207.46.232.182
127.127.1.0
#当ntp服务器启动时自动与这个文件中的记录ip进行时间校对
3,修改/etc/sysconfig/ntpd
SYNC_HWCLOCK=YES #容许BIOS与系统时间同步
4,客户端设置略。