CentOS 6.3下NTP服务安装和配置

测试环境:

NTPserver 192.168.1.252

NTPclient 192.168.1.251

准备工作:

关闭selinux:

vi /etc/selinux/config

SELINUX=disabled

关闭iptables:

service iptables stop

chkconfig iptables off

一.安装NTP软件包:

yum -y install ntp /*yum安装NTP服务*/

chkconfig --add ntpd /*添加NTP*/

chkconfig ntpd on /*开机自启动NTP*/

二.修改NTP配置文件:

vi /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
restrict default ignore 设置默认策略为拒绝所有访问方式的请求
# 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 (http://www.pool.ntp.org/join.html).
server 0.CentOS.pool.ntp.org
server 1.centos.pool.ntp.org 设置同步服务器
server 2.centos.pool.ntp.org

#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

restrict 0.centos.pool.ntp.org nomodify notrap noquery
restrict 1.centos.pool.ntp.org nomodify notrap noquery 允许与上层服务器同步时间
restrict 2.centos.pool.ntp.org nomodify notrap noquery

# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10 外界同步源无法联系时,使用本地时间为同步服务

# 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 loops

***************************************************************

时间: 2024-07-30 10:18:44

CentOS 6.3下NTP服务安装和配置的相关文章

CentOS 6.6下JDK1.7安装与配置(Linux)经典入门详解案例

最近用的linux较多,在网站找了一些关于linux环境下jdk安装的教程,过程是有的但是好多细节都没有表现出来,所以我花了点时间总结了一下,希望对大家都有帮助... CentOS下JDK1.7安装与配置(Linux) 一.安装SUN公司的JDK之前先要检查系统中是否已经安装JDK.一般来说Centos系统默认会安装OpenJDK,但OpenJDK部分内容与SUN JDK不兼容,因此打算重新安装SUN JDK1.7来开发. 1.我们可以通过rpm命令查看OpenJDK具体版本信息 #rpm -q

4、时间同步的ntp服务安装与配置。

1.yum -y install ntp ntpdate (安装时间同步ntp服务) 2.vi /etc/ntp.conf (修改ntpd服务的配置文件) 3.修改配置文件,指定和谁同步时间(140),上面的0-3前面都加#键 #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

CentOS 7下Samba服务安装与配置详解

centos7.5系统下进行 yum -y install samba samba-client systemctl start smb nmbps -ef | grep -E 'smb|nmb'netstat -tunlp | grep -E 'smbd|nmbd'mkdir /mnt/datauseradd -s /sbin/nologin mtcat /etc/passwd | grep mtsmbpasswd -a mt[输入两遍密码123456]chown mt.mt /mnt/dat

Linux——CentOS 6.3下PostgreSQL 的安装与配置

一.简介 PostgreSQL 是一种非常复杂的对象-关系型数据库管理系统(ORDBMS),也是目前功能最强大,特性最丰富和最复杂的自由软件数据库系统.有些特性甚至连商业数据库 都不具备.这个起源于伯克利(BSD)的数据库研究计划目前已经衍生成一项国际开发项目,并且有非常广泛的用户. 二.系统环境 系统平台:CentOS release 6.3 (Final) PostgreSQL 版本:PostgreSQL 9.2.4 防火墙已关闭/iptables: Firewall is not runn

CentOS 6.3下PostgreSQL 的安装与配置

一.简介 PostgreSQL 是一种非常复杂的对象-关系型数据库管理系统(ORDBMS),也是目前功能最强大,特性最丰富和最复杂的自由软件数据库系统.有些特性甚至连商业数据库都不具备.这个起源于伯克利(BSD)的数据库研究计划目前已经衍生成一项国际开发项目,并且有非常广泛的用户. 二.系统环境 系统平台:CentOS release 6.3 (Final) PostgreSQL 版本:PostgreSQL 9.2.4 防火墙已关闭/iptables: Firewall is not runni

CentOS 6.5下mysql的安装与配置

一.通过yum自动安装mysql yum install mysql-server my-client 二.初始化及相关配置 安装完mysql数据库以后,会发现会多出一个mysqld的服务,通过输入 service mysqld start 命令就可以启动mysql服务. 第一次启动会进行初始化配置,如下: [[email protected] ~]# service mysqld start 初始化 MySQL 数据库: WARNING: The host 'xiaoluo' could no

CentOS 6.9下OpenLDAP 的安装与配置

LDAP 基础教程 LDAP 全称轻量级目录访问协议(英文:Lightweight Directory Access Protocol),是一个运行在 TCP/IP 上的目录访问协议.LDAP实现提供被称为目录服务的信息服务,可以看做是一张特殊的数据库系统.可以有效的解决众多网络服务的用户账户问题,规定了统一的身份信息数据库.身份认证机制和接口,实现了资源和信息的统一管理,保证了数据的一致性和完整性. 使用场景 有两个系统A,B:需要把A系统创建的用户同步到B中,而B是个apache 开源项目,

【原创】Centos下telnet的安装和配置(完全版,Centos5.5亲测)

Centos下telnet的安装和配置(完全版,Centos5.5亲测) 一.查看本机是否有安装telnet(centOS5默认有安装telnet) # rpm -qa |grep telnet 如果显示结果为: telnet-0.17-39.el5 telnet-server-0.17-39.el5 那恭喜你,机器上已经安装了telnet.如果没有安装,请看下一步. 特别说明: telnet分为telnet-client (简称为telnet)和telnet-server.telnet-cli

CentOS 6.7 samba服务安装和配置

CentOS 6.7 samba服务安装和配置 Samba是在Linux和UNIX系统上实现SMB协议的一个免费软件,由服务器及客户端程序构成.SMB(Server Messages Block,信息服务块)是一种在局域网上共享文件和打印机的一种通信协议,它为局域网内的不同计算机之间提供文件及打印机等资源的共享服务. SMB是基于客户机/服务器型的协议,因而一台Samba服务器既可以充当文件共享服务器,也可以充当一个Samba的客户端,例如,一台在Linux 下已经架设好的Samba服务器,wi