CentOS7 下部署NTP服务供内网客户机使用

时间:2020-04-09 13:02:09   收藏:0   阅读:144

CentOS7 下部署NTP服务供内网客户机使用


1、安装NTP服务
# yum -y install ntp

2、修改 ntp配置
# vi /etc/ntp.conf

# 记录和上级时间服务器的时间差异,默认配置,保留
driftfile /var/lib/ntp/drift

#表示nomodify客户端可以同步时间
restrict default nomodify

# 允许本机的一切操作,默认策略,保留
restrict 127.0.0.1
restrict ::1

# 阿里云NTP服务可修改本NTP服务时间
restrict ntp.aliyun.com

# 添加阿里云时间源
server ntp.aliyun.com

3、启动NTP服务
启动:systemctl start ntpd
设置开机自启:systemctl enable ntpd

5、查看主备NTP服务器状态
IP地址前有*号,表示此服务器是主NTP服务器。
IP地址前有+号,表示此服务器是备NTP服务器。
Offset表示时间偏移秒数。

# ntpq -p


细节参考: https://www.cnblogs.com/harrymore/p/9566229.html
-----------------------------------------------------------------------------


AIX客户端同步NTP时间:

1、配置/etc/ntp.conf文件,添加NTP服务器地址信息(server 192.168.1.20)
broadcastclient
driftfile /etc/ntp.drift
server 192.168.1.125 //此处为内网ntp务器地址
tracefile /etc/ntp.trace

//启动 xntpd
方法1:
# startsrc -s xntpd
方法2:
# smit xntpd

//设置xntpd服务自动启动
# vi /etc/rc.tcpip
//去掉如下行的 # 号
start /usr/sbin/xntpd "$src_running"


//检查服务状态
//当 system peer 不为 ‘insane’ 时, 表明客户端已与服务器端成功地进行了同步。
# lssrc -ls xntpd

也可以查看xntpd是不是tcpip的一个子服务
# lssrc -g tcpip


//使用ntpdate手动与NTP服务器同步
# ntpdate -d 192.168.1.20

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!