Time Setup

Warning: the hardware clock does not need to be updated on XEN guests. NTP can be used to keep the system clock in sync, though.

requirements

ubuntu,

apt install nmap netcat ntpdate ntp ntpstat

slackware,

ls -l /var/log/packages/ntp-*
#slackpkg install ntp

timezone

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*

slackware,

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

one shot

ntpsrv=0.ru.pool.ntp.org
#ntpsrv=ntp.obspm.fr
ping -c1 $ntpsrv
nmap -sU -p123 $ntpsrv

#ubuntu
systemctl stop ntp

#slackware
/etc/rc.d/rc.ntpd stop

ntpdate -u $ntpsrv
hwclock --systohc

continuous time sync

mv -i /etc/ntp.conf /etc/ntp.conf.dist
sed '/^$/d;/^#/d;' /etc/ntp.conf.dist > /etc/ntp.conf
vi /etc/ntp.conf

server 0.ru.pool.ntp.org iburst
server 1.ru.pool.ntp.org iburst
server 2.ru.pool.ntp.org iburst
server 3.ru.pool.ntp.org iburst

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

#happy pacemaker and dovecot with -x: slew up to 600 seconds
NTPD_OPTS='-g -x'

ubuntu,

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

note. dhclient settings my override those.

slackware,

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

ready to go

ubuntu,

timedatectl status
ntpstat

common,

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

The jitter should be low, otherwise check the driftfile.

references


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml