首页 > 系统服务 > 详细

linux工作记录2-NTP时间同步

时间:2015-03-26 21:05:49      阅读:282      评论:0      收藏:0      [点我收藏+]

在我们实施项目时,很多时候linux主机之间都需要做时间同步,这时候就用到了NTP技术

以典型的服务器端和客户端为例做讲解

 

一、NTP Server端

1、安装需要的软件包

# yum install -y ntp ntpdate ntp-doc

 

2、开机启动服务

# chkconfig ntpd on

 

3、编辑配置文件

# vi /etc/ntp.conf

添加
server     127.127.1.0 #local clock

 

把下边的内容做注释

server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

 

二、NTP客户端

1、安装需要的软件包

# yum install -y ntp ntpdate ntp-doc

 

2、开机启动服务

# chkconfig ntpd on

 

3、编辑配置文件

# vi /etc/ntp.conf

把下边内容做注释

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

 

restrict 127.0.0.1
restrict -6 ::1

 

server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

 

添加
server   10.231.29.10

 

4、执行时间同步命令
ntpdate -u <服务器端IP>

 

本文出自 “xiaoxiaozhou” 博客,请务必保留此出处http://xiaoxiaozhou.blog.51cto.com/4681537/1625145

linux工作记录2-NTP时间同步

原文:http://xiaoxiaozhou.blog.51cto.com/4681537/1625145

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!