首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ntp是否有效?

ntp是否有效?
EN

Server Fault用户
提问于 2018-08-24 08:07:44
回答 2查看 2.7K关注 0票数 0

我不明白ntpd的输出。

我的问题是:服务器foohost是否能够从30.251.32.1获得时间?

这是我的配置:

代码语言:javascript
复制
foohost:/var/log # cat /etc/ntp.conf 
tinker panic 0
disable monitor
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
driftfile /var/lib/ntp/drift/driftfile
broadcastdelay 0.008
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
server 30.251.32.1 version 2

重新启动: systemctl重新启动ntpd.service

伐木:

代码语言:javascript
复制
Aug 24 10:02:36 foohost systemd[1]: Stopping NTP Server Daemon...
Aug 24 10:02:37 foohost systemd[1]: Stopped NTP Server Daemon.
Aug 24 10:02:37 foohost systemd[1]: Starting NTP Server Daemon...
Aug 24 10:02:37 foohost ntpd[28272]: ntpd 4.2.8p10@1.3728-o Thu May 18 14:01:20 UTC 2017 (1): Starting
Aug 24 10:02:37 foohost ntpd[28272]: Command line: /usr/sbin/ntpd -p /var/run/ntp/ntpd.pid -g -u ntp:ntp -c /etc/ntp.conf
Aug 24 10:02:37 foohost ntpd[28273]: proto: precision = 0.053 usec (-24)
Aug 24 10:02:37 foohost ntpd[28273]: restrict default: KOD does nothing without LIMITED.
Aug 24 10:02:37 foohost ntpd[28273]: restrict ::: KOD does nothing without LIMITED.
Aug 24 10:02:37 foohost ntpd[28273]: Listen and drop on 0 v6wildcard [::]:123
Aug 24 10:02:37 foohost ntpd[28273]: Listen and drop on 1 v4wildcard 0.0.0.0:123
Aug 24 10:02:37 foohost ntpd[28273]: Listen normally on 2 lo 127.0.0.1:123
Aug 24 10:02:37 foohost ntpd[28273]: Listen normally on 3 eth0 30.251.32.11:123
Aug 24 10:02:37 foohost ntpd[28273]: Listen normally on 4 eth0:byoip 10.172.19.11:123
Aug 24 10:02:37 foohost ntpd[28273]: Listen normally on 5 lo [::1]:123
Aug 24 10:02:37 foohost ntpd[28273]: Listen normally on 6 eth0 [fe80::250:56ff:fe30:94%2]:123
Aug 24 10:02:37 foohost ntpd[28273]: Listening on routing socket on fd #23 for interface updates
Aug 24 10:02:37 foohost start-ntpd[28267]: Starting network time protocol daemon (NTPD)
Aug 24 10:02:37 foohost systemd[1]: Started NTP Server Daemon.

服务器页主机能够从30.251.32.1获得时间吗?

EN

回答 2

Server Fault用户

发布于 2018-08-24 08:34:26

如果@Sirch的答案太难读,您可以始终使用ntpstat

例如:

代码语言:javascript
复制
> ntpstat
synchronised to NTP server (185.233.106.45) at stratum 3
   time correct to within 39 ms
   polling server every 1024 s

甚至“更容易”:timedatectl status

代码语言:javascript
复制
> timedatectl status
      Local time: Fri 2018-08-24 10:35:05 CEST
  Universal time: Fri 2018-08-24 08:35:05 UTC
        RTC time: Fri 2018-08-24 08:35:05
       Time zone: Europe/Berlin (CEST, +0200)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

当然,你还得了解一些基本知识。

票数 3
EN

Server Fault用户

发布于 2018-08-24 08:17:21

一种简单的观察方式是:

代码语言:javascript
复制
ntpq -c peers 

您将看到在过去的15次尝试中,与哪些服务器进行了联系,多久前,以及它们响应了多少次。

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/927801

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档