服务器列表
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

最新文章

  1. 01.线性表 ArrayList
  2. windows 服务
  3. 描述Linux下文件删除的原理(计时3分钟)
  4. Json 基于jQuery+JSON的省市联动效果
  5. Orchard扩展 自定义后台管理导航菜单 Admin Menu
  6. python split()函数使用拆分字符串 将字符串转化为列表
  7. FZU 2129 子序列个数 (递推dp)
  8. jQuery ajax - ajax() 方法
  9. 在ASP.NET中发送电子邮件的实例教程
  10. Memcached内存管理模型分析
  11. 关于破解Quartus
  12. WPF基础篇之系统中141种颜色
  13. Redis单机配置多实例,实现主从同步
  14. 普通javabean 获得项目的绝对路径
  15. Python(四)——PyCharm的安装和使用
  16. 【数据库】SQL语句
  17. TextView字体,行距,html格式,超链接,对大长度的设定
  18. html如何让label在div中的垂直方向居中显示?
  19. VC++使用IMAPI调用Outlook邮箱客户端和Foxmail邮箱客户端遇到的问题
  20. Netty源码分析第7章(编码器和写数据)---->第1节: writeAndFlush的事件传播

热门文章

  1. IntelliJ IDEA 2017.3尚硅谷-----查看项目配置
  2. 闲来无事.gif
  3. Chrome下ifame父窗口调用子窗口的问题
  4. sqli-libs(38-41(堆叠注入)关)
  5. 深度学习之tensorflow框架(上)
  6. Go_channel
  7. JavaScript对象,函数,作用域
  8. Analog power pin UPF defination
  9. 算法刷题--回溯算法与N皇后
  10. Hadoop架构: 流水线(PipeLine)