内网搭建ntp时间同步服务器

 在公司内网,搭建服务器集群时,为了到达一致性,需要对服务器时间进行同步。内网一般不能访问互联网,此时急需一台内部的时间服务器,用于内网机器的时间同步。

环境:

操作系统:Centos6.6

ntpd服务器:192.168.113.159

客户端服务器:192.168.113.183

  1. 安装ntpd(ntpd服务器)

[root@localhost ~]# yum install ntpd -y

  1. 修改配置文件

[root@localhost ~]# vim /etc/ntp.conf

For more information about this file, see the man pages

ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

Permit time synchronization with our time source, but do not

permit the source to query or modify the service on this system.

restrict default kod nomodify notrap nopeer noquery

restrict -6 default kod nomodify notrap nopeer noquery

Permit all access over the loopback interface. This could

be tightened as well, but to do so would effect some of

the administrative functions.

restrict 127.0.0.1

restrict -6 ::1

Hosts on local network are less restricted.

#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

#允许设置的可信任地址段对NTPD各服务的访问,但不允许此地址段内客户端修改NTPD服务器时间(nomodify)

restrict 192.168.113.0 mask 255.255.255.0 nomodify notrap

Use public servers from the pool.ntp.org project.

Please consider joining the pool (http://www.pool.ntp.org/join.html).

#注释掉网络服务器

#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

#设置本地时间服务器

service 192.168.113.159

外部时间服务器不可用时,以本地时间作为时间服务

server 127.127.1.0

fudge 127.127.1.0 stratum 5

#broadcast 192.168.1.255 autokey # broadcast server

#broadcastclient # broadcast client

#broadcast 224.0.1.1 autokey # multicast server

#multicastclient 224.0.1.1 # multicast client

#manycastserver 239.255.254.254 # manycast server

#manycastclient 239.255.254.254 autokey # manycast client

Enable public key cryptography.

#crypto

includefile /etc/ntp/crypto/pw

Key file containing the keys and key identifiers used when operating

with symmetric key cryptography.

keys /etc/ntp/keys

Specify the key identifiers which are trusted.

#trustedkey 4 8 42

Specify the key identifier to use with the ntpdc utility.

#requestkey 8

Specify the key identifier to use with the ntpq utility.

#controlkey 8

Enable writing of statistics records.

#statistics clockstats cryptostats loopstats peerstats

  1. 启动服务,设置开机自启动

[root@localhost ~]# chkconfig --level 345 ntpd on

[root@localhost ~]# service ntpd restart

关闭 ntpd: [确定]

正在启动 ntpd: [确定]

  1. 客户端测试

template:/root>/usr/sbin/ntpdate 192.168.113.159

28 Feb 02:44:50 ntpdate[5235]: step time server 192.168.113.159 offset -52476.869449 sec

  1. 客户端配置定时任务

[root@ansible named]#vim /usr/bin/ntpsync.sh

#!/bin/bash

/usr/sbin/ntpdate 192.168.113.159

#同步系统时间到硬件时间

/sbin/hwclock –w

[root@ansible named]#crontab -e

#sync time with ntpserver at 12:00

0 12 * * * /usr/bin/ntpsync.sh

内网搭建ntp时间同步服务器相关推荐

  1. Linux 服务器内网搭建NTP时间服务器(Network Time Protocol)

    文章目录 Linux 服务器内网搭建NTP时间服务器(Network Time Protocol) 一.在主服务器端安装NTP时间服务器 二.在客户端安装NTP时间服务器 三.Xhell 同时控制多个 ...

  2. 搭建NTP时间同步服务器

    搭建NTP时间同步服务器 NTP时间同步服务器以美国全球卫星定位系统(GPS)为时间基准,内嵌国际流行的NTP-SERVER服务,以NTP/SNTP协议同步网络中的所有计算机.服务器.DVR等设备,实 ...

  3. linux进行校时ntp,Linux下快速搭建ntp时间同步服务器

    Linux下快速搭建ntp时间同步服务器 背景: 服务器多了,时间是否一致以及是否准备就显得格外重要,虽然这个问题总是被忽略,但是统一时间是很有必要的,因为时间问题导致服务出现问题也是司空见惯,本文简 ...

  4. 如何搭建NTP时间同步服务器-大萝卜博客网

    安装NTPD服务端 rpm -qa ntp | grep ntpd 检测是否已经安装,如未安装执行yum安装服务 yum install ntp 关闭防火墙 service iptables stop ...

  5. 搭建ntp时间同步服务器,解决cm时间问题

    公司在Cloudare Manager搭建CDH5.12.2集群环境,一直存在服务器时间不同步的问题,自己动手搭建了一个,希望对大家有些启发,亲自测有效!-----大家有什么疑惑也可以随时留言给我,或 ...

  6. Linux下快速搭建ntp时间同步服务器

    一.搭建时间同步服务器 1.编译安装ntp server wget [url]http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2.4p4.tar ...

  7. linux下搭建ntp服务,Linux 下快速搭建ntp 时间同步服务器

    一.搭建时间同步服务器 1.编译安装ntp server tar zxvf ntp-4.2.4p5.tar.gz cd ntp-4.2.4p5 ./configure --prefix=/usr/lo ...

  8. Linux下NTP时间同步服务器搭建

    NTP介绍 NTP 服务器是用于局域网服务器时间同步使用的,可以保证局域网所有的服 务器与时间服务器的时间保持一致,某些应用对时间实时性要求高的必须统一时 间. 互联网的时间服务器也有很多,例如 nt ...

  9. CentOS系统中如何搭建NTP时间服务器(时间同步)

    CentOS系统中如何搭建NTP时间服务器(时间同步) CentOS系统中如何搭建NTP时间服务器(时间同步) 本文由:安徽京准公司提供,转载需通过授权@ 网络时间协议(NTP)用来同步网络上不同主机 ...

最新文章

  1. protocol buff
  2. 52是什么水平_送礼送什么白酒,适合送礼的白酒推荐,看这篇最新白酒送礼指南就行了...
  3. 多线程——实现Callable接口
  4. Pair Poject 1 【新双人贪吃蛇】本组:龚逸 合作者:庞俊
  5. snoopy(强大的PHP采集类) 实例应用
  6. mdp框架_强化学习:MDP(Markov Decision Process)
  7. Jenkins自动化部署容器
  8. C++ I/O 流 格式控制(上)
  9. 95-235-065-源码-task-SourceStreamTask
  10. MSSQL差异备份拿shell(转)
  11. Android系统启动-SystemServer下篇
  12. 计算机工程主编陶小雪,城市环境所在MOFs基催化剂的制备和VOCs催化氧化方面取得进展...
  13. 「数字电子技术基础」6.触发器
  14. 修复Webots在ubuntu下安装出现的一些依赖问题
  15. Class和class? 类对象和类的对象? 一篇文章让你摸到头脑
  16. 上帝的归上帝 凯撒的归凯撒
  17. 论文阅读:Semantic Parsing on Freebase from Question-Answer Pairs
  18. tensorflow2系类知识-4 :RNN
  19. git提交代码失败 ‘“node“‘ �����ڲ����ⲿ���Ҳ���ǿ����еij������������ļ��� 解决方法
  20. 小兔子在终端给大家拜年啦

热门文章

  1. 借助台式机和笔记本完成vsphere5.1的实验
  2. html中好看的文本效果,用CSS的text-shadow制作超炫文字效果全攻略
  3. 三菱R系列ST、RD77MS定位以及三菱触摸屏配方功能,此案例还提供两个触摸屏实现异地操作,使操作更加方便快捷
  4. 十进制数转换为十六进制数_十进制数制到十六进制数制的转换
  5. Rokid ALL in ONE 全栈开发套件开箱——强人工智能入门指南[1]
  6. Android Suspend
  7. 浪子回头之邱关源第五版P76_3_10回路电流法multisim方正及matlab解法
  8. 微型计算机中常用的鼠标器有哪两类,试卷
  9. HDU 4749 Parade Show(暴力水果)
  10. win7安装vs2008 microsoft visual studio web创作组件安装失败