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

Linux 搭建本地 ntp时间服务器

时间:2015-01-06 07:28:05      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:自己搭建ntp服务器

Linux搭建本地时间服务器

实验前说明:

    实验机器:VMware 10

    实验系统:CentOS6.6

    实验目的:让VMware上的所有CentOS系统时间都一样,方便做集群实验;

#

1,编译安装ntp(在你想做时间服务器的那台机器上)我这台机器ip为:172.16.249.135

    # 安装gcc编译器

        yum install gcc -y 

    # 下载程序包

        wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.6p4.tar.gz

    # 解压程序包

        tar xf ntp-4.2.6p4.tar.gz

    # 进入解压后的目录准备安装

        cd ntp-4.2.6p4

    # 检测编译安装环境

        ./configure --prefix=/usr/local/ntp --enable-all-clocks --enable-parse-clocks

    # 安装

        make && make install

2,配置ntp服务器

     # 修改nfp配置文件

         vim /etc/ntp.conf

     将第八行注释,

     # restrict default kod nomodify notrap nopeer noquery

        restrict default nomodify

技术分享

3,启动ntp服务;

    # /usr/local/ntp/bin/ntpd -c /etc/ntp.conf -p /tmp/ntpd.pid 

然后 ...


然后你就等着吧,差不多要等15分钟左右,


一段时间后在其他虚拟机上使用命令

    # ntpdate 172.16.249.135 就能同步时间;

        1,这里的ip是作为时间服务器的ip

        2,建议20分钟以上在做同步,不然会提示"no server suitable for synchronization found"这个错误;

#####################

某种情况,你可能等十五分钟后更新,还是会提示上面的错误;

这时,你把下面的这两行加到/etc/ntp.conf 文件中,随便找个地儿加进去,在等5分钟;OK;

server 127.127.1.0

fudge 127.127.1.0 stratum 8


Linux 搭建本地 ntp时间服务器

标签:自己搭建ntp服务器

原文地址:http://xiaoaiunix.blog.51cto.com/8602035/1599434

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