单机配置(连接网络的时间地址)
准备一台可连通外网的单机
yum install -y ntp #安装所需要的ntp工具vim /etc/ntp.conf #进入配置文件#重要的配置:restrict default nomodify notrap nopeer noquery #表示默认拒绝所有IP的时间同步server ntp1.aliyun.com iburst #设置匹配的时间同步地址systemctl restart ntpd #重启服务ntpq -p #查看是否配置成功

出现以上内容就是单机节点配置成功。
集群配置
server节点和n个client节点
yum install -y ntp #安装所需要的ntp工具#server节点做如下操作vim /etc/ntp.conf #进入配置文件#restrict default nomodify notrap nopeer noquery #添加注释#将下面的四行server注释server 127.0.0.1 #这里写内网网卡fudge 127.0.0.1 stratum 5 #设置服务器的时间层次,尽量不要设置为0#client节点做如下操作#restrict default nomodify notrap nopeer noquery #添加注释#将下面的四行server注释server 192.168.0.157 #这里写内网网卡
