debian

Getting NTP working on debian 10

Ive recently started working on a homelab to help with my OCSP certification. As part of that ive been building an esxi box, a pfsense box and a bunch of VMs. Heres how to get NTP working.

If you run

systemctl status systemd-timesyncd

that will give you youre current status. On a fresh install

root@apaloc:~# timedatectl
               Local time: Wed 2020-01-08 08:48:22 AEDT
           Universal time: Tue 2020-01-07 21:48:22 UTC
                 RTC time: Tue 2020-01-07 21:48:22
                Time zone: Australia/Melbourne (AEDT, +1100)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no

As you can see, system clock was not synced up. To have it show your current settings run

timedatectl show-timesync --all
LinkNTPServers=
SystemNTPServers=10.100.2.1
FallbackNTPServers=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
ServerName=10.100.2.1
ServerAddress=10.100.2.1
RootDistanceMaxUSec=5s
PollIntervalMinUSec=32s
PollIntervalMaxUSec=34min 8s
PollIntervalUSec=34min 8s
NTPMessage={ Leap=0, Version=4, Mode=4, Stratum=2, Precision=-23, RootDelay=17.639ms, RootDispersion=12.161ms, Reference=DCE99C1E, OriginateTimestamp=Wed 2020-01-08 08:40:44 AEDT, ReceiveTimestamp=Wed 2020-01-08 08:40:44 AEDT, TransmitTimestamp=Wed 2020-01-08 08:40:44 AEDT, DestinationTimestamp=Wed 2020-01-08 08:40:44 AEDT, Ignored=no PacketCount=18, Jitter=3.527ms }
Frequency=1078020

From there head over to

/etc/systemd  timesyncd.conf

where you can set your server

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See timesyncd.conf(5) for details.

[Time]
NTP= setserver.here
FallbackNTP=
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048

and finally run

systemctl restart systemd-timesyncd
Interesting || Helpful?
10

Leave a Reply

Your email address will not be published. Required fields are marked *