ntp测试小记

来源:互联网 发布:淘宝内衣进货渠道 编辑:程序博客网 时间:2024/05/21 11:35

测试环境

ntp server  centos7.1

client  xenserver6.5

目的xenserver到ntp server上同步时间


1.安装ntp

yum install ntp -y


2.编辑配置文件

vi /etc/ntp.conf

修改两处

添加允许连接同步的网段

restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap


添加上层ntp server

server 2.cn.pool.ntp.org iburst
server 1.asia.pool.ntp.org iburst
server 3.asia.pool.ntp.org iburst

具体列表:http://www.pool.ntp.org/zone/cn


3.启动服务

systemctl start ntpd

systemctl enable ntpd


4.查看是否正常运行

[root@ntp ~]# ntpstat
synchronised to NTP server (202.162.32.12) at stratum 3 
   time correct to within 222 ms
   polling server every 256 s


[root@ntp ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 202.118.1.130   .STEP.          16 u    - 1024    0    0.000    0.000   0.000
*ntp.uii.net.id  10.84.87.146     2 u  219  256  377  146.161   19.764  31.889
+82.200.209.236  89.109.251.23    2 u  162  256  225  225.248   30.784  66.823


5.客户端设置

[root@xenserver02 ~]# crontab -l
*/1 * * * * /usr/sbin/ntpdate 192.168.0.109

具体频率根据自身需求设定





0 0