ntp服务器搭建

一、下载ntp、ntpdate

yum install -y ntp ntpdate

二、配置ntp

vim /etc/ntp.conf
修改:

#203.107.6.88 ntp.aliyun.com
server 203.107.6.88
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
vim /etc/sysconfig/ntpd
修改:

# Drop root to id 'ntp:ntp' by default.
#-x 微调 -g 忽略相差时间过大(1000s),如果相差时间过大1000s,下层ntpd会死掉
#OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g"
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
SYNC_HWCLOCK=yes

-g 忽略相差时间过大(1000s),如果相差时间过大1000s,下层ntpd会死掉。

强烈建议:先执行ntpdate手动同步时间!!!

另外:ntpd服务运行状态,无法执行ntpdate命令。

date
ntpdate 203.107.6.88
hwclock -w
date

三、开机启动

systemctl enable ntpd
systemctl status ntpd
systemctl start ntpd

四、防火墙设置

firewall-cmd --zone=public --add-port=123/udp --permanent
firewall-cmd --reload

五、测试与上层ntp的连通性

ntpstat
watch ntpq -p
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

搬山境KL攻城狮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值