OpenNTPD

From Gentoo Wiki
Jump to: navigation, search
Resources

OpenNTPD is a lightweight NTP server ported from OpenBSD.

Installation

USE flags

USE flags for net-misc/openntpd Lightweight NTP server ported from OpenBSD

libressl Enable HTTPS TLS time constraint support using dev-libs/libressl

Emerge

Install OpenNTPD:

root #emerge --ask net-misc/openntpd

Service

OpenRC

Start the ntp daemon:

root #/etc/init.d/ntpd start

Add the ntp daemon to the default runlevel:

root #rc-update add ntpd default

systemd

OpenNTPD does not work with systemd. See systemd-timesyncd instead.

Configuration

The default configuration file for OpenNTPD:

FILE /etc/ntpd.confGentoo's default configuration
# Addresses to listen on (ntpd does not listen by default)
#listen on *

# sync to a single server
#server ntp.example.org

# use a random selection of NTP Pool Time Servers
# see http://support.ntp.org/bin/view/Servers/NTPPoolServers
#servers pool.ntp.org

# use a specific local timedelta sensor (radio clock, etc)
#sensor nmea0

# use all detected timedelta sensors
#sensor *

# get the time constraint from a well-known HTTPS site
#constraints from "https://www.google.com/search?q=openntpd"

# Choose servers announced from Gentoo NTP Pool
servers 0.gentoo.pool.ntp.org
servers 1.gentoo.pool.ntp.org
servers 2.gentoo.pool.ntp.org
servers 3.gentoo.pool.ntp.org

For further information see the manpage:

user $man ntpd.conf

Server

FILE /etc/ntpd.confOpenNTPD listening on 192.0.2.1 address while syncing with multiple servers
# Addresses to listen on (ntpd does not listen by default)
listen on 192.0.2.1

# Choose servers announced from Gentoo NTP Pool
servers 0.gentoo.pool.ntp.org
servers 1.gentoo.pool.ntp.org
servers 2.gentoo.pool.ntp.org
servers 3.gentoo.pool.ntp.org
root #rc-service ntpd restart

Client

FILE /etc/ntpd.confOpenNTPD syncing with multiple servers
# Choose servers announced from Gentoo NTP Pool
servers 0.gentoo.pool.ntp.org
servers 1.gentoo.pool.ntp.org
servers 2.gentoo.pool.ntp.org
servers 3.gentoo.pool.ntp.org

Alternatively sync the client to a server on the local network:

FILE /etc/ntpd.confOpenNTPD syncing with a single server on the local network
# sync to a single server on the local network
server 192.0.2.1
root #rc-service ntpd restart

Checking the daemon operation

net-misc/openntp provides the /usr/sbin/ntpctl program to display information about the running ntpd daemon:

root #ntpctl -s all
4/4 peers valid, clock unsynced, clock offset is 1048.342ms

peer
   wt tl st  next  poll          offset       delay      jitter
185.19.184.35 0.gentoo.pool.ntp.org
    1 10  2   23s   34s        41.650ms   190.744ms   227.001ms
31.14.131.188 1.gentoo.pool.ntp.org
    1 10  2    2s   31s        15.834ms   132.072ms    92.419ms
212.45.144.3 2.gentoo.pool.ntp.org
    1 10  1    8s   33s        42.733ms   216.937ms   212.899ms
188.213.165.209 3.gentoo.pool.ntp.org
    1 10  2   19s   30s        45.672ms   228.337ms   240.018ms

The output shows how many servers the daemon is syncing with, the status of the system clock (synced/unsynced) and the clock offset. For further information see the manpage:

user $man ntpctl

See also