CentOS7系列--2.1CentOS7中安装配置NTP服务

CentOS7安装配置NTP服务

NTP服务是时间同步服务

1. 安装NTPd

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

[jack@centos7 ~]$ vi /etc/ntp.conf

添加如下的代码

restrict 192.168.0.0 mask 255.255.0.0 nomodify notrap

更改时间同步服务器

#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.jst.mfeed.ad.jp iburst

server ntp2.jst.mfeed.ad.jp iburst

server ntp3.jst.mfeed.ad.jp iburst

[root@centos7 ~]# systemctl start ntpd

[root@centos7 ~]# systemctl enable ntpd

2. 设置防火墙,允许NTP服务使用123/UDP

[root@centos7 ~]# firewall-cmd --add-service=ntp –permanent

[root@centos7 ~]# firewall-cmd –reload

3. 验证

[root@centos7 ~]# ntpq -p

remote refid st t when poll reach delay offset jitter

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

*leontp.ccgs.wa. .GPS. 1 u 2 64 15 443.939 -3.250 4.178

+120.25.115.19 10.137.38.86 2 u 62 64 17 49.708 9.697 6.603

+ntp-sz.chl.la 202.118.1.46 2 u 59 64 17 41.490 13.642 5.630

-202.118.176.2 202.118.177.155 4 u 34 64 37 54.802 27.184 4.129

原文地址:https://www.cnblogs.com/gispathfinder/p/8833138.html