软件开发Linuxntp服务器

NTP服务器怎么在linux上搭建?

NTP服务器是在网上下载就可以部署了吗?
怎么在linux上部署?

参与16

3同行回答

匿名用户匿名用户
Linux服务器配置---ntp配置ntpntp 就是网络时间同步的服务,时间的准确性非常重要,很多数据在记录时都要知道准确的时间。网上有很多站点,一般国内会设置匹配中科院国家授时中心的时间。1 、安装ntp软件 [root@localhost ~]# rpm -qa | grep ntp // 检测是否已安装,...显示全部

Linux服务器配置---ntp

配置ntp

ntp 就是网络时间同步的服务,时间的准确性非常重要,很多数据在记录时都要知道准确的时间。网上有很多站点,一般国内会设置匹配中科院国家授时中心的时间。

1 、安装ntp软件

[root@localhost ~]# rpm -qa | grep ntp // 检测是否已安装,这个软件默认是安装的

ntpdate-4.2.6p5-1.el6.centos.i686

fontpackages-filesystem-1.41-1.1.el6.noarch

ntp-4.2.6p5-1.el6.centos.i686

[root@localhost ~]#

2 、配置ntp站点,修改配置文件“/etc/ntp.conf”

[root@localhost wj]# gedit /etc/xinetd.d/telnet

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 ntp1.aliyun.com // 阿里云时间服务器

server ntp2.aliyun.com

server ntp3.aliyun.com

server ntp4.aliyun.com

3 、修改防火墙。Ntp默认使用udp端口123,需要在防火墙中设置

[root@localhost wj]# gedit /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m udp -p udp --dport 123 -j ACCEPT

[root@localhost wj]# service iptables restart

iptables :将链设置为政策 ACCEPT : filter nat [ 确定 ]

iptables :清除防火墙规则: [ 确定 ]

iptables :正在卸载模块: [ 确定 ]

iptables :应用防火墙规则: [ 确定 ]

iptables :载入额外模块: nf_conntrack_ftp [ 确定 ]

4 、启动ntp服务

[root@localhost wj]# service ntpd restart

关闭 ntpd : [ 确定 ]

正在启动 ntpd : [ 确定 ]

5 、检测ntp运行状态

[root@localhost wj]# ntpq -p

remote refid st t when poll reach delay offset jitter

=============================================================================

120.25.115.20 10.137.53.7 2 u 4 64 1 26.132 188282. 0.000

203.107.6.88 100.107.25.114 2 u 3 64 1 83.645 188285. 0.000

6 、同步时间,使用命令ntpdate

[root@localhost wj]# ntpdate aliyun.com

16 Aug 10:07:03 ntpdate[20193]: the NTP socket is in use, exiting // 如果遇到此错误,请按照下面的方式执行

[root@localhost wj]# lsof -i:123

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

ntpd 20187 ntp 16u IPv4 262711 0t0 UDP *:ntp

ntpd 20187 ntp 17u IPv6 262712 0t0 UDP *:ntp

ntpd 20187 ntp 18u IPv4 262718 0t0 UDP localhost:ntp

ntpd 20187 ntp 19u IPv4 262719 0t0 UDP 192.168.0.119:ntp

ntpd 20187 ntp 20u IPv6 262720 0t0 UDP localhost:ntp

ntpd 20187 ntp 21u IPv6 262721 0t0 UDP [fe80::a00:27ff:fe14:3357]:ntp

[root@localhost wj]# kill -9 20187 // 杀掉上面的进程

[root@localhost wj]# ntpdate 202.112.29.82

16 Aug 10:13:21 ntpdate[20212]: adjust time server 202.112.29.82 offset 0.006454 sec

收起
银行 · 2019-05-15
浏览2144
AcdanteAcdante技术总监SHFY
1、如果是内网搭建NTP时间同步服务器,那么这台的服务器的时间要保证正确,最好是能有单独的授时。2、Linux上,配置ntp.conf配置文件,启动NTP服务即可。3、配置完成后,客户端有两种同步方式: 1、ntpdate+crontab定时同步 2、ntp.conf指定NTP服务端,自动同步,可通过ntpq -p 查...显示全部

1、如果是内网搭建NTP时间同步服务器,那么这台的服务器的时间要保证正确,最好是能有单独的授时。
2、Linux上,配置ntp.conf配置文件,启动NTP服务即可。
3、配置完成后,客户端有两种同步方式:

  1、ntpdate+crontab定时同步
   2、ntp.conf指定NTP服务端,自动同步,可通过ntpq  -p 查看同步状态和延迟
收起
互联网服务 · 2019-05-21
zwz99999zwz99999系统工程师dcits
首先需要和ntp server通信正常,然后配置ntp.conf文件,启动ntp进程,时钟会自动同步的显示全部

首先需要和ntp server通信正常,然后配置ntp.conf文件,启动ntp进程,时钟会自动同步的

收起
系统集成 · 2020-04-26
浏览1373

提问者

lyx15731059252
研发工程师天融信

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2019-05-15
  • 关注会员:4 人
  • 问题浏览:3294
  • 最近回答:2020-04-26
  • X社区推广