====== NTP Client/Server (chrony) Configuration ====== AstLinux now supports the [[https://chrony.tuxfamily.org|chrony]] package, a versatile implementation of the Network Time Protocol [[wp>Network_Time_Protocol|NTP]]. It can synchronize the system clock with NTP servers, and can also operate as an NTPv4 (RFC 5905) server and peer to provide a time service to other computers in the network. !!Note: AstLinux 1.2.9 or later is required for 'chrony' specific features!! ===== NTP Client Configuration ===== Select the Network Tab in the web interface.\\ {{:userdoc:ipv6-tunnel-network-tab.jpg?nolink|Network Tab}} Locate the "NTP Server" entry within **Network Time Settings:** Enter user defined NTP Servers (space separated) or select a regional "pool" server, “Save Settings”, then "Restart NTP Time" to apply. !!Tip ->!! Any changes to the "Timezone" selection within this entry requires a System Reboot to apply. ===== NTP Server Configuration ===== Nothing additional to configure, any local LAN interface device can use the LAN gateway address as an NTP server (UDP 123). !!Tip ->!! By default, the DHCP "ntp-server" options field provides the NTP server for each DHCP configured network segment. ===== Custom Configuration ===== By default a ''/etc/chrony.conf'' file is automatically generated from web interface settings. For most users this is sufficient, and recommended, providing automatic ''/etc/chrony.conf'' configuration tweaks over time. For advanced users who want addition control of the ''/etc/chrony.conf'' configuration, they can create a persistent ''/mnt/kd/chrony.conf'' file that will be automatically sym-linked to ''/etc/chrony.conf''. Using the CLI, here is a brief how-to on generating a custom configuration for chrony. Create a persistent ''/mnt/kd/chrony.conf'' file from the current automatically generated version: cp /etc/chrony.conf /mnt/kd/chrony.conf Now edit ''/mnt/kd/chrony.conf'' to your liking, probably delete the "Autogenerated" first line so it won't confuse you later. Now restart the NTP daemon with the new ''/mnt/kd/chrony.conf'' file: service ntpd stop service ntpd init !!Tip ->!! The web interface Network and Edit tab will support editing the ''/mnt/kd/chrony.conf'' file if it exists. If you want to specify a persistent driftfile, the destination directory must have ''ntp:ntp'' user/group privileges. For example: mkdir /mnt/kd/ntp chown ntp:ntp /mnt/kd/ntp Then in your custom ''/mnt/kd/chrony.conf'' file, edit the driftfile line to: driftfile /mnt/kd/ntp/chrony.drift Then restart the NTP daemon (as above) to apply the change. [[https://chrony.tuxfamily.org/documentation.html|Chrony Documentation]] ===== Statistics and Debugging Commands ===== The ''chronyc'' command connects to the ''chronyd'' daemon to retrieve useful information. If ''chronyc'' is entered by itself you will enter an interactive mode with a ''chronyc>'' prompt //(supports tab-completion of commands)//. Or just enter ''chronyc'' commands on the command line. !!Note ->!! Some ''chronyc'' commands can actively change the ''chronyd'' operation, so carefully choose what commands you issue. Below are some //safe// examples. \\ Display information about current sources: (append -v for verbose) chronyc sources Display statistics about collected measurements: (append -v for verbose) chronyc sourcestats Display system time information: chronyc tracking Report on clients that have accessed the server: chronyc clients Display a list of commands: chronyc help \\