NTP时间同步服务器部署及客户端配置
2023-06-13 09:17:25 时间
文章标题图片 :来自 Pexels 上的图片
1.环境介绍
- CentOS Linux release 7.7.1908 (Core)
- 通信协议:UDP Port:123
-
- 防火墙放行 UDP 123端口
- firewall-cmd --zone=public --add-port=123/udp --permanent
- firewall-cmd --reload
- 服务端:10.60.60.1
- 客户端:10.60.70.1
2.服务端
# 10.60.60.1
# 停止chronyd服务,否则ntpd开机无法自启动
systemctl stop chronyd
systemctl disable chronyd
# 安装ntp服务
yum install -y ntp
# 修改公共ntp服务器地址
sed -i 's/server 0.centos.pool.ntp.org iburst/server ntp.ntsc.ac.cn iburst/g' /etc/ntp.conf
sed -i 's/server 1.centos.pool.ntp.org iburst/server ntp.tencent.com iburst/g' /etc/ntp.conf
sed -i 's/server 2.centos.pool.ntp.org iburst/server ntp.aliyun.com iburst/g' /etc/ntp.conf
sed -i 's/server 3.centos.pool.ntp.org iburst/server time.edu.cn iburst iburst/g' /etc/ntp.conf
# 启动ntpd服务
systemctl start ntpd
# 开机自动启动
systemctl enable ntpd
# 查看ntp是否有同步状态,如果没有,等5分钟再看
[root@localhost ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
+139.199.215.251 100.122.36.196 2 u 143 256 377 20.753 -7.559 9.998
+203.107.6.88 10.137.55.181 2 u 250 256 377 43.939 -1.862 5.165
202.112.0.38 .INIT. 16 u - 1024 0 0.000 0.000 0.000
*114.118.7.161 .OLEG. 1 u 316 256 316 35.822 -12.091 6.762
# remote:本机和上层ntp的ip或主机名,“+”表示优先,“*”表示次优先
# refid:参考上一层ntp主机地址
# st:stratum阶层
# when:多少秒前曾经同步过时间
# poll:下次更新在多少秒后
# reach:已经向上层ntp服务器要求更新的次数
# delay:网络延迟
# offset:时间补偿
# jitter:系统时间与bios时间差
3.客户端
# 10.60.70.1
# 停止chronyd服务,否则ntpd开机无法自启动
systemctl stop chronyd
systemctl disable chronyd
# 安装ntp服务
yum install -y ntp
# 修改ntp服务器地址为服务端
sed -i 's/server 0.centos.pool.ntp.org iburst/server 10.60.60.1 iburst/g' /etc/ntp.conf
# 启动ntpd服务
systemctl start ntpd
# 开机自动启动
systemctl enable ntpd
# 查看ntp是否有同步状态,如果没有,等20秒再看
[root@localhost ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
+10.60.60.1 ntp.ntsc.ac.cn 2 u 1 64 1 0.903 -38.559 0.134
- 我的博客即将同步至腾讯云开发者社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=2xg24e2zqkcgs
相关文章
- 如何使用nacos在分布式环境下同步全局配置
- verilog同步fifo_verilog 异步复位
- mysql主从同步配置读写分离_mysql8做主从数据库
- 【时间同步】NTP还是PTP?
- 【8】同步vscode配置和插件【导入导出】、再也不用担心换电脑重新安装插件了
- 深入浅出阿里数据同步神器:Canal原理+配置+实战全网最全解析!
- java 线程之对象的同步和异步详解编程语言
- MySQL同步配置指定库的示范(mysql同步指定库)
- 在Linux系统下实现精确的时间同步(linux下的时间同步)
- Linux 同步时间配置:轻松搞定精准同步(linux时间同步配置)
- MySQL主从同步,数据一致性!(mysql主从一致)
- Linux系统中如何安装和配置NTP时间同步服务(linuxntp安装)
- MySQL 主从复制不同步问题解决方案(mysql主从不同步)
- MySQL主从同步配置及查看流程详解(mysql查看主从)
- 极速将本地数据库MSSQL同步到云端(同步本地数据库mssql)
- 实现MySQL数据同步的两种方法:比较与选择(mysql两表同步)
- 库ElasticSearch 无缝同步Oracle数据库技术探索(es同步oracle数据)
- 实现数据表与Redis同步的方法(数据表 同步 redis)
- Redis集群同步实现最佳性能(redis 集群同步配置)
- Oracle中OGG同步技术解析(oracle中ogg同步)
- AP从Oracle数据库中同步配置LDAP服务(oracle LD)
- MYSQL5masterslave数据同步配置方法
- ASP.NET之自定义同步HTTP处理程序(图文教程)
- inotify-tools+rsync实时同步文件的配置方法
- 基于MySQLMasterSlave同步配置的操作详解