Legacy NTP Client Setup

the following is outdated (was the old NTP daemon) – rather enfavor openntpd or chrony

AS A WEEKLY SHOT

slackware

    slackpkg search ntp

ubuntu

apt install ntpdate

shared

first shot sync the hardware clock and then as a weekly cron job

    ntp=...

    ntpdate $ntp
    # -u
    hwclock --utc --systohc

AS A DAEMON

eventually enable the daemon to keep in sync. note we are keeping the first server lines pointing to local time. we should ideally put at least two servers but we then use peers anyhow.

slackware

    slackpkg search ntp
    slackpkg search libedit # ntpq

increase the slew range for e.g. pacemaker and dovecot to he happy

    cp -pi /etc/rc.d/rc.ntpd /etc/rc.d/rc.ntpd.dist
    chmod -x /etc/rc.d/rc.ntpd.dist
    chmod +x /etc/rc.d/rc.ntpd
    vi /etc/rc.d/rc.ntpd

    echo -n "Starting NTP daemon"
    /usr/sbin/ntpd -x -g -u ntp:ntp

    ls -lF /etc/rc.d/rc.ntpd*
    /etc/rc.d/rc.ntpd restart

ubuntu

apt install ntpdate ntp ntpstat

increase the slew range for e.g. pacemaker and dovecot to he happy

    cp -pi /etc/default/ntp /etc/default/ntp.dist
    vi /etc/default/ntp

    NTPD_OPTS='-g -x'

    systemctl restart ntp
    systemctl status ntp
    systemctl enable ntp

    ntpstat

note dhclient settings may override those.

    #cat /etc/systemd/timesyncd.conf

shared

    mv -i /etc/ntp.conf /etc/ntp.conf.dist
    grep -vE '^[[:space:]]*(#|$)' /etc/ntp.conf.dist > /etc/ntp.conf.clean
    grep -vE '^[[:space:]]*(#|$)' /etc/ntp.conf.dist > /etc/ntp.conf
    cat >> /etc/ntp.conf <<EOF

    server $ntp iburst

    EOF

also see daemons/ntpd if this host is a node member of a cluster farm of some sort.

    pgrep -a ntp
    ntpq -p
    # -n

the jitter should be low, otherwise check the driftfile.

and eventually sync the hardware clock once in a while. that should happen at system’s shutdown anyhow.

    hwclock --utc --systohc

HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun