[原]NTP时钟同步服务设置
2024-09-05 09:14:59
192.168.0.2 | ntp服务端 |
192.168.0.3 | ntp客户端 |
192.168.0.4 | ntp客户端 |
192.168.0.5 | ntp客户端 |
注:以下操作均以root操作
一、NTP服务端
1.设置系统时间并写入硬件时钟,确保重启后时间不会改变。
设置系统时间
date -s "2017-07-21 10:20:00" 时间写入硬件
hwclock -w
2.设置NTP服务端作为时钟同步源
vi /etc/ntp.conf
#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 10
3.设置授权客户端
vi /etc/ntp.conf
restrict 192.168.0.3 mask 255.255.255.0 nomodify notrap
restrict 192.168.0.4 mask 255.255.255.0 nomodify notrap
restrict 192.168.0.4 mask 255.255.255.0 nomodify notrap
4.启动NTP服务并设置开机自动启动
/etc/init.d/ntpd restart
chkconfig --level 0123456 ntpd on
二、NTP客户端
1.配置NTP服务端
vi /etc/ntp.conf
server 192.168.0.2
2.手动同步时钟
先停止NTP服务
/etc/init.d/ntpd stop
手动同步时钟
ntpdate 192.168.0.2
3.启动NTP服务并设置开启自动启动
/etc/init.d/ntpd restart
chkconfig --level 0123456 ntpd on
4.查看NTP同步状态
watch ntpq -p
最新文章
- 01.线性表 ArrayList
- windows 服务
- 描述Linux下文件删除的原理(计时3分钟)
- Json 基于jQuery+JSON的省市联动效果
- Orchard扩展 自定义后台管理导航菜单 Admin Menu
- python split()函数使用拆分字符串 将字符串转化为列表
- FZU 2129 子序列个数 (递推dp)
- jQuery ajax - ajax() 方法
- 在ASP.NET中发送电子邮件的实例教程
- Memcached内存管理模型分析
- 关于破解Quartus
- WPF基础篇之系统中141种颜色
- Redis单机配置多实例,实现主从同步
- 普通javabean 获得项目的绝对路径
- Python(四)——PyCharm的安装和使用
- 【数据库】SQL语句
- TextView字体,行距,html格式,超链接,对大长度的设定
- html如何让label在div中的垂直方向居中显示?
- VC++使用IMAPI调用Outlook邮箱客户端和Foxmail邮箱客户端遇到的问题
- Netty源码分析第7章(编码器和写数据)---->;第1节: writeAndFlush的事件传播