ntp服务端和客户端配置

#服务端(同步阿里云)

yum  install -y  ntp

ntpdate  ntp2.aliyun.com

vi /etc/ntp.conf
将默认的server注释,改为阿里云ntp服务器
server ntp2.aliyun.com iburst
server ntp3.aliyun.com iburst
server ntp4.aliyun.com iburst

开放客户端限制
restrict default ignore //设置默认策略为允许任何主机进行时间同步
restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap //允许任何主机跟进行时间同步

查看状态

  systemctl  enable  ntpd

  systemctl   start  ntpd

  ntpq  -q

  ntpstat  

#客户端

yum  install -y ntp

ntpdate   192.168.1.100

vi /etc/ntp.conf
将默认的server注释, 改成自己的server()

server  192.168.1.100       #IP的情况下

server   test.baidu.com   iburst   # 域名的情况下

systemctl  enable  ntpd

systemctl   start  ntpd

ntpq  -p
ntpstat  

## 注意  出现 unsynchronised  time server re-startint 这是正常现象等几分钟后就好了