[root@localhost ~]# ntpdate time.nist.gov

虚拟机时间不对   自动同步   sudo ntpdate asia.pool.ntp.org

要是同步后时间还是不对可能是时区没设置好

zzx@zzx120:~$           sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime   //调整时区               再 sudo ntpdate -u time.twc.weather.com

ubuntu server ntp时间同步服务器安装及使用           date

1 * * * * ntpdate asia.pool.ntp.org

crontab中写同步    * * * * * /sbin/ntpdate time.nist.gov  # /sbin/一定要加

手动修改系统时间 date -s 07/11/98

~~~~~~~~~~~~~~~~~~~

网络同步 ntpdate 210.72.145.44

手动同步   date -s "20091112 18:30:50" &&hwclock --systohc

~~~~~~~~~~~~~~~~~~~~

一、服务端

1 apt-get install ntp

2 安装后默认启动服务,如果没有启动,启动之。

/etc/init.d/ntp start

3 vi /etc/ntp.conf 修改为如下

restrict default nomodify notrap noquery

restrict 127.0.0.1

restrict 10.91.0.0 mask 255.255.255.0 nomodify

server 0.pool.ntp.org

server 1.pool.ntp.org

server 2.pool.ntp.org

server  127.127.1.0     # local clock

fudge   127.127.1.0 stratum 10

driftfile /var/lib/ntp/drift

broadcastdelay  0.008

keys            /etc/ntp/keys

4 重启ntp服务

/etc/init.d/ntp restart

二、客户端

1 使用ntpdate命令,如果不存在这个命令,则先安装apt-get install ntp

/usr/sbin/ntpdate 10.91.0.10 //即使用ip为10.91.0.10的ntp服务器同步时间

2 设置定时同步。

vi /etc/crontab

30 01 * * * /usr/sbin/ntpdate 10.91.0.10

系统便会在每天早上1点30分自动将系统时间同步到ntp服务器的时间。

当然这里crontab的时间是指客户端的时间,同步后等同于ntp服务器的时间。

ntp时间同步服务器的更多相关文章

  1. centos7搭建ntp时间同步服务器chrony服务

    centos7搭建ntp时间同步服务器chrony服务 前言: 在centos6的时候我们基本使用的是ntp服务用来做时间同步,但是在centos7后推荐是chrony作为时间同步器的服务端使用, ...

  2. 张高兴的 .NET IoT 入门指南:(八)基于 GPS 的 NTP 时间同步服务器

    时间究竟是什么?这既可以是一个哲学问题,也可以是一个物理问题.古人对太阳进行观测,利用太阳的投影发明了日晷,定义了最初的时间.随着科技的发展,天文观测的精度也越来越准确,人们发现地球的自转并不是完全一 ...

  3. ntp时间同步服务器的搭建

    CentOS系统一般自带安装有ntp服务,仅需做相关配置即可. 一.配置ntp服务器: 在选定的ntp服务器上vim /etc/ntp.conf 添加一行:restrict default nomod ...

  4. NTP时间同步服务器设置

    一.Window Server设置 [服务器端设置]1) 修改注册表以下键值:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\ ...

  5. Linux下搭建ntp时间同步服务器

    1.ntpd软件安装(略过) 2.修改ntp.conf配置文件 vi /etc/ntp.conf 第一种配置:允许任何IP的客户机都可以进行时间同步将“restrict default kod nom ...

  6. CentOS装个NTP时间同步服务器

    服务端: driftfile /var/lib/ntp/drift restrict default nomodify notrap nopeer noquery restrict 127.0.0.1 ...

  7. 【转】Linux配置NTP时间同步服务器

    分布式程序通常需要运行在一个统一的时间环境里. 转自:http://blog.csdn.net/mengfanzhundsc/article/details/62046562 安装NTP:yum in ...

  8. 【Linux】部署NTP时间同步服务器

    1. 查看机器的Linux版本 查看集群内所有服务器的linux版本,确保相同,不要跨大版本. [root@bigdata111 ~]# cat /etc/redhat-release CentOS ...

  9. .bat脚本将windows server 2008设置成ntp时间同步服务器

    @echo off echo autor OAK @echo off echo -------------------------------- @echo off REG ADD HKEY_LOCA ...

随机推荐

  1. 阿里云配置mysql

    环境:阿里云ECS服务器,系统为centos7.2 用户:root 参考博客:https://blog.csdn.net/kunzai6/article/details/81938613 师兄的哈哈哈 ...

  2. 7.3 Varnish VCL 常用函数

  3. qrcode在手机上不显示的问题

    可以试试以下解决方案: 1.修改qrcode.min.js:里的function n()红线区域替换成这个 , 原因是这样子才能支持安卓机显示.

  4. 物联网学习笔记——构建RESTFul平台1

    0.前言     前些时间顺着Yeelink学习了RESTFUL,使用PHP和Slim框架尝试实现简单的REST API,树莓派可通过GET方法获得JSON数据包,通过这种方式实现了树莓派和服务器(我 ...

  5. query.locate过个过滤参数

    需要引用Variants locate( 'typeid;name',vararrayof([key1,key2]),[]);

  6. python-python基础5(模块)

    一.模块介绍 定义:本质上就是.py结尾的python文件.模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用 ...

  7. Ubuntu 16.04 系统编译部署lamp服务。

    壹  下载Apache 和 PHP源码包: Apache:http://httpd.apache.org/download.cgi PHP:http://php.net/downloads.php 贰 ...

  8. 查看 Secret【转】

    可以通过 kubectl get secret 查看存在的 secret. 显示有两个数据条目,kubectl describe secret 查看条目的 Key: 如果还想查看 Value,可以用  ...

  9. Network Policy【转】

    Network Policy 是 Kubernetes 的一种资源.Network Policy 通过 Label 选择 Pod,并指定其他 Pod 或外界如何与这些 Pod 通信. 默认情况下,所有 ...

  10. ROS学习笔记3-基础课程之文件系统向导

    准备工作需要使用如下命令安装ros的教程: $ sudo apt-get install ros-<distro>-ros-tutorials 其中,distro为所用ros的发行版本,该 ...