搭建NTP服务器
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了搭建NTP服务器相关的知识,希望对你有一定的参考价值。
Centos6.8部署内网NTP服务器
一、环境简介
二、部署拓扑图
三、部署NTP服务
3.1 安装NTP软件
[[email protected] ~]# yum install ntp -y
[[email protected] ~]# rpm -qa ntp
ntp-4.2.6p5-10.el6.centos.2.x86_64
3.2 配置NTP服务
3.2.1 查找ntp配置文件
[[email protected] ~]# rpm -qc ntp
/etc/ntp.conf
/etc/ntp/crypto/pw
/etc/sysconfig/ntpd
3.2.2 修改ntp配置文件,将上层NTP同步时间服务器修改为自己认为连接较快的
[[email protected] ~]# vi /etc/ntp.conf
…………………………省略……………………………
# 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 time1.aliyun.com prefer
server time.windows.com
server time.nist.gov
server time-b.nist.gov
…………………………省略……………………………
3.2.3 更改参数,让某个网段可以和ntp server进行时间同步
…………………………省略……………………………
# 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
restrict 172.16.0.0 mask 255.255.240.0 nomodify notrap
……………………………省略……………………………
3.3 启动NTP服务
[[email protected] ~]# /etc/init.d/ntpd start
Starting ntpd: [ OK ]
[[email protected] ~]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1352/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1431/master
tcp 0 0 :::22 :::* LISTEN 1352/sshd
tcp 0 0 ::1:25 :::* LISTEN 1431/master
udp 0 0 172.16.9.131:123 0.0.0.0:* 1640/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 1640/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 1640/ntpd
udp 0 0 fe80::250:56ff:feb1:91fa:123 :::* 1640/ntpd
udp 0 0 ::1:123 :::* 1640/ntpd
udp 0 0 :::123 :::* 1640/ntpd
3.4 优化NTP服务
让ntp服务开机自启动
[[email protected] ~]# chkconfig ntpd on
[[email protected] ~]# chkconfig --list ntpd
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
四、测试NTP服务
1.在windows server上面测试
2.在checkpoint防火墙上面测试
本文出自 “专注是最快的成功方式” 博客,请务必保留此出处http://amsilence.blog.51cto.com/9478833/1936795
以上是关于搭建NTP服务器的主要内容,如果未能解决你的问题,请参考以下文章