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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • VLAN基础知识_vlan的基本原理

    VLAN基础知识_vlan的基本原理VLAN简介定义:VLAN(VirtualLocalAreaNetwork)即虚拟局域网,是将一个物理的LAN在逻辑上划分成多个广播域的通信技术。VLAN内的主机间可以直接通信,而VLAN间不能直接通信,从而将广播报文限制在一个VLAN内。目的:以太网是一种基于CSMA/CD(CarrierSenseMultipleAccess/CollisionDetect…

    2022年8月10日
    5
  • 谷粒商城官网_尚硅谷谷粒商城电商项目

    谷粒商城官网_尚硅谷谷粒商城电商项目后端编写、前端展示、服务注册、配置网关、503问题、跨域、解决跨域、服务注册配置网关、删除数据、后端接口、逻辑删除

    2022年7月28日
    4
  • 卷积神经网络CNN(2)—— BN(Batch Normalization) 原理与使用过程详解[通俗易懂]

    卷积神经网络CNN(2)—— BN(Batch Normalization) 原理与使用过程详解[通俗易懂]BatchNormalization是由google提出的一种训练优化方法。网上对BN解释详细的不多,大多从原理上解释,没有说出实际使用的过程,这里从what,why,how三个角度去解释BN。

    2022年7月18日
    11
  • forkjoin用法_fork join_none

    forkjoin用法_fork join_noneFork/Join是一个分而治之的任务框架,如一个任务需要多线程执行,分割成很多块计算的时候,可以采用这种方法。动态规范:和分而治之不同的是,每个小任务之间互相联系。工作密取:分而治之分割了每个任务之后,某个线程提前完成了任务,就会去其他线程偷取任务来完成,加快执行效率。同时,第一个分配的线程是从队列中的头部拿任务,当完成任务的线程去其他队列拿任务的时候是从尾部拿任务,所以这样就避免了竞争。在Java的Fork/Join框架中,使用两个类完成上述操作:  1.ForkJoinTask:我们要使用F

    2022年10月22日
    0
  • 基金基础知识

    基金基础知识基金基础知识文章目录基金的基础知识基金分类基金交易基金的费用指数基金种类估值方法专有名词解释问题解答规则本篇文章仅限于本人学习基金的笔记。基金的基础知识基金是最适合普通人的投资工具,这里要讲的“基金”属于广义基金下的证券投资基金。证券投资基金通俗的讲就是大家把钱凑在一起统一交给基金公司管理,基金公司会任命基金经理专门打理这笔钱,用于投资股票、债券等。基金收益性:大多数人并不具备金融投资的知识和能力。但基金经理则不同,他们受过专业的教育,具备投资的知识和能力。怎样的收益

    2022年5月27日
    37
  • phpstorm IDEA 双击Shift键会弹出 SearchEverywhere 对话框,如何取消这个功能

    phpstorm IDEA 双击Shift键会弹出 SearchEverywhere 对话框,如何取消这个功能

    idea 2021年10月24日
    69

发表回复

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

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