配置NTP服务端

1. 查看是否已安装ntp服务

rpm -qa | grep ntp
# 如果有执行命令卸载相关包
yum –y remove "package_name"

2. 重新安装ntp

yum –y install ntp

3. 配置ntp服务

vim /etc/ntp.conf

### 注释掉server行,增加以自己为服务的配置
 20 # Please consider joining the pool (http://www.pool.ntp.org/join.html).
 21 #server 0.centos.pool.ntp.org iburst
 22 #server 1.centos.pool.ntp.org iburst
 23 #server 2.centos.pool.ntp.org iburst
 24 #server 3.centos.pool.ntp.org iburst
 25 server 127.127.1.0 iburst

4. 启动ntp服务

service ntpd start

5. 查看ntp服务的同步状态

ntpq -p

[root@host-a bin]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*LOCAL(0)        .LOCL.           5 l   24   64  377    0.000    0.000   0.000

6. 客户端可以使用ntpdate去同步时间

ntpdate "ip_address"
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容