本地NTP服务器与客户端配置
来源:互联网 发布:亚加装饰 知乎 编辑:程序博客网 时间:2024/06/05 05:15
1. NTP 简介
NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的时间的协议。
在集群中,为了保证各节点之间的时间一致,我们通常需要配置本地的 NTP 服务器。
2. 环境准备
oshostnameipcentos6.7localntpserver172.16.1.100centos6.7ntpclient172.16.1.101
3. ntpserver配置
3.1 查看是否安装有ntpd
chkconfig --list
3.2 安装ntpd
yum install ntpd ntpdate
3.3 备份 ntpd 配置
mv /etc/ntp.conf /etc/ntp.conf.bak
3.4 修改ntpd 配置
vi/etc/ntp.conf
输入以下内容
#fast ntp serverserver 202.108.6.95server 202.112.29.82server 110.75.190.198server cn.ntp.org.cn#store last timedriftfile /etc/ntp/drift#allow upper modify localhostrestrict 0.0.0.0 nomodify notrap noquery#allow any hostrestrict 0.0.0.0 mask 0.0.0.0 nomodify notrap#level numberfudge 127.127.1.1 stratum 2#ntp log pathstatsdir /var/log/ntp/#ntp log filelogfile /var/log/ntp/ntp.log
3.5 初始同步时间
ntpdate 202.108.6.95
3.6 定时将日期写入硬件,确保重启时时间异常
安装定时工具
yum install crontab
添加定时规则:vi /etc/crontab
在末尾追加以下内容#ntp00 */1 * * * root hwclock -w
3.7 启动 ntpserver
service ntpd start
3.8 设置 ntpd 服务开机启动
chkconfig ntpd on
4. 配置 ntpd client
客户端配置除了 /etc/ntp.conf 配置文件内容不同外,其他配置都与ntpd server 相同,因此只做简单介绍,相应步骤参考 ntpd server。
4.1 安装 ntpd
yum install ntpd ntpdate
4.2 修改ntpd 配置vi/etc/ntp.conf
输入以下内容(localntpserver为ntp server 的hostname)
#fast ntp serverserver localntpserver#store last timedriftfile /etc/ntp/drift#allow upper modify localhostrestrict 0.0.0.0 nomodify notrap noquery#allow any hostrestrict 0.0.0.0 mask 0.0.0.0 nomodify notrap#level numberfudge 127.127.1.1 stratum 2#ntp log pathstatsdir /var/log/ntp/#ntp log filelogfile /var/log/ntp/ntp.logincludefile /etc/ntp/crypto/pw keys /etc/ntp/keys
4.3 初始同步时间
ntpdate localntpserver
4.4 定时将日期写入硬件,确保重启时时间异常
vi/etc/crontab
在末尾追加以下内容#ntp00 */1 * * * root hwclock -w
4.5 启动 ntpd
service ntpd start
4.6 设置 ntpd 开机启动
chkconfig ntpd on
4.7 查看ntpd 状态
ntpstat
至此,NTP server 与 client 配置完成
0 0
- 本地NTP服务器与客户端配置
- ntp配置本地服务器 ntp.conf
- 配置NTP架设本地时间服务器
- Linux下配置NTP时间服务器客户端
- Linux下NTP服务器及客户端配置
- Linux下NTP服务器及客户端配置
- RHEL5配置ntp服务器端与客户端
- 本地NTP 时间服务器
- ntp本地服务器搭建
- Linux下配置NTP 架设本地时间服务器
- Linux下配置NTP 架设本地时间服务器
- NTP客户端配置
- linux ntp 时间服务器及客户端安装配置
- linux ntp 时间服务器及客户端安装配置
- ntp服务器和客户端配置(centos安装系列5)
- linux下ntp时间服务器配置及客户端注意事项
- linux ntp 时间服务器及客户端安装配置
- ntp服务器搭建及客户端配置-使用阿里云
- 眨眼检测
- [编程题] 小易的升级之路
- |Tyvj|NOIP1999|动态规划|贪心|P1878 拦截导弹
- listview如何实现分页加载
- iOS 9 Universal Links
- 本地NTP服务器与客户端配置
- leetcode:数组之Rotate Image
- 【NOIP2012普及组】摆花 (递推)
- 2-The Transport Layer: TCP, UDP, and SCTP
- 汇编学习笔记(二)-- 配置编辑器
- getWindow().setBackgroundDrawable(null);对UI优化的测试
- 面试:递归和非递归方式实现先序、中序、后序遍历代码
- TCP/IP五层协议图
- HTML 5 placeholder 改变字体颜色