Apologies for the confusion. You are correct; the ignore directive is not used to ignore specific servers by name in chrony. Instead, chrony uses the stratum and minstratum options to control server selection based on stratum levels, but it doesn’t provide a direct way to ignore a server by name.
To enforce that chrony does not use time.cloudflare.com, you would need to ensure that it is not included in your chrony.conf file and monitor its usage to make sure it doesn’t get added inadvertently.
Here’s how you can approach this:
-
Remove the Server from Configuration: Ensure that time.cloudflare.com is not listed in your chrony.conf file.
-
Monitor Sources: Regularly check the NTP sources chrony is using to ensure time.cloudflare.com is not being used.
Example Configuration
Ensure your chrony.conf does not include time.cloudflare.com:
# chrony.conf
# Use specific NTP servers
server time.google.com iburst
server pool.ntp.org iburst
# Define drift file
driftfile /var/lib/chrony/drift
# Enable NTP client/server mode
allow 192.168.0.0/16 # Allow NTP requests from this subnet
bindcmdaddress 192.168.0.0 # Bind command interface to this address
# Logging
logdir /var/log/chrony
log tracking measurements statistics
# Other options...
Monitoring Sources
You can use the following script to check if chrony is using time.cloudflare.com and take action if necessary:
#!/bin/bash
# Check if time.cloudflare.com is being used by chrony
if chronyc sources -v | grep -q 'time.cloudflare.com'; then
echo "time.cloudflare.com is being used by chrony. Taking action to remove it."
# Add code here to take appropriate action, such as restarting chrony or modifying the configuration
else
echo "time.cloudflare.com is not being used by chrony."
fi
Taking Action
If you find that chrony is using time.cloudflare.com, you would need to investigate how it was added and ensure it is removed from the configuration. This might involve checking for any scripts or processes that might be dynamically adding NTP servers.
Conclusion
While chrony does not provide a direct ignore option for specific servers by name, you can achieve the desired effect by carefully managing your configuration and monitoring the NTP sources in use.