linux ntp配置文件_linux安装ntp服务

linux ntp配置文件_linux安装ntp服务在Linux系统中,为了避免主机时间因为在长时间运行下所导致的时间偏差,进行时间同步(synchronize)的工作是非常必要的。Linux系统下,一般使用ntp服务来同步不同机器的时间。NTP是网络时间协议(NetworkTimeProtocol)的简称,干嘛用的呢?就是通过网络协议使计算机之间的时间同步化。安装NTP包检查是否安装了ntp相关包。如果没有安装ntp相关包,使用rpm或y…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

在Linux系统中,为了避免主机时间因为在长时间运行下所导致的时间偏差,进行时间同步(synchronize)的工作是非常必要的。Linux系统下,一般使用ntp服务来同步不同机器的时间。NTP 是网络时间协议(Network Time Protocol)的简称,干嘛用的呢?就是通过网络协议使计算机之间的时间同步化。

安装NTP包

检查是否安装了ntp相关包。如果没有安装ntp相关包,使用rpm或yum安装,安装也非常简单方便。

复制代码

代码如下:

[root@localhost ~]# rpm -qa | grep

ntpntpdate-4.2.6p5-1.el6.x86_64

fontpackages-filesystem-1.41-1.1.el6.noarch

ntp-4.2.6p5-1.el6.x86_64

NTP的配置

A: 配置/etc/ntp.conf

NTP Server的主要配置文件为/etc/ntp.conf ,没有修改过的ntp.conf文件内容如下所示,配置选项都有相关注释信息(Linux 版本为Red Hat Enterprise Linux Server release 6.6 )

复制代码

代码如下:

[root@localhost ~]# more /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

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

# Please consider joining the pool ().

server 0.rhel.pool.ntp.org iburst

server 1.rhel.pool.ntp.org iburst

server 2.rhel.pool.ntp.org iburst

server 3.rhel.pool.ntp.org iburst

#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

[root@localhost ~]# more /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

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

# Please consider joining the pool ().

server 0.rhel.pool.ntp.org iburst

server 1.rhel.pool.ntp.org iburst

server 2.rhel.pool.ntp.org iburst

server 3.rhel.pool.ntp.org iburst

#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

各个选项信息:

#系统时间与BIOS事件的偏差记录

driftfile /etc/ntp/drift

restrict 控制相关权限。

语法为: restrict IP地址 mask 子网掩码 参数

其中IP地址也可以是default ,default 就是指所有的IP

参数有以下几个:

ignore :关闭所有的 NTP 联机服务

nomodify:客户端不能更改服务端的时间参数,但是客户端可以通过服务端进行网络校时。

notrust :客户端除非通过认证,否则该客户端来源将被视为不信任子网

noquery :不提供客户端的时间查询:用户端不能使用ntpq,ntpc等命令来查询ntp服务器

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/183004.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 谷歌地图 离线地图_地图谷歌高清手机版

    谷歌地图 离线地图_地图谷歌高清手机版离线地图解决方案,除了买地图数据,使用专业的ArcGIS来做外,也可以使用GMap.Net来做。关于GMap的开发教程,可以看我以前的文章:基于GMap.Net的地图解决方案使用了GMap一年了,也有了一些积累,开发了一个可以下载ArcGIS、百度、谷歌、高德、腾讯SOSO、天地图、Here等地图的地图下载器。百度和google地图加载显示如下:百度普通地图:百度混合地图:…

    2022年9月20日
    4
  • zabbix监控多实例的mysql_zabbix监控MySQL多实例实践[通俗易懂]

    zabbix监控多实例的mysql_zabbix监控MySQL多实例实践[通俗易懂]zabbix监控MySQL多实例实践发布时间:2020-07-2120:50:01来源:51CTO阅读:494作者:zxdave一、实践背景:一台机器上部署了多个MySQL实例,每个实例使用不同的端口,需要通过zabbix将其都纳入监控中。二、实践方法及原理说明:1.在Zabbix上创建监控MySQL数据库使用的模版,导入案例模版:链接:https://pan.baidu.com/s/1nXo…

    2022年5月4日
    54
  • python和delphi哪个好_python编程时如何修改撤回

    python和delphi哪个好_python编程时如何修改撤回原博文2020-03-2818:10−复制行,在代码行光标后,输入Ctrl+d,即为复制一行,输入多次即为复制多行撤销上一步操作:Ctrl+z为多行代码加注释#代码选中的条件下,同时按住Ctrl+/,被选中行被注释,再次按下Ctrl+/,注…0319相关推荐2019-12-2423:37−djangoTermipython:manage.pymakemigrati…

    2022年8月27日
    8
  • mysql批量新增数据_word修改内容目录怎么更新

    mysql批量新增数据_word修改内容目录怎么更新建表CREATETABLE`t`(`id`int(11)NOTNULL,`age`int(11)DEFAULTNULL,`name`varchar(20)DEFAULTNULL,PRIMARYKEY(`id`))ENGINE=InnoDBDEFAULTCHARSET=utf81.insertintovalues、inser…

    2022年10月6日
    3
  • 【Time】 不确定度的A类、B类评定及合成

    【Time】 不确定度的A类、B类评定及合成不确定度的A类、B类评定及合成由于测量结果的不确定度往往由多种原因引起的,对每个不确定度来源评定的标准偏差,称为标准不确定度分量,用符号ui表示。(1)不确定度的A类评定用对观测列进行统计分析的方法来评定标准不确定度,称为不确定度A类评定;所得到的相应标准不确定度称为A类不确定度分量,用符号uA表示。它是用实验标准偏差来表征。计算公式:一次测量结果An的uA=S;…

    2022年4月19日
    263
  • goland 2021.10激活码和账号(注册激活)

    (goland 2021.10激活码和账号)JetBrains旗下有多款编译器工具(如:IntelliJ、WebStorm、PyCharm等)在各编程领域几乎都占据了垄断地位。建立在开源IntelliJ平台之上,过去15年以来,JetBrains一直在不断发展和完善这个平台。这个平台可以针对您的开发工作流进行微调并且能够提供…

    2022年3月27日
    68

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号