码迷,mamicode.com
首页 > 系统相关 > 详细

Linux时间同步服务

时间:2016-09-06 23:41:09      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:linux   服务器   local   


1.同步网络时间到系统时间ntpdate命令

[root@localhost test1]# date

Tue Sep  6 07:12:03 CST 2016

[root@localhost test1]#  ntpdate  cn.pool.ntp.org 

 6 Sep 09:18:23 ntpdate[13047]: step time server 120.25.108.11 offset 7566.199829 sec

[root@localhost test1]# date

Tue Sep  6 09:18:25 CST 2016

 cn.pool.ntp.org  (中国国家授时中心的官方时间同步服务器IP域名)

同步网络时间到系统时间后,就可以用hwclock -w将系统时间同步到硬件时间。


2.自己搭建时间同步服务器

时间同步服务器设置:

        systemctl stop firewalld

        vim  /etc/chrony.conf

             allow 172.25.254.0/24

             local stratum 10 

        systemctl restart chrony


3.如何自动同步系统时间(同步服务器时间) 

chronyc  sources  -v查看与谁同步着。


1.确定时间源地址(同步谁的时间)

172.25.254.254

2.确定客户主机使用的时间同步服务

chronyd.service

3.在chronyd.service服务中加载时间源地址

vim /etc/chrony.conf

server172.25.254.254 iburst

#systemctl restart chronyd.service


本文出自 “技术人生,简单不简单” 博客,请务必保留此出处http://willis.blog.51cto.com/11907152/1846771

Linux时间同步服务

标签:linux   服务器   local   

原文地址:http://willis.blog.51cto.com/11907152/1846771

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!