1. 程式人生 > >搭建NTP服務器

搭建NTP服務器

服務器 linux centos

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服務器