1. 首先安装ntp服务(ubuntu 16.02)
在linux的root用户下执行以下命

  sudo apt-get install  ntp

(如果不是ubuntu系统则执行 yum install ntp –y)

2. 修改ntp配置文件(server)
我们需要在linux集群中找到一台作为ntp服务器的server,其他机器则为ntp的client,因此,在server服务器上修改一下配置文件
执行

退出保存,重启ntp服务

执行 service ntp restart

 vim /etc/ntp.conf

#linux自带的时间同步,需要注释掉
#pool 0.ubuntu.pool.ntp.org iburst
#pool 1.ubuntu.pool.ntp.org iburst
#pool 2.ubuntu.pool.ntp.org iburst
#pool 3.ubuntu.pool.ntp.org iburst
# Use Ubuntu's ntp server as a fallback.
#pool ntp.ubuntu.com
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
#因为是内网,所以用本地时间做为服务器时间,注意这里不是127.0.0.1
server 127.127.1.0
fudge 127.127.1.0 stratum 8 #开放192.168.8.0 整个网段,即在这个网段的所有机器都可以使用 214 作为时间同步服务端
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap

3. 修改ntp配置文件(client)

同样的server端已经配置好了,client的配置相对简单

执行 sudo  vim /etc/ntp.conf

#linux自带的时间同步,需要注释掉
#pool 0.ubuntu.pool.ntp.org iburst
#pool 1.ubuntu.pool.ntp.org iburst
#pool 2.ubuntu.pool.ntp.org iburst
#pool 3.ubuntu.pool.ntp.org iburst
# Use Ubuntu's ntp server as a fallback.
#pool ntp.ubuntu.com
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1 #增加214作为时间服务器即可
server 192.168.0.214
# Needed for adding pool entries restrict source notrap nomodify noquery

退出保存,重启ntp服务

执行 sudo  service ntp restart

4. 查看ntp服务是否配置完成
在ntp sever上执行 ntpq -p

在ntp client上执行 ntpq –p

即完成ntp服务的配置

5. ntp服务的相关命令
service ntpstart 启动

service ntp stop停止

service ntprestart 重新启动

ubuntu更改时区(东八区)
tzselect

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

ubuntu下ntp时间同步的更多相关文章

  1. ubuntu下配置时间同步NTP

    1参考文献: 1.鸟哥的Linux私房菜:第十五章.时间服务器: NTP 服务器(强烈建议看完) 2.http://www.crsay.com/wiki/wiki.php/server/centos/ ...

  2. 关于linux下ntp时间同步服务的安装与配置

    1.安装ntp服务,要使用时间同步.那么服务端与客户端都需要使用如下命令安装NTP软件包 [root@ ~]# yum install ntp -y 2.如果只是作为客户端的话,配置则可以非常简单,编 ...

  3. Linux下ntp时间同步

    在root用户下执行 先安装同步时间软件,每台机器执行 yum install -y ntp 然后执行以下命令: crontab -e */10 * * * * /usr/sbin/ntpdate - ...

  4. Linux下 ntp 时间同步服务ntpd 出现 the NTP socket is in use, exiting 解决

    [root@EPDDB log]# [root@EPDDB log]# ntpdate 10.154.8.200 6 Sep 09:35:09 ntpdate[30210]: the NTP sock ...

  5. ntp时间同步服务器

    [root@localhost ~]# ntpdate time.nist.gov 虚拟机时间不对   自动同步   sudo ntpdate asia.pool.ntp.org 要是同步后时间还是不 ...

  6. Linux集群环境下NTP服务器时间同步

    NTP介绍 NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议.它的用途是把计算机的时钟同步到世界协调时UTC(Universal Time ...

  7. linux ntp时间同步

    linux ntp时间同步 一.搭建时间同步服务器1.编译安装ntp serverrpm -qa | grep ntp若没有找到,则说明没有安装ntp包,从光盘上找到ntp包,使用rpm -Uvh n ...

  8. Linux下ntpdate时间同步

    Linux下ntpdate时间同步 Ntp服务器配置(暂略,以后整理) 时间同步方法 同步命令               # ntpdate ntp服务器域名或IP           例:# nt ...

  9. cloudstack安装篇3-SELinux配置、NTP时间同步、配置ClouStack软件库

    一.SELinux配置 为了让CloudStack正常工作,我们必须将SELinux设置为permissive.需要在当前系统运行状态下和启动后都能够生效,进行以下配置. 在系统运行状态下的将SELi ...

  10. Windows2012R2 NTP时间同步

    Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时间,需要使用另外的方式去做时间同步 下面分两个情况 两个情况,两个情况都需要用修改组策略的方式来做 情况 ...

随机推荐

  1. 【翻译】API 链接与键:为什么应该使用链接而不是键来表示 API 中的关系

    翻译自原文: https://cloud.google.com/blog/products/application-development/api-design-why-you-should-use- ...

  2. java2022.7.9

    知识点

  3. jquery(四:jquery的事件、Ajax)

    Jquery事件 jQuery注册事件 1.利用原生的js来为对象注册事件,后面的会把前面的覆盖 2.用jQuery的$()来为对象注册事件,后面不会把前面的覆盖 简单事件绑定-----click() ...

  4. CCRD_TOC_2008年第1期

    中信国健临床通讯 2008年第1期 目 录   类风湿关节炎 1 一种新型.实用的RA活动度评估方法:完成评估只需三分钟 Fleischmann RM, Schiff MH, Keystone EC, ...

  5. swiper弹出窗口居中效果css

    position: absolute; width: 800px; left: 50%; top: 50%; transform: translate(-50%, -50%);

  6. Sublime Text 3怎么配置本地服务器?

    1. 同样的我们需要借助一款插件来实现. 2.打开Sublime,使用快捷键[Ctrl + Shift + P]或者点击"Preferences"=> "Packa ...

  7. java HashMap的四种获取key,value的方式

    初学java不久,我觉得这样将学到的东西总结下来非常好,如果有一天有些地方忘记了 可以回过头来翻看,不用来回的找,非常好,也是一个很好的习惯 今天主要将记录获取hashMap的key,value的几种 ...

  8. LeetCode-838 推多米诺

    来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/push-dominoes 题目描述 n 张多米诺骨牌排成一行,将每张多米诺骨牌垂直竖立.在开始时 ...

  9. 微信小程序if for

    1.控制代码的显示隐藏 1.wx:if="{{}}"判断是否需要渲染代码 <view wx:if="{{tiaojian===1}}">显示1< ...

  10. cascader卡顿

    <el-cascader :options="categoryTree" :props="props" collapse-tags v-model=&qu ...