AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[ntp](ubuntu)

Martin Hope
Stormlord
Asked: 2024-12-28 07:08:43 +0800 CST

来自 ntpd 的有关 leapsecond 文件的日志消息

  • 8

此消息已开始出现在日志ntpd中。

leapsecond file ('/usr/share/zoneinfo/leap-seconds.list'): will expire in less than one day

请问这是啥以及如何修复?

ntp
  • 1 个回答
  • 147 Views
Martin Hope
uzaysan
Asked: 2020-11-15 00:35:27 +0800 CST

NTP 端口被阻止。如何同步时间?- 18.04

  • 1

我的服务器提供商阻止了 NTP 端口,因为他们说有 NTP 攻击。现在我无法在我的 ubuntu 18.04 服务器中同步日期和时间。

如何同步时间?

这是ntpdate -q 0.pool.ntp.org结果:

server 195.50.171.101, stratum 0, offset 0.000000, delay 0.00000
server 176.235.41.255, stratum 0, offset 0.000000, delay 0.00000
server 86.108.190.23, stratum 0, offset 0.000000, delay 0.00000
server 178.79.155.116, stratum 0, offset 0.000000, delay 0.00000
14 Nov 04:51:06 ntpdate[4027]: no server suitable for synchronization found

这是timedatectl结果:

                      Local time: Sat 2020-11-14 05:22:44 EST
                  Universal time: Sat 2020-11-14 10:22:44 UTC
                        RTC time: Sat 2020-11-14 09:55:35
                       Time zone: America/New_York (EST, -0500)
       System clock synchronized: no
systemd-timesyncd.service active: yes
                 RTC in local TZ: no
ntp time date
  • 1 个回答
  • 1447 Views
Martin Hope
Arjun Kr
Asked: 2020-11-11 23:46:25 +0800 CST

如何检查 Ubuntu 18.04 中是否启用了 NTP

  • 1

我已经安装了 chrony 并尝试从配置的 NTP 池中获取时间。我已经在 timedatectl 上启用了 NTP。但是如何确保我在“date/timedatectl”命令中看到的时间是从 NTP 服务器获得的。在 Ubuntu 18.04 timedatectl命令未显示 NTP 同步详细信息。

/etc/chrony/chrony.conf

pool time.google.com prefer iburst
keyfile /etc/chrony/chrony.keys
commandkey 1
driftfile /var/lib/chrony/chrony.drift
log tracking measurements statistics
logdir /var/log/chrony
maxupdateskew 100.0
dumponexit
dumpdir /var/lib/chrony
dumpdir /var/lib/chrony
logchange 0.5
hwclockfile /etc/adjtime
rtcsync
root@server-2:~# systemctl status chronyd
● chrony.service - chrony, an NTP client/server
   Loaded: loaded (/lib/systemd/system/chrony.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-11-11 12:16:13 IST; 43min ago
     Docs: man:chronyd(8)
           man:chronyc(1)
           man:chrony.conf(5)
  Process: 6228 ExecStartPost=/usr/lib/chrony/chrony-helper update-daemon (code=exited, status=0/SUCCESS)
  Process: 6202 ExecStart=/usr/lib/systemd/scripts/chronyd-starter.sh $DAEMON_OPTS (code=exited, status=0/SUCCESS)
 Main PID: 6226 (chronyd)
    Tasks: 1 (limit: 2318)
   CGroup: /system.slice/chrony.service
           └─6226 /usr/sbin/chronyd

Nov 11 12:16:13 server-2 systemd[1]: Starting chrony, an NTP client/server...
Nov 11 12:16:13 server-2 chronyd[6226]: chronyd version 3.2 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SECHASH 
Nov 11 12:16:13 server-2 chronyd[6226]: commandkey directive is no longer supported
Nov 11 12:16:13 server-2 chronyd[6226]: Frequency -88.224 +/- 0.493 ppm read from /var/lib/chrony/chrony.drift
Nov 11 12:16:13 server-2 systemd[1]: Started chrony, an NTP client/server.
sudo timedatectl set-ntp true
root@server-2:~# timedatectl 
                      Local time: Wed 2020-11-11 13:04:58 IST
                  Universal time: Wed 2020-11-11 07:34:58 UTC
                        RTC time: Wed 2020-11-11 07:34:58
                       Time zone: Asia/Kolkata (IST, +0530)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no
root@server-2:~# 

timedatectl输出中没有提供 NTP 同步的详细信息。那么我们如何确认 ntp 是否启用并且 timedatectl 是否与 NTP 服务器同步。

ntp 18.04
  • 1 个回答
  • 1751 Views
Martin Hope
jash101
Asked: 2020-09-03 06:29:57 +0800 CST

如何找到两台计算机之间的时差?

  • 1

我正在运行一个分布式计算机设置,其中一台机器作为另一台机器的时间服务器,因此两者同步到几毫秒的精度。

我遵循了这个问题的答案: 如何设置本地 NTP 服务器?

我能够成功设置,但我想知道是否有办法查询 ntp 或任何其他程序并知道两台机器之间的时间差?

server ntp time 16.04
  • 1 个回答
  • 2514 Views
Martin Hope
Dominick Pastore
Asked: 2020-06-12 09:15:29 +0800 CST

如何在 GNOME 3 中设置 NTP 服务器?

  • 2

在 Ubuntu 20.04 Desktop 中,时间和日期设置在“设置”应用程序的“日期和时间”类别下进行管理。您可以设置时区、时间格式、手动设置时间或开启自动时间同步。

不幸的是,缺少的是设置用于自动时间同步的 NTP 服务器的选项。这样做的正确方法是什么?

我怀疑 gsettings 或 dconf 中有一个键来设置它,但我找不到。有没有,或者是修改/etc/systemd/timesyncd.conf唯一的方法?

gnome ntp
  • 1 个回答
  • 635 Views
Martin Hope
Sergey
Asked: 2020-03-04 03:38:52 +0800 CST

如何将 ntpd 日志设置为 DEBUG 或更详细的内容

  • 3

我有 Ubuntu Server 18.04 并通过ntpd. 我的配置文件/etc/ntp.conf, 包含:

driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntpd.log
statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 1.2.5.6 iburst burst minpoll 6 maxpoll 8
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1
restrict source notrap nomodify noquery

ntpd 启动,我认为它工作正常。这是一个示例ntpq -pn命令输出:

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*1.2.5.6     1.2.5.3      4 u   53   64    3    0.591    3.830   8.130

但是在日志文件/var/log/ntpd.log中,我只有这个:

 3 Mar 14:26:05 ntpd[8457]: Listen and drop on 0 v6wildcard [::]:123
 3 Mar 14:26:05 ntpd[8457]: Listen and drop on 1 v4wildcard 0.0.0.0:123
 3 Mar 14:26:05 ntpd[8457]: Listen normally on 2 lo 127.0.0.1:123
 3 Mar 14:26:05 ntpd[8457]: Listen normally on 3 eth0 1.2.2.19:123
 3 Mar 14:26:05 ntpd[8457]: Listening on routing socket on fd #20 for interface updates

我想知道时间何时同步,以及同步完成后本地主机上的时间变化了多少秒。我想我需要增加日志文件的详细程度,但我不知道该怎么做。请帮忙。/etc/ntp.conf即使在阅读之后,我也找不到任何相关的内容man 5 ntp.conf。

server ntp
  • 1 个回答
  • 2720 Views
Martin Hope
almog kashany
Asked: 2020-01-03 07:12:51 +0800 CST

“服务 ntp 状态”和“systemctl 状态 systemd-timesyncd.service”有什么区别

  • 0

我有两台虚拟机,一台是服务器 NTP,另一台用于同步。

在我的 Ubuntu 14 代码中,我使用 NTP 服务,现在我需要将我的软件升级到 Ubuntu 18,并且需要知道如何在我的 VM 上使用 NTP。

现在我看到在 Ubuntu 18 上创建了新服务systemd-timesyncd

我需要知道我应该使用这两种服务还是只使用systemd-timesyncd?

ntp 18.04 systemd-timesyncd
  • 1 个回答
  • 460 Views
Martin Hope
user1506145
Asked: 2019-12-30 08:41:12 +0800 CST

Ubuntu 18:日期滞后约 17 秒

  • 0

我在 Ubuntu 18 中的时间同步有问题,这是我的版本,在数字海洋上运行:

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:    18.04
Codename:   bioni

当我写的时候,date我会得到Sun Dec 29 15:24:50 UTC 2019,但sudo hwclock --show会给2019-12-29 15:25:06.699770+0000。硬件时钟实际上显示了正确的时间。

timedatectl status显示此信息

Local time: Sun 2019-12-29 15:25:29 Universal time: Sun 2019-12-29 15:25:29 UTC
RTC time: Sun 2019-12-29 15:25:46
Time zone: UTC (UTC, +0000)
System clock synchronized: no
systemd-timesyncd.service active: yes
RTC in local TZ: no

所以似乎时钟没有同步。我见过很多涉及安装的灵魂,ntpdate但它在这里说这个程序已经贬值了:

https://help.ubuntu.com/lts/serverguide/NTP.html

运行后

systemctl status systemd-timesyncd表明服务正在运行。

● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-12-28 23:28:33 UTC; 16h ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 31580 (systemd-timesyn)
   Status: "Idle."
    Tasks: 2 (limit: 1152)
   CGroup: /system.slice/systemd-timesyncd.service
           └─31580 /lib/systemd/systemd-timesyncd

我已尝试重新启动服务sudo systemctl restart systemd-timesyncd

在空闲之前,状态只会Status: "Connecting to time server 91.189.89.198:123 (ntp.ubuntu.com)."显示几分钟。

我尝试将其他时间服务器添加到/etc/systemd/timesyncd.conf

...
# See timesyncd.conf(5) for details.

[Time]
#NTP=
#FallbackNTP=ntp.ubuntu.com
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048

取消注释#NTP=并更改为 NTP=time.google.com,然后重新启动服务,但时间仍然不同步。

我正在使用没有出站规则的网络防火墙:

防火墙设置

  • 是否有任何错误日志我可以检查它为什么没有连接?
  • 我可以 ping 任何其他时间服务器并查看它是否响应?
  • 这里的关键是更改 NTP 还是备用 NTP?

非常感谢任何帮助,我真的迷路了:S

server ntp time 18.04
  • 1 个回答
  • 336 Views
Martin Hope
flamingo_stark
Asked: 2019-08-11 06:11:38 +0800 CST

Ubuntu 18.04 Desktop - 日期和时间同步问题

  • 1

几天前,我在笔记本电脑上进行了 Ubuntu 18.04 LTS 的全新安装。在安装过程中,我选择了时区作为我的本地时区,即印度加尔各答(印度标准时间)。但是,启动我的系统后,时间和日期显示的值不正确。

显示值:

日期:2019 年 8 月 11 日星期日时间:06:21:xx

当时的实际值:

日期:2019年8月10日星期六时间:19:21:xx

准确地说,显示的时间比实际时间提前了 11 小时。

错误的日期和时间

在 Settings --> Date and Time 中,还启用了 Automatic Date and Time 和 Automatic Time Zones 开关。

启用自动更新日期和时间

我在互联网上发现了一些我试图分析/解决问题的文章(附截图)。

  1. 跑timedatectl

                         Local time: Sun 2019-08-11 06:27:44 IST
                      Universal time: Sun 2019-08-11 00:57:44 UTC
                            RTC time: Sun 2019-08-11 00:57:44
                           Time zone: Asia/Kolkata (IST, +0530)
           System clock synchronized: yes
    systemd-timesyncd.service active: yes
                     RTC in local TZ: no
    
  2. 已安装ntp

    $ sudo dpkg -s ntp | grep Status
    Status: install ok installed
    
  3. 跑sudo ntpq -p

     0.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
     1.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
     2.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
     3.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
     ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000    0.000   0.000
    

    ntpq 命令输出

  4. 运行sudo nmap -p123 -sU -P0 localhost。我认为它会检查 UDP 端口 123 的状态。

    Starting Nmap 7.60 ( https://nmap.org ) at 2019-08-11 07:09 IST
    Nmap scan report for localhost (127.0.0.1)
    Host is up (0.00024s latency).
    
    PORT    STATE SERVICE
    123/udp open  ntp
    
    Nmap done: 1 IP address (1 host up) scanned in 0.33 seconds
    

    更新端口 123 状态检查

我需要执行哪些后续步骤才能解决此问题?

ntp time timezone 18.04
  • 1 个回答
  • 1810 Views
Martin Hope
OZ1SEJ
Asked: 2019-07-07 23:24:07 +0800 CST

Ubuntu 19.04 及更高版本多久同步一次时间?

  • 4

在默认的 Ubuntu 19.04 中 - 计算机时间与时间服务器多久同步一次?

  • 每小时一次?
  • 每天一次?
  • 完全不同的东西?
ntp time 19.04
  • 1 个回答
  • 1902 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve