![]() Ntpd can be started by your network manager, so that the daemon only runs when the computer is online. etc/systemd/system//nf ĮxecStart=/usr/bin/hwclock -w Tips and tricks Start ntpd on network connection If the synchronized time should be written to the hardware clock as well, configure the provided unit as described in systemd#Editing provided units before starting it: This method is discouraged on servers, and in general on machines that run without rebooting for more than a few days. It can take several minutes before ntpd selects a server to synchronize with try checking after 17 minutes (1024 seconds).Īlternatively, enable rvice to synchronize time once (option -q) and non-forking (option -n) per boot, instead of running the daemon in the background. The servers ntpd is synchronizing with are prefixed by an asterisk. The delay, offset and jitter columns should be non-zero. Use ntpq to see the list of configured peers and status of synchronization: Executing timedatectl set-ntp 1 as root will inadvertedly stop a running rvice. Note: The systemd command timedatectl can only be used to control systemd-timesyncd. Lastly, specify the drift file (which keeps track of your clock's time deviation) and optionally the log file location:Ī very basic configuration file will look like this: Restrict -6 default kod limited nomodify notrap nopeer noquery If you want to force DNS resolution to the IPv6 namespace, write -6 before the IP address or host name ( -4 forces IPv4 instead), for example: If you want to change any of these, see the full docs for the "restrict" option in ntp.conf(5), the detailed ntp instructions and #Usage.įollowing this line, you need to tell ntpd what to allow through into your server the following line is enough if you are not configuring an NTP server: It will also block time synchronization since it blocks all packets except ntpq and ntpdc queries. You need to add noserve to stop serving time. Note: This still allows other people to query your time server. Restrict default kod limited nomodify notrap nopeer noquery This restricts everyone from modifying anything and prevents everyone from querying the status of your time server: nomodify prevents reconfiguring ntpd (with ntpq or ntpdc), and noquery is important to prevent dumping status data from ntpd (also with ntpq or ntpdc). Next, define the rules that will allow clients to connect to your service ( localhost is considered a client too) using the restrict command you should already have a line like this in your file: If setting up an NTP server, check that you have orphan mode enabled, so that, in case it loses internet access, it will continue serving time to the network enable orphan mode using the tos configuration parameter (you can set up to stratum 15) so that it will never be used unless internet access is lost: The burst option always does this, even on the first attempt, and should never be used without explicit permission and may result in blacklisting. The iburst option is recommended, and sends a burst of packets only if it cannot obtain a connection with the first attempt. ![]() if you want to use your country's servers with an option: Since ntp version 4.2.7.p465-2, Arch Linux uses its own default vendor pool of NTP servers provided by the NTP Pool Project (see FS#41700). Typically, stratum 2 servers are used for general synchronization purposes: if you do not already know the servers you are going to connect to, you should choose a server pool close to your location from the servers ( alternative link). It has to be understood that a server's stratum cannot be taken as an indication of its accuracy or reliability. NTP servers are classified in a hierarchical system with many levels called strata: the devices which are considered independent time sources are classified as stratum 0 sources the servers directly connected to stratum 0 devices are classified as stratum 1 sources servers connected to stratum 1 sources are then classified as stratum 2 sources and so on. The main daemon is ntpd, which is configured in /etc/ntp.conf. For server configuration, see #NTP server mode. You can skip to #Usage if you want to use the Arch Linux default configuration file for it. By default, ntpd works in client mode without further configuration. See System time#Time synchronization for other NTP implementations. This article further describes how to set up and run the NTP daemon, both as a client and as a server. The NTP Project provides a reference implementation of the protocol called simply NTP. The accuracy on local area networks is even better, up to one millisecond. It is designed to mitigate the effects of variable network latency and can usually maintain time to within tens of milliseconds over the public Internet. Network Time Protocol is the most common method to synchronize the software clock of a GNU/Linux system with internet time servers.
0 Comments
Leave a Reply. |