跳转至

设置校内时间服务器

NTP客户端设置

01. 安装NTP服务

yum install ntp

02. 修改NTP服务的配置文件

vi /etc/ntp.conf

原来配置中默认的时间服务器有:
server 0.centos.pool.ntp.org iburst

修改为我校的时间服务器:
server ntp.nwafu.edu.cn
server ntp1.nwafu.edu.cn
server ntp2.nwafu.edu.cn
server ntp3.nwafu.edu.cn

保存退出;

03. 重启 ntp服务

重启NTP服务:
systemctl restart ntpd

查看NTP运行状态:
ntpstat

查看ntp连接情况:
ntpd -p

04. 设置ntp服务开机启动

systemctl enable ntpd.service

建立任务,每天定时自动同步时间服务器

crontab -e 00 01 * * * root /usr/sbin/ntpdate -q ntp.nwafu.edu.cn ntp1.nwafu.edu.cn