Time Config

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,

timedatectl set-timezone Europe/Moscow
#timedatectl set-timezone Europe/Paris
dpkg-reconfigure tzdata
cat /etc/timezone
#echo 'Europe/Moscow' > /etc/timezone
#echo 'Europe/Paris' > /etc/timezone
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

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,

ntpq -p
#ntpq -pn

Notes.

references