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


相关推荐

  • 「机械工程」力矩,转矩,扭矩的理解

    「机械工程」力矩,转矩,扭矩的理解1.力矩定义:力矩在物理学里是指作用力使物体绕着转动轴或支点转动的趋向。力矩的单位是牛顿-米。力矩希腊字母是tau。力矩的概念,起源于阿基米德对杠杆的研究。转动力矩又称为转矩或扭矩。力矩能够使物体改变其旋转运动。推挤或拖拉涉及到作用力,而扭转则涉及到力矩。力矩等于径向矢量与作用力的叉积。力矩在物理学里是指作用力使物体绕着转动轴或支点转动的趋向,是力对物体产生转动作用的物理量。可以分…

    2022年5月15日
    76
  • idea怎么搭建springboot_你没有创建该项目的权限

    idea怎么搭建springboot_你没有创建该项目的权限一般来说,用IDEA创建SpringBoot项目有两种方式。其一是Spring官网提供了一个快速生成SpringBoot项目的网站,可以在官网直接下载后,再导入IDEA中。另外一种是直接用IDEA创建一个SpringBoot项目,一般开发也是用的这种方式进行创建。虽说SpringBoot简化了Spring的配置,但学习之前需要对Spring基础知识有一定的掌握。……

    2022年10月13日
    3
  • Java——从键盘输入数组

    Java——从键盘输入数组补充知识JavaScanner类java.util.Scanner是Java5的新特征,我们可以通过Scanner类来获取用户的输入。toString()方法用于返回以一个字符串表示的Number对象值。目录补充知识一、从键盘获取不限制长度的数组输出结果二、从键盘获取限制长度的数组输出结果三、参考一、从键盘获取不限制长度的数组importjava.util.Scanner;publicclassInputArrayNoLimitLength{ publicst

    2022年6月26日
    31
  • web服务:Nginx和Apache的区别

    web服务:Nginx和Apache的区别一、Nginx特点1、轻量级,采用C进行编写,同样的web服务,会占用更少的内存及资源。  2、抗并发,nginx以epollandkqueue作为开发模型,处理请求是异步非阻塞的,负载能力比apache高很多,而apache则是阻塞型的。在高并发下nginx能保持低资源低消耗高性能,而apache在PHP处理慢或者前端压力很大的情况下,很容易出现进程数飙升,从而拒绝服务的现象。  …

    2022年6月1日
    37
  • UFT工具简介

    UFT工具简介UFT UFT是一种自动测试工具。使用UFT的目的是想用它来执行重复的自动化测试,主要是用于回归测试和测试同一软件的新版本。因此你在测试前要考虑好如何对应用程序进行测试,例如要测试哪些功能、操作步骤、输入数据和期望的输出数据等  基本功能UFT提供符合所有主要应用软件环境的功能测试和回归测试的自动化。采用关键字驱动的理念以简化测试用例的创建和维护。它让用户可以直接录制屏幕上的操作流

    2022年5月15日
    164
  • 【v2.x OGE课程 14】 控制使用

    【v2.x OGE课程 14】 控制使用

    2022年1月1日
    52

发表回复

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

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