📂Linux
🔖Linux
2022-05-22 15:20阅读: 601评论: 0推荐: 0

Linux ntp ntpdate

简介

ntpdate指令通过轮询指定为服务器参数的网络时间协议(NTP)服务器来设置本地日期和时间,从而确定正确的时间。此命令的适用范围:RedHat、RHEL、Ubuntu、CentOS、Fedora。

安装

1. 中国NTP服务器

http://www.ntp.org.cn/pool

2. 安装ntp、ntpdate

yum install -y ntp
yum install -y ntpdate

3. 配置ntp

# 编辑NTP配置文件
vim /etc/ntp.conf

# 注释配置文件中原有的NTP服务器,并在其中添加自己所需的NTP服务器地址
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# 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
server cn.ntp.org.cn iburst

4. 配置自启服务

systemctl enable ntpd.service

5. 启动ntp

systemctl start ntpd

6. 检查ntp运行状态

systemctl status ntpd
ntpstat
watch ntpq -p

7. 同步网络时间

# 中国
ntpdate -u cn.ntp.org.cn
# 中国教育网
ntpdate -u edu.ntp.org.cn
# 阿里云
ntpdate -u 120.25.108.11
ntpdate -u 182.92.12.11
ntpdate -u 203.107.6.88
ntpdate -u 120.25.115.20
ntpdate -u ntp1.aliyun.com
# 中国香港
ntpdate -u hk.ntp.org.cn
# 中国台湾
ntpdate -u tw.ntp.org.cn

本文作者:逢生博客

本文链接:https://www.cnblogs.com/wufengsheng/p/16297967.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   逢生博客  阅读(601)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起
  1. 1 晚安 顏人中
  2. 2 出山 花粥 / 王胜娚
  3. 3 我们俩 郭顶
  4. 4 日落大道 梁博
  5. 5 像鱼 王贰浪
  6. 6 把回忆拼好给你 王贰浪
  7. 7 时光背面的我 刘至佳 / 韩瞳
  8. 8 愿你余生漫长 王贰浪
  9. 9 追寻你 王天戈 / 川青
  10. 10 夜空中最亮的星 逃跑计划
  11. 11 孤勇者 陈奕迅
  12. 12 不为谁而作的歌 林俊杰
  13. 13 消愁 毛不易
  14. 14 这一生关于你的风景 隔壁老樊
我们俩 - 郭顶
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.