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
    • 最新
    • 标签
主页 / unix / 问题

问题[ntpd](unix)

Martin Hope
Gui13
Asked: 2019-11-25 14:07:11 +0800 CST

ntp 不能在只读的 Raspberry Pi 上工作

  • 8

我很难理解为什么 ntp(服务)不会在我的树莓派上正确设置时间。

我已将文件系统配置为只读,以保存我的 SD 卡,但它曾经可以工作,我似乎无法弄清楚为什么 ntp 现在不能工作。

在日志中,我收到了许多多行该消息:

ntpd[415]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
ntpd[415]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
ntpd[415]: error resolving pool 0.debian.pool.ntp.org: Temporary failure in name resolution (-3)
ntpd[415]: error resolving pool 1.debian.pool.ntp.org: Temporary failure in name resolution (-3)
ntpd[415]: error resolving pool 2.debian.pool.ntp.org: Temporary failure in name resolution (-3)
ntpd[415]: error resolving pool 3.debian.pool.ntp.org: Temporary failure in name resolution (-3)
ntpd[415]: error resolving pool 3.debian.pool.ntp.org: Temporary failure in name resolution (-3)
ntpd[415]: error resolving pool 2.debian.pool.ntp.org: Temporary failure in name resolution (-3)
ntpd[415]: error resolving pool 1.debian.pool.ntp.org: Temporary failure in name resolution (-3)
ntpd[415]: error resolving pool 0.debian.pool.ntp.org: Temporary failure in name resolution (-3)

我的 /etc/resolv.conf 看起来像这样:

# Generated by resolvconf
nameserver 8.8.8.8
nameserver 192.168.1.22

我可以在那个 RPi 上访问互联网,我可以 ping 池地址,我可以 ping google,我可以进行更新(在 rw 中重新安装后)...

我也可以手动发出 ntpdate 命令并且它可以工作!

$ sudo ntpdate -u 0.fr.pool.ntp.org 1.fr.pool.ntp.org
24 Nov 23:04:34 ntpdate[578]: step time server 129.250.35.250 offset 2418.621037 sec

所以,是的,我在这里拉头发。我不明白为什么 ntp 服务不起作用。我在互联网上大肆搜索,似乎没有人有这个特殊问题(都有一个故障的 dns,但我的工作正常)

我的只读设置如下:https ://hallard.me/raspberry-pi-read-only/

你们有什么想法吗?

ntp ntpd
  • 2 个回答
  • 3737 Views
Martin Hope
sourcejedi
Asked: 2019-06-13 10:46:48 +0800 CST

重试无响应的 NTP 服务器的最小间隔是多少?

  • 1

ntpd是NTP的参考实现。当前版本是 4.1.2。

手册页似乎说,iburst使用时,重试无响应的 NTP 服务器的间隔为 16 秒。

http://doc.ntp.org/4.1.2/confopt.htm

iburst

当服务器无法访问并且在每个轮询间隔时,发送八个数据包的突发而不是通常的一个。只要服务器不可达,数据包之间的间隔大约为 16 秒,以允许调制解调器调用完成。一旦服务器可达,数据包之间的间隔约为 2s。这旨在加速使用服务器命令和 s 地址以及使用该-q选项启动 ntpd 时的初始同步获取。

但是官方的 NTP“手册”说重试间隔将提高到 64 秒(假设默认设置):

https://www.eecis.udel.edu/~mills/ntp/html/poll.html

对于该iburst选项,突发中的数据包数量为 6,这是同步时钟通常所需的数量;对于该burst 选项,突发中的数据包数量由当前轮询指数和最小轮询指数之间的差值作为 2 的幂来确定。例如,默认最小轮询指数为 6(64 秒),只有一个每次轮询都会发送数据包,而在轮询指数为 9(512 秒)或更多时发送全部 8 个数据包。这确保了平均车头时距永远不会超过最小车头时距。

如果设计不当,突发选项可能会导致网络负载增加。这两个选项都受到速率管理和 Kiss-o'-Death Packet 页面上描述的规定的影响。此外,当iburst或burst被启用时,会发送突发的第一个数据包,但只有在收到对第一个数据包的回复时才会发送剩余的数据包。如果在选项设置的超时后没有收到回复minpoll,则再次发送第一个数据包。这意味着,即使服务器无法访问,网络负载也不会超过最小轮询间隔。

我是否应该理解重试之间的间隔在使用时实际上是 64 秒iburst,除非该minpoll选项也被调整?

ntpd
  • 1 个回答
  • 808 Views
Martin Hope
PatrickSteiner
Asked: 2019-04-15 23:50:21 +0800 CST

无法禁用网络时间控制 (NTP)

  • 0

我想使用wireshark分析virtualbox(操作系统:Linux Mint 19.1 Tessa)内的一些协议(ARP、NDP等),并试图禁用“网络时间控制”-同步。

yuza@VirtualBox:~$ sudo timedatectl set-ntp off && timedatectl status 
                      Local time: Fri 2019-04-12 09:59:28 CEST
                  Universal time: Fri 2019-04-12 07:59:28 UTC
                        RTC time: Fri 2019-04-12 07:59:29
                       Time zone: Europe/Vienna (CEST, +0200)
       System clock synchronized: yes
systemd-timesyncd.service active: no
                 RTC in local TZ: no

尽管如此,wireshark 仍然经常捕获 NTP 流量。
我知道wiresharks capture filter和display filter。
不过,我很感兴趣,为什么我不能使用 NTP 来禁用 NTP sudo timedatectl set-ntp off?


编辑:
我没有安装chrony:

yuza@VirtualBox:~$ apt policy chrony | grep Installed
  Installed: (none)

Wireshark 抓包截图: NTP_Wireshark_Capture

UDP 123端口进程打开的文件列表:

yuza@VirtualBox:~$ sudo lsof -iUDP:123
COMMAND PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
ntpd    716  ntp   16u  IPv6  19895      0t0  UDP *:ntp 
ntpd    716  ntp   17u  IPv4  19900      0t0  UDP *:ntp 
ntpd    716  ntp   18u  IPv4  19904      0t0  UDP localhost:ntp 
ntpd    716  ntp   19u  IPv6  19906      0t0  UDP ip6-localhost:ntp 
ntpd    716  ntp   23u  IPv4  22229      0t0  UDP VirtualBox:ntp 
ntpd    716  ntp   24u  IPv6  22232      0t0  UDP VirtualBox:ntp 
ntp ntpd
  • 1 个回答
  • 1881 Views
Martin Hope
Roger Mungo
Asked: 2019-01-19 02:48:09 +0800 CST

ntpd 没有运行

  • 6
  • 已确认配置了正确的服务器/etc/ntp.conf
  • 它可以ping该服务器。
  • 它肯定有ntp包

    /home/admin# dpkg -s ntp Package: ntp Status: install ok installed

  • 但是守护进程没有运行

    /home/admin# ps wax | grep ntp 21959 pts/0    S+     0:00 grep ntp

  • 状态检查

    /home/admin# ntpstat Unable to talk to NTP daemon. Is it running?

  • 当我尝试重新启动它时,我得到了这个

    /home/admin# systemctl start ntpd Failed to start ntpd.service: Unit ntpd.service failed to load: No such file or directory.

接下来应该尝试什么?

ntpd
  • 2 个回答
  • 14122 Views
Martin Hope
ZioByte
Asked: 2018-10-07 06:33:29 +0800 CST

强制系统使用 NTP 时间

  • 1

ntpd如果差异太大,通常会拒绝更改(或转换)系统时间。

有没有办法(可能通过ntpq)告诉ntpd:“跳到你认为合适的任何时间”?

具体来说,它应该是一个“如果同步则跳转”动作。

killall -HUP ntpd && ntpd -g如果可能或等效命令,我想避免

ntpd
  • 2 个回答
  • 387 Views
Martin Hope
nbamboo
Asked: 2018-09-28 07:06:47 +0800 CST

有什么办法可以防止chrony stratum加一吗?

  • 0

使用chrony时,我从stratum=2的时钟源同步时间。有什么办法可以防止我的机器stratum=3,但是stratum等于2?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~

这是我的机器

MS Name/IP address          Stratum  Poll Reach LastRx Last sample
=====================================================================================
^* 10.211.55.22                   3     6   377    51   -1374us[-2993us]  +/-   179ms

这是外部时钟源

MS Name/IP address          Stratum  Poll Reach LastRx Last sample
=====================================================================================
^* cn.ntp.faelix.net               2   7    377   129    +231us[+2929us]  +/-   216ms

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~

synchronization ntpd
  • 1 个回答
  • 328 Views
Martin Hope
Prasad
Asked: 2018-07-03 21:19:36 +0800 CST

在 Tiny Core Linux 中监控 Busy Box NTPD

  • 2

我在虚拟设备中使用带有 Tiny Core Linux 的 Busy Box。我可以使用运行 NTP 守护程序

/usr/sbin/ntpd -p pool.ntp.org

问题是它没有向/var/log/ntp.log 输出任何日志。我在寻找错误的日志位置吗?确认 ntpd 正常运行的最佳方法是什么?(目前,我可以确认 ntpd 正在运行的唯一方法是验证进程是否正在运行)。我也尝试使用详细选项。

/usr/sbin/ntpd -d -p pool.ntp.org
busybox ntpd
  • 1 个回答
  • 4062 Views
Martin Hope
Victor
Asked: 2018-02-05 18:15:45 +0800 CST

如何使用我的本地时间作为 `ntpd` 的唯一参考?

  • 3

我想让我的 Linux 设备将其本地时间与另一台 Linux 服务器的本地时间同步,而无需任何其他参考。我不在乎实际时间。我想要我的假时间。因此我不需要任何其他 ntp 服务器作为参考。例如,我只是将我的 Linux 服务器的本地时间设置1.2.3.4为2033-02-23 15:23:10. 这次我想让我的 Linux 设备同步。/etc/ntp.confLinux服务器上的配置文件是:

restrict 127.0.0.1 
restrict ::1

server 127.127.1.1
fudge  127.127.1.1 stratum 8

disable monitor
logfile /var/log/ntp/ntp.log
pidfile /var/run/ntpd.pid
driftfile /var/lib/ntp/drift
leapfile /etc/ntp.leapseconds

在 Linux 客户端上,我键入ntpdate 1.2.3.4,然后它给了我错误:

 5 Feb 08:26:39 ntpdate[31059]: no server suitable for synchronization found

这是为什么?我已经测试了-d参数 ie ./ntpdate -d 1.2.3.4,它说:

 5 Feb 08:40:54 ntpdate[22958]: ntpdate [email protected] Mon Feb  5 10:02:23 UTC 2018 (1)
Looking for host 1.2.3.4 and service ntp
host found : 1.2.3.4
transmit(1.2.3.4)
receive(1.2.3.4)
transmit(1.2.3.4)
receive(1.2.3.4)
transmit(1.2.3.4)
receive(1.2.3.4)
transmit(1.2.3.4)
receive(1.2.3.4)
1.2.3.4: Server dropped: strata too high
server 1.2.3.4, port 123
stratum 16, precision -23, leap 11, trust 000
refid [1.2.3.4], delay 0.02573, dispersion 0.00000
transmitted 4, in filter 4
reference time:    00000000.00000000  Thu, Feb  7 2036 14:28:16.000
originate timestamp: de22269c.ab72b039  Mon, Feb  5 2018  8:41:00.669
transmit timestamp:  de22269c.ab0e1fba  Mon, Feb  5 2018  8:41:00.668
filter delay:  0.02579  0.02574  0.02573  0.02574 
         0.00000  0.00000  0.00000  0.00000 
filter offset: 0.001443 0.001416 0.001417 0.001418
         0.000000 0.000000 0.000000 0.000000
delay 0.02573, dispersion 0.00000
offset 0.001417

 5 Feb 08:41:00 ntpdate[22958]: no server suitable for synchronization found

它有什么问题?我怎么解决这个问题?


PS版本信息:

服务器:

[xxxx@xxxx:~]$ /usr/sbin/ntpd --version
ntpd [email protected] Mon Feb  5 10:02:23 UTC 2018 (1)

客户:

[xxxx@xxxx:~]$ ./ntpdate -v
 5 Feb 08:36:40 ntpdate[15840]: ntpdate [email protected] Mon Feb  5 10:02:23 UTC 2018 (1)
 5 Feb 08:36:40 ntpdate[15840]: no servers can be used, exiting
ntp ntpd
  • 2 个回答
  • 4882 Views

Sidebar

Stats

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

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve