配置chrony或ntp时间同步服务(推荐chrony)https://www.cnblogs.com/bytefish/p/10106743.html
Linux系统之时间同步方法 https://blog.csdn.net/jks212454/article/details/126151111
linux | 时间同步 | 时钟同步 | ntp同步系统时间 https://www.cnblogs.com/shijiehaiyang/p/17522755.html
Linux系统管理:服务器时间与网络时间同步技巧 https://www.8kiz.cn/archives/9277.html
Linux 同步时间 https://www.cnblogs.com/lewisat/p/17696264.html
设置Linux系统时间同步方法大全 https://www.timentp.com/article/post/4483.html
-----------------
Linux关闭时间服务器同步指南 https://www.bdsytime.com/baike/77.html
linux服务器时间检查,技术|Linux 上查看系统/服务器运行时间的 11 种方法 https://www.163.com/dy/article/E5IHEFDR0511CPOJ.html
https://zhuanlan.zhihu.com/p/54903290?utm_id=0
--------------------------------------------------------------------
关联参考:
设置和更改 Ubuntu 时区的两种简单方法 https://blog.csdn.net/ken2232/article/details/136202432
ubuntu与windows:双系统切换后系统时间错乱问题解决 https://blog.csdn.net/ken2232/article/details/136780346
--------------------------------------------------------------------
要点:
/etc/chrony.conf
/etc/ntp.conf
禁用NTP服务:
sudo systemctl disable ntpd.service
全禁用系统时间同步:
sudo timedatectl set-ntp 0
停止和禁用NTP服务:
sudo systemctl stop ntp
sudo systemctl disable ntp
停止和禁用chrony服务:
sudo systemctl stop chrony
sudo systemctl disable chrony
--------------------------------------------------------------------
Linux系统之时间同步方法
https://blog.csdn.net/jks212454/article/details/126151111
----------------------
配置chrony或ntp时间同步服务(推荐chrony)
https://www.cnblogs.com/bytefish/p/10106743.html
2018.12.12
ubuntu1604、CentOS7及以上版本适用,红帽官方已使用chronyd取代ntpd服务程序。
一、配置chrony:
1、停止、禁用ntpd服务(避免启动了ntpd而冲突):
systemctl disable ntpd
systemctl stop ntpd
2、编辑/etc/chrony.conf:
外网服务器则参考增加以下几行:
server 0.cn.pool.ntp.org iburst
server 1.cn.pool.ntp.org iburst
server 2.cn.pool.ntp.org iburst
server 3.cn.pool.ntp.org iburst
server time.windows.com iburst
3、允许chronyd服务自动启动并启动chronyd服务:
systemctl enable chronyd
systemctl start chronyd
查看本机是否开始连接时间服务器的123端口:
ss -un4a | grep ':123'
4、查看同步状态:
查看 ntp_servers 状态
chronyc sources -v
查看 ntp_sync 状态
chronyc sourcestats -v
查看 ntp_servers 是否在线
chronyc activity -v
查看 ntp 详细信息
chronyc tracking -v
二、配置ntp
1、停止chrony服务(避免启动了chrony而冲突):
systemctl disable chronyd
systemctl stop chronyd
2、编辑/etc/ntp.conf
外网服务器则参考增加以下几行:
server 0.cn.pool.ntp.org iburst
server 1.cn.pool.ntp.org iburst
server 2.cn.pool.ntp.org iburst
server 3.cn.pool.ntp.org iburst
server time.windows.com iburst
3、允许ntpd服务自动启动并启动ntpd服务:
systemctl enable ntpd
systemctl start ntpd
查看是否连接服务器123端口:
ss -un4a | grep ':123'
4、查看同步状态:
[root@svr24 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
x10.1.1.18 LOCAL(0) 11 u 23 64 17 0.798 0.052 0.108
x10.1.1.19 10.33.0.35 5 u 35 64 17 1.048 -618.28 1.384
[root@svr24 ~]# ntpstat #初次运行,尚未同步
unsynchronised
polling server every 64 s
[root@svr24 ~]# ntpstat #等待几分钟后再次运行,已开始同步。
synchronised to NTP server (10.33.48.18) at stratum 6
time correct to within 387 ms
polling server every 64 s
linux NTP 同步如何关闭
https://www.5axxw.com/questions/simple/9afdkn
要关闭Linux中的NTP同步,您可以执行以下步骤:
1. 停止NTP服务
执行以下命令来停止NTP服务:
sudo systemctl stop ntpd.service
如果您使用 chrony 作为您的NTP客户端,请用以下命令停止:
sudo systemctl stop chronyd.service
2. 禁用NTP服务
执行以下命令来禁用NTP服务:
sudo systemctl disable ntpd.service
如果您使用 chrony 作为您的NTP客户端,请用以下命令禁用:
sudo systemctl disable chronyd.service
3. 在防火墙中关闭NTP服务端口
如果您使用的是防火墙,您需要关闭NTP端口(UDP 123)以防止任何NTP流量进入您的系统。执行以下命令以关闭端口:
sudo iptables -A INPUT -p udp --dport 123 -j DROP
如果您正在运行firewalld,并且已经启用NTP服务,则可以使用以下命令关闭NTP端口:
sudo firewall-cmd --permanent --remove-service=ntp
sudo firewall-cmd --reload
这样可以从firewalld中删除与NTP关联的服务,并重新加载防火墙规则。
4. 禁用系统时间同步
您可以使用以下命令完全禁用系统时间同步:
sudo timedatectl set-ntp 0
这将停止时间自动同步并禁用NTP服务。
Linux关闭时间服务器同步指南
https://www.bdsytime.com/baike/77.html
本文主要讲解在Linux系统下关闭时间服务器同步的方法。时间服务器同步是通过向网络中的一个时间服务器请求当前时间,然后进行本地时间的调整,以确保时间的准确性。但是,在某些情况下,我们希望禁止时间服务器同步,例如在一些安全要求较高的系统或环境中,为了避免时间被篡改,我们需要禁止时间同步。因此,了解如何关闭时间服务器同步是非常重要的。
1、禁用NTP服务
在Linux系统中,时间服务器同步的核心机制是NTP,因此,我们需要禁用NTP服务来阻止时间服务器同步。有两种方法可以禁用NTP服务:
1)通过编辑/etc/ntp.conf文件,将文件中所有的Server行注释掉:
2)通过执行以下命令来停止和禁用NTP服务:
sudo systemctl stop ntp
sudo systemctl disable ntp
这样,NTP服务就已经被停止和禁用了。
2、禁用chrony服务
除了NTP服务外,Linux系统中还有另一个时间服务器同步服务,叫做chrony。chrony是NTP的一个替代品,它也会将本地时间和网络中的时间服务器同步。因此,我们也需要禁用chrony服务。
禁用chrony服务也有两种方法:
1)通过编辑/etc/chrony.conf文件,将文件中所有的server行注释掉:
2)通过执行以下命令来停止和禁用chrony服务:
sudo systemctl stop chrony
sudo systemctl disable chrony
通过以上两种方法都可以禁用chrony服务。
3、关闭时间同步
在Linux系统中,有一个叫做timedatectl的工具,可以用来管理系统时间和日期。timedatectl工具可以用来关闭时间同步。
执行以下命令来关闭时间同步:
sudo timedatectl set-ntp 0
执行该命令后,时间将不再从网络中的时间服务器同步,而是使用本地计算机的系统时间。
4、手动设置时间
如果关闭了NTP和chrony服务,那么系统时间将不再自动同步。如果我们需要手动设置时间,可以执行以下命令:
sudo date --set="2022-01-01 00:00:00"
这条命令将系统时间设置为2022年1月1日0点0分0秒。
总结:
关闭Linux系统中的时间服务器同步可以提高系统的安全性,避免时间被篡改。
我们可以通过禁用NTP服务和chrony服务、关闭时间同步、手动设置时间等方法来实现关闭时间服务器同步。
在实际应用中,我们需要根据具体情况来选择适合自己的方式。