linux 下的时间同步服务器NTP

简介:
安装平台:CentOS 5.3 64位
NTP服务器设置
通过yum 安装,也可以直接用安装光盘里的rpm 文件安装
# yum install ntp
配置ntp 配置文件:/etc/ntp.conf
restrict 192.168.1.0子mask 255.255.255.0 nomodify
只需要设置上面这一句即可,上面这一句的意思是允许内网中某一个网段的客户端通过这台ntp服务器同步时间
启动ntp 服务
# /etc/init.d/ntpd start
# /sbin/chkconfig --level 35 ntpd on
查看同步的状态
#ntpstat
synchronised to NTP server (221.7.129.79) at stratum 3 
   time correct to within 115 ms
   polling server every 64 s
出现以上内容时,说明同步成功。
客户端设置
客户端两种方式:一种是用ntpdate 同步,一种是用 ntp 服务同步
1、ntpdate 同步
# yum install ntp
通过crontabe 设置同步频率
*/20 * * * * /root/ntpsync.sh
# cat /root/ntpsync.sh
#!/bin/bash
/usr/sbin/ntpdate 192.168.1.1
/sbin/hwclock -w
192.168.1.1 是内部NTP服务器IP
2、ntp服务同步
# yum install ntp
编辑/etc/ntp.conf
将以下三行注释掉
#server 0.centos.pool.ntp.org
#server 1.centos.pool.ntp.org
#server 2.centos.pool.ntp.org
添加如下这一行
server 192.168.1.1
192.168.1.1 是内部NTP服务器IP
# /etc/init.d/ntpd start
# /sbin/chkconfig --level 35 ntpd on
查看同步状态

本文转自holy2009 51CTO博客,原文链接:http://blog.51cto.com/holy2010/314817

相关文章
|
10天前
|
Java Linux
Springboot 解决linux服务器下获取不到项目Resources下资源
Springboot 解决linux服务器下获取不到项目Resources下资源
|
13天前
|
Linux
linux下搭建tftp服务器教程
在Linux中搭建TFTP服务器,需安装`tftp-server`(如`tftpd-hpa`)。步骤包括:更新软件包列表,安装`tftpd-hpa`,启动并设置开机自启,配置服务器(编辑`/etc/default/tftpd-hpa`),添加选项,然后重启服务。完成后,可用`tftp`命令进行文件传输。例如,从IP`192.168.1.100`下载`file.txt`: ``` tftp 192.168.1.100 <<EOF binary put file.txt quit EOF ```
28 4
|
25天前
|
定位技术
GPS北斗卫星同步时钟(时间同步服务器)建设施工部署方案
GPS北斗卫星同步时钟(时间同步服务器)建设施工部署方案
GPS北斗卫星同步时钟(时间同步服务器)建设施工部署方案
|
28天前
|
Linux Shell 网络安全
【Shell 命令集合 网络通讯 】Linux 与SMB服务器进行交互 smbclient命令 使用指南
【Shell 命令集合 网络通讯 】Linux 与SMB服务器进行交互 smbclient命令 使用指南
40 1
|
6天前
|
Linux 数据安全/隐私保护
Linux基础与服务器架构综合小实践
【4月更文挑战第9天】Linux基础与服务器架构综合小实践
1192 6
|
10天前
|
Linux 网络安全 开发工具
linux 时间同步 chrony
linux 时间同步 chrony
23 1
|
18天前
|
Ubuntu Linux 虚拟化
【Linux】ubuntu安装samba服务器
【Linux】ubuntu安装samba服务器
|
18天前
|
Linux
Linux安装bind9搭建自己的域名服务器
Linux安装bind9搭建自己的域名服务器
11 0
|
21天前
|
网络协议 Linux 网络安全
Linux服务器DNS服务器配置实现bind的正向解释和反向解释
Linux服务器DNS服务器配置实现bind的正向解释和反向解释
17 0
|
28天前
|
网络协议 安全 Shell
【Shell 命令集合 系统设置 】Linux 从远程时间服务器获取当前日期和时间 rdate命令 使用指南
【Shell 命令集合 系统设置 】Linux 从远程时间服务器获取当前日期和时间 rdate命令 使用指南
33 0