NTP网络时间服务器

一.安装方法:

1.RPM包安装:

mount  /dev/cdrom/media/

rpm -ivh  /media/centos/ntp/-4.XXXX.rpm

2. 源码编译安装:

wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.6p4.tar.gz

tar -zxvf ntp-4.2xx.tar.gz    -C /usr/local

cd ntp-4.2.xx

./configure --prefix=/usr/local/ntp   --enable-all-clocks --enable-prase-clocks

make

make install

3.yum安装:

yum  install  ntp

二:配置

[[email protected] ~]# cat /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
192.168.1.0 mask 255.255.255.0 nomodify

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 cn.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

# 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 loopstats peerstats

[[email protected] ~]#

[[email protected] ~]# chkconfig ntpd on
[[email protected] ~]# 
[[email protected] ~]# vi /etc/sysconfig/ntpd
[[email protected] ~]# service ntpd restart
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:                                             [  OK  ]
[[email protected] ~]# 
[[email protected] ~]# netstat -ntulp |grep 
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help‘ for more information.
[[email protected] ~]# netstat -ntulp |grep 123
udp        0      0 192.168.1.200:123         0.0.0.0:*                               25982/ntpd          
udp        0      0 127.0.0.1:123               0.0.0.0:*                               25982/ntpd          
udp        0      0 0.0.0.0:123                 0.0.0.0:*                               25982/ntpd          
udp        0      0 ::1:123                     :::*                                    25982/ntpd          
udp        0      0 :::123                      :::*                                    25982/ntpd          
[[email protected] ~]# date
Tue Aug  4 15:30:34 CST 2015

需要同步时间的服务器:

方法1、

[[email protected] nrpe2.13]# ntpdate 192.168.1.200

4 Aug 15:39:48 ntpdate[26443]: step time server 192.168.1.200 offset 333893.127016 sec
[[email protected] nrpe-2.13]# date
Tue Aug  4 15:39:54 CST 2015
[[email protected] nrpe-2.13]#

并且设备同步时间服务器地址:

[[email protected] nrpe-2.13]# crontab -e
*/1 * * * * /usr/sbin/ntpdate 192.168.1.200

[[email protected] nrpe-2.13]# crontab -l
*/1 * * * * /usr/sbin/ntpdate 192.168.1.200

[[email protected] nrpe-2.13]# cat /etc/crontab 
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
[[email protected] ~]#

方法2、

[[email protected] nrpe-2.13]# vi /etc/ntp.conf 
[[email protected] nrpe-2.13]# cat /etc/ntp.conf

# 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 iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server  192.168.1.200

[[email protected] ~]# chkconfig ntpd on
[[email protected] ~]# 
[[email protected] ~]# vi /etc/sysconfig/ntpd

[[email protected] ~]# cat /etc/sysconfig/ntpd
# Command line options for ntpd
OPTIONS="-g"
SYNC_HWCLOCK=yes
[[email protected] ~]# 
[[email protected] ~]# service ntpd restart

时间: 2024-07-31 08:00:42

NTP网络时间服务器的相关文章

SYN2101型 NTP网络时间服务器

SYN2101型  NTP网络时间服务器   对时功能,提供的是准确时间.这个不是显示给你看给你定闹钟用的.卫星的对时是给远洋上孤零零的船舶用的,是给高速飞行的导弹用的. 卫星授时服务出现后,就有了一个大福音,卫星本身就是依靠时差来定位,所以卫星 上装有高精度原子钟,向地面不停的发出时序信号,从而接收机可以获得高精度的标准时间.在最近20年来,不光是为军民两用提供准确的定位能力,授时能力也是非常重要的一点.比如说电网调度中,各个点如果时间出现误差,将会造成调节不准,直接 烧机 :大型工程如各个测

SYN2136型 北斗NTP网络时间服务器

SYN2136型  北斗NTP网络时间服务器 产品概述 SYN2136型北斗NTP网络时间服务器是由西安同步电子科技有限公司精心设计.自行研发生产的一款基于NTP/SNTP协议的时间服务器,接收北斗卫星信号,从北斗地球同步卫星上获取标准时钟信号信息,将这些信息通过TCP/IP网络传输,为网络设备(用户)提供精确.标准.安全.可靠和多功能的时间服务,同时产生1PPS(秒信号)同步脉冲信号及串口时间信息,前面板显示年月日时分秒等信息,是一款实现时间同步的实用时钟设备. 产品功能 1)   以北斗二代

WIN系统必需品:NTP网络时间服务器

安徽京准电子科技——为您的系统保驾护航! 一.NTP网络时间服务器产品介绍: NTP网络时间服务器是针对计算机.自动化装置等进行校时而研发的高科技设备,该产品可从GPS卫星(北斗卫星.B码接口.PTP)上获取标准的时间信号,将这些信号通过各种接口(NTP/SNTP.串口.B码.PTP.脉冲)传输给自动化系统中需要时间信息的设备(计算机.保护装置.故障录波器.事件顺序记录装置.安全自动装置.远动RTU),这样系统中就有了一个标准的时间源,从而达到整个系统的时间一致. HR系列NTP网络时间服务器内

常用NTP网络时间服务器整理

以下所有的域名都是通过host -t A domain 114.114.114.114解析出来的结果. ntp1.aliyun.com has address 182.92.12.11 北京市大兴区 阿里云ntp2.aliyun.com has address 120.25.115.19 广东省深圳市 阿里云ntp3.aliyun.com is an alias for ntp.aliyun.com.ntp4.aliyun.com is an alias for ntp.aliyun.com.n

GPS网络时间服务器价格和功能区别

GPS卫星定位系统它可以应用在军事.国防.通信.授时等多个领域.GPS卫星定位系统应用在授时方面,是将卫星信号传送给设备并进行授时.GPS网络时间服务器是接收GPS卫星信号的时间服务器,它可以将卫星时间信号转换为网络.串口.秒脉冲等时间信息,能为用户提供相应的时间信息.GPS网络时间服务器主要输出网络时间信号,能在多种环境中进行授时,并且授时准确使用方便,改变了传统的钟表授时方式.时间服务器的功能和种类都所有不同,根据输出信号分为串口时间服务器,NTP网络时间服务器,CDMA时间服务器,根据卫星

gps网络时间服务器的功能原理

gps网络时间服务器是以gps卫星信号为时间基准,并输出NTP网络时间信息,NTP是网络时间协议是用来同步计算机的一种协议,它可以在网络内采用广播发式传输标准时间数据包,网内需要时间同步的设备对操作系统进行相应设置,使自身的时间自动同步于NTP时间服务器,从而实现全网时间同步. gps网络时间服务器以GPS卫星作为时间基准,输出UTC国际标准时间进行授时.gps网络时间服务器一般由外部信号接收单元.信号处理单元.输出时间单元和授时设备所组成.gps网络时间服务器接收时间信号进行解码处理,并将UT

配置NTP网络时间自动校对系统时间和创建备份文件

1 案例1:配置用户和组账号 1.1 问题 本例要求创建下列用户.组以及组的成员关系: 新建用户 alex,其用户ID为3456,密码是flectrag 创建一个名为 adminuser 的组 创建一个名为 natasha 的用户,其属于 adminuser 组,这个组是该用户的从属组 创建一个名为 harry 的用户,其属于 adminuser 组,这个组是该用户的从属组 创建一个名为 sarah 的用户,其在系统中没有可交互的 Shell,并且不是 adminuser 组的成员 natash

python从网络时间服务器获取并打印当前时间以及pip安装ntplib的一次体验

首先需要安装ntplib,科一通过pip安装. ubuntu下科一通过如下指令安装pip: $ sudo apt-get install python-pip 使用如下指令安装ntplib: $ sudo pip install ntplib 发现pip真的是一个好东西,之前下载一个外界的python库的话挺麻烦的,现在用pip就行,感觉比Java的Maven还要方便. 下面的代码依赖ntplib通过"网络时间协议"(Network Time Protocol,简称NTP)向一台NTP

北斗时间服务器在靶场的应用

关键词:北斗时间服务器,时间服务器 在地域辽阔的导弹和航天试验中,为了实现对.航天器的测量和控制,需要有多台设备和系统,这样的工作必定需要统一的时间.因此在军事领域.航天领域.通信领域.交通领域.电力领域.金融领域等方面时统设备和北斗时间服务器得到了普遍的应用.本文对靶场的系统组成及时统设备或北斗时间服务器的常用授时方式和接口进行简单的介绍.靶场是一个多学科.多层次和高新技术密集的场所.从系统工程的角度来说.它由许多工程学科纵横交织构成了一个完整的大系统,这个大系统工程可以分成六个系统:测试发射