本文主要介绍当局域网内服务器不能连接外网,但是又必须保持各服务器时间同步
1.选用局域网内的其中一台机器做为ntp时间同步源服务器,其他节点机器从源时间同步服务器同步时间
例如我选用的机器为:172.16.19.156(机器名称:centos-1)
2.时间源同步服务器192.168.1.181安装NTP服务
yum -y install ntp
安装完成后配置/etc/ntp.conf文件,配置信息如下
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
# 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
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.rhel.pool.ntp.org
#server 1.rhel.pool.ntp.org
#server 2.rhel.pool.ntp.org
#broadcast 192.168.1.255 autokey # broadcast server
#broadcastclient &nbs