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
    • 最新
    • 标签
主页 / server / 问题 / 913968
Accepted
BentCoder
BentCoder
Asked: 2018-05-28 00:12:07 +0800 CST2018-05-28 00:12:07 +0800 CST 2018-05-28 00:12:07 +0800 CST

NTP 似​​乎没有在 Debian Jessie 中启用和同步

  • 772

当我在 Ubuntu 中按照以下步骤操作时,NTP 已启用并同步。然而,在 Debian Jessie 中情况正好相反。有人知道 Debian 说“不”的原因吗?由于“当地时间”是正确的,我还应该担心吗?

采取的步骤

$ timedatectl set-timezone Europe/London

$ sudo apt-get install -y ntp

$ cat /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
server 0.uk.pool.ntp.org iburst
server 1.uk.pool.ntp.org iburst
server 2.uk.pool.ntp.org iburst
server 3.uk.pool.ntp.org iburst
restrict 127.0.0.1
restrict ::1

$ service ntp stop
$ ntpd -gq
$ service ntp start

$ systemctl enable ntp
$ systemctl restart ntp

Debian 状态

$ timedatectl
      Local time: Sun 2018-05-27 08:57:32 BST
  Universal time: Sun 2018-05-27 07:57:32 UTC
        RTC time: Sun 2018-05-27 07:57:30
       Time zone: Europe/London (BST, +0100)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2018-03-25 00:59:59 GMT
                  Sun 2018-03-25 02:00:00 BST
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2018-10-28 01:59:59 BST
                  Sun 2018-10-28 01:00:00 GMT


$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+h88-150-240-202 217.114.59.66    3 u   36   64    1   10.349   -1.919   0.882
*ntp3.wirehive.n 195.66.241.2     2 u   33   64    3   13.717   -0.094   1.398
+ns1.do.steersne 195.66.241.3     2 u   32   64    3    9.994   -1.230   0.947

Ubuntu 状态

$ timedatectl
      Local time: Sun 2018-03-14 10:51:48 GMT
  Universal time: Sun 2018-03-14 10:51:48 UTC
        RTC time: Sun 2018-03-14 10:51:46
       Time zone: Europe/London (GMT, +0000)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no
ntp
  • 1 1 个回答
  • 3940 Views

1 个回答

  • Voted
  1. Best Answer
    Thomas
    2018-05-28T01:42:17+08:002018-05-28T01:42:17+08:00

    要启用时间同步,timedatectl请使用以下命令。

    timedatectl set-ntp true
    

    这将启用该systemd服务systemd-timesyncd.service。从man timedatectl.

    set-ntp [BOOL]
         Takes a boolean argument. Controls whether network time synchronization is active and enabled (if
         available). This enables and starts, or disables and stops the systemd-timesyncd.service unit. It does not
         affect the state of any other, unrelated network time synchronization services that might be installed on
         the system. This command is hence mostly equivalent to: systemctl enable --now systemd-timesyncd.service
         and systemctl disable --now systemd-timesyncd.service, but is protected by a different access policy.
    
         Note that even if time synchronization is turned off with this command, another unrelated system service
         might still synchronize the clock with the network. Also note that, strictly speaking,
         systemd-timesyncd.service does more than just network time synchronization, as it ensures a monotonic
         clock on systems without RTC even if no network is available. See systemd-timesyncd.service(8) for details
         about this.
    

    因此,例如ntp或chrony已经在运行但timedatectl可能没有意识到这一点是可能的。

    此外,您可能必须配置您的 NTP 服务器,/etc/systemd/timesyncd.conf除非您通过 DHCP 获取您的 NTP 服务器,或者它们也可能在相应的配置中进行systemd-networkd.service配置。有关详细信息,请参阅man systemd-timesyncd.service。

    • 4

相关问题

  • 网络时间服务器的 DHCP 选项

  • 公共 NTP 服务器

  • 时间同步和计划任务

  • 时间漂移

  • Windows Server 无法可靠地同步 NTP 时间

Sidebar

Stats

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

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve