Linux ntp
Jump to navigation
Jump to search
New NTP packages
sudo update-rc.d -f ntpdate remove -remove deprecated ntpdate service sudo apt-get install ntp
Show ntp logs
cat /var/log/messages | grep ntp
Show RTC (Real Time Clock) hardware clock
sudo hwclock --show hwclock -r hwclock --show --utc
Sync system clock -> hardware clock
sudo hwclock --systohc
Sync hardware clock -> system clock
hwclock --hctosys
Troubleshooting NTP server
sudo tcpdump port 123 #enable ntp packet logging timedatectl status ntpdc -p #offset in seconds ntpq -p #offset in milliseconds
ntpq --numeric --peers #show peers (time providers) ntpq -c lpeer #show peers (time providers) ntpq -d <time_server> #debugging mode (not sure if will update local clock) ntpdate -d <time_server> #debugging mode, in which ntpdate will go through all the steps, but doesn't adjust the local clock ntpstats ntpdate -s a_stratum_1_server_address
ntpdc -c loopinfo #will display the combined offset in seconds, as seen at the last poll ntpdc -c kerninfo #will display the current remaining correction, just as ntptime does
Show difference/offset between local and remote time server
ntpdate -q <time_server> #just query NTP server and it will display time difference/offset