搭建NTP服務器

Centos6.8部署內網NTP服務器

一、環境簡介

 

二、部署拓撲圖

 

三、部署NTP服務

3.1 安裝NTP軟件

[root@linux ~]# yum install ntp -y

[root@linux ~]# rpm -qa ntp

ntp-4.2.6p5-10.el6.centos.2.x86_64

3.2 配置NTP服務

3.2.1 查找ntp配置文件

[root@linux ~]# rpm -qc ntp

/etc/ntp.conf

/etc/ntp/crypto/pw

/etc/sysconfig/ntpd

3.2.2 修改ntp配置文件,將上層NTP同步時間服務器修改爲自己認爲連接較快的

[root@linux ~]# 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服務

[root@linux ~]# /etc/init.d/ntpd start

Starting ntpd: [  OK  ]

[root@linux ~]# 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服務開機自啓動

[root@linux ~]# chkconfig ntpd on

[root@linux ~]# chkconfig --list ntpd

ntpd            0:off   1:off   2:on    3:on    4:on    5:on    6:off

 

四、測試NTP服務

1.在windows server上面測試


 wKiom1lBCgniVBdnAAAxgze6wFA890.png-wh_50

 

2.在checkpoint防火牆上面測試

wKiom1lBCiDiw53hAABh_paER-o848.png-wh_50


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章