0

I do not understand the output of ntpd.

My question: Is the server foohost able to get the time from 30.251.32.1?

Here is my config:

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

Restart: systemctl restart ntpd.service

Logging:

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.

Is the server foohost able to get the time from 30.251.32.1?

guettli
  • 3,591
  • 17
  • 72
  • 123
  • Read through [this document](https://www.cyberciti.biz/faq/linux-unix-bsd-is-ntp-client-working/) and if still unsure, can you post the output of the commands listed there? – Tommiie Aug 24 '18 at 08:12
  • Wait (at least) five minutes after restarting the service and then `ntpq -np`. Add result to your question. – roaima Aug 24 '18 at 08:20
  • Make that `ntpq -npc rv` (assuming your ntpq supports that syntax), so that local clock diagnostics are included. – Paul Gear Aug 25 '18 at 04:15

2 Answers2

3

If @Sirch's answer is too hard to read, you can always use ntpstat.

E.g.:

> ntpstat
synchronised to NTP server (185.233.106.45) at stratum 3
   time correct to within 39 ms
   polling server every 1024 s

Or even "easier": timedatectl status.

> 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

Of course you still have to know some basics.

Lenniey
  • 5,220
  • 2
  • 18
  • 29
2

An easy way to see would be:

ntpq -c peers 

Youll see which servers are contacted, how long ago, and how many times they responded in the last 15 attempts.

Sirch
  • 5,785
  • 4
  • 20
  • 36