一、安装ntpd
查看状态
sudo systemctl status ntpd 启动 sudo systemctl start ntpd 开机自启 sudo systemctl is-enabled ntpd
sudo systemctl enable ntpd
配置
$ sudo vim /etc/ntp.conf 第一处:修改成自己的网段 #Hosts on local network are less restricted. restrict 192.168.74.0 mask 255.255.255.0 nomodify notrap 第二处:由于是内网环境,就不需要这些服务配置,注释 # Please consider joining the pool (http://www.pool.ntp.org/join.html). # server 0.centos.pool.ntp.org # server 1.centos.pool.ntp.org # server 2.centos.pool.ntp.org 第三处:ntp server提供的本地服务 server 127.127.1.0 #local clock fudge 127.127.1.0 stratum 10 从机同步时间 sudo ntpdate hadoop101