The sys admin's daily grind: Ntpd
Borrowed Time
The Network Time Protocol keeps Charly up to date at all times. To put all of this punctuality in the service of the common good, he even exports the time signal.
If the clock on my personal laptop is a few seconds fast or slow, this is not dramatic. On a server, however, it's different. Logfiles should – at least – be synchronized to the exact second; otherwise, troubleshooting becomes a pain. The software that handles this synchronization is, of course, the NTP daemon (ntpd
) [1]. As a special hardware time source, you could use a suitable DCF 77 or GPS receiver, for example. If you don't have one of those, you could ask some other time servers – you need to poll several to compute the time from the running time differences of the UDP packets on the network.
The NTP configuration in the /etc/ntp.conf
file on my Ubuntu lab machine lists five time servers:
server ntps1-0.cs.tu-berlin.de iburst server ptbtime1.ptb.de iburst server ntp1.fau.de iburst server ntp.probe-networks.de iburst # Use Ubuntu's ntp server as a fallback. server ntp.ubuntu.com
The iburst
("initial burst") keyword speeds up synchronization on the first connection. A list of public time servers is available online [2].
Borrowed Time
Just to check, I entered ntpq-p
at the command line; this returned a list of all the time servers that my daemon contacted (Figure 1). The first column shows how reliable the time sources are: An asterisk (*
) denotes the current reference server. A plus sign means that the time from this server is used to compute the mean value. Servers with a minus sign have recently supplied times with too large of a deviation – if this problem were to exist permanently, I would need to delete them from the configuration.
Sharing Free Time
Furthermore, nothing prevents me from providing my time server to others. The expected traffic is minimal, and the safety risks are also minimal if this setup is configured correctly. Specifically, in /etc/ntp.conf
, I need to stipulate that external NTP clients can retrieve time information but not configure anything. The following lines do the trick:
restrict -4 default kod notrap nomodifynopeer noquery restrict -6 default kod notrap nomodifynopeer noquery
If you do not use IPv6, you can leave out the second line, of course.
How do other users learn about my time server? The best way is to add it to a popular time network like pool.ntp.org [3]. A working ntpd is the only prerequisite for time servers; you can complete a web form for the actual entries. The more people to join, the less the load per server, and most importantly: We all have more free time (Figure 2).
Infos
- NTP daemon: http://www.eecis.udel.edu/~mills/ntp/html/ntpd.html
- List of public time servers: http://support.ntp.org/bin/view/Servers/WebHome#Browsing_the_Lists
- Time server network ntp.org: http://www.pool.ntp.org/en/join.html
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.