NTP client setup

No hype required

no need for that on XEN guests

Check with

cat /sys/devices/system/clocksource/clocksource0/available_clocksource
cat /sys/devices/system/clocksource/clocksource0/current_clocksource

and only proceed if you have tsc, hpet or whatever else than a virtualized clock e.g. xen

Install

Slackware

slackpkg search ntp-

Ubuntu

apt install nmap netcat ntpdate ntp ntpstat

Timezone

Slackware

ls -lF /etc/localtime*
rm -f /etc/localtime*
#ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime

Ubuntu

tzselect
dpkg-reconfigure tzdata

#timedatectl set-timezone Europe/Paris
timedatectl set-timezone Europe/Moscow

cat /etc/timezone
#echo 'Europe/Paris' > /etc/timezone
#echo 'Europe/Moscow' > /etc/timezone

#ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime
ls -lhF /etc/localtime*

Preliminary shot

ntpsrv=ntp.obspm.fr
#ntpsrv=ru.pool.ntp.org
#ntpsrv=ntp.ix.ru
#ntpsrv=fr.pool.ntp.org

ping -c1 $ntpsrv
nmap -sU -p123 $ntpsrv

#ubuntu
systemctl stop ntp

#slackware
ls -lF /etc/rc.d/rc.ntpd
#/etc/rc.d/rc.ntpd stop

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

Continuous time sync

Warning: see ntpd if this host is a node member of a cluster farm

mv -i /etc/ntp.conf /etc/ntp.conf.dist
egrep -v '^[[:space:]]*(#|$)' /etc/ntp.conf.dist > /etc/ntp.conf
vi /etc/ntp.conf

server $ntpsrv iburst

Slew range 128 –> 600 seconds

happy-happy Pacemaker and Dovecot

Slackware (14.2 and current)

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

#14.2
CMDLINE="/usr/sbin/ntpd -g -x"

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

chmod +x /etc/rc.d/rc.ntpd 

Ubuntu

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

NTPD_OPTS='-g -x'

#cat /etc/systemd/timesyncd.conf
systemctl start ntp
systemctl enable ntp

Note that dhclient settings may override those.

Ready to go

Slackware

/etc/rc.d/rc.ntpd restart

Ubuntu

timedatectl status
ntpstat

UNIX

ps auxww | grep ntp
ntpq -p
#ntpq -pn

The jitter should be low, otherwise check the driftfile.

And eventually sync the hardware clock again, once in a while. That should happen at system’s shutdown anyhow.

hwclock --utc --systohc

Resources

“ntpq -p” output http://nlug.ml1.co.uk/2012/01/ntpq-p-output/831

3.3. Clock Quality http://www.ntp.org/ntpfaq/NTP-s-sw-clocks-quality.htm

Xen domU VM time drifts out of sync with dom0 and other domU - IBM System x https://www.ibm.com/support/pages/xen-domu-vm-time-drifts-out-sync-dom0-and-other-domu-ibm-system-x


HOME | GUIDES | BENCHMARKS | html