Cardano Node Time Synchronisation with Chrony

Time synchronisation between your block producers and relays is important. To ensure your times are correct you can use a service called crony to synchronise the server time with a global network of N

If you find this guide useful consider staking some Cardano to SHARD stakepool. It helps support us to keep creating content for Cardano Stakepool Operators and other Crypto

First, you need to install crony on your server

sudo apt-get install chrony -y

Then update the crony configuration file

Note you can find a good list of NTP servers here such as:

  • time.google.com

  • time.cloudflare.com

  • time.facebook.com

  • time.windows.com

  • time.apple.com

  • pool.ntp.org

  • tick.usno.navy.mil

  • au.pool.ntp.org

A bit of info about the crony configuration is below. Some parts are default and won't be covered.

pool name [option] - specifies a pool of ntp servers instead of a specific server. For example, if you wanted to use a specific server such as time-d-b.nist.gov you could instead use the server name [option] directive.

iburst - sets the first 4 polling periods to 2 seconds to allow crony to synchronise quickly on startup

minpoll - sets the minimum polling period. To calculate the crony minpoll or maxpoll seconds you can use the following formula 2^4=16 i.e. a minpoll period of 4 = 16 seconds. Some guides have minpoll as low as 1 (2 seconds); however, the crony specifications and general guidance online is that the lowest you want to go is 2 (4 seconds) and that requires your NTP server to be colocated within the same datacentre or general location. i.e. if you were using AWS Sydney you'd want the NTP server to also be on AWS in Sydney. There is also the possibility that if you set it too low you will be hammering the NTP server and will eventually be blocked due to denial of service protections. Generally, if you aren't sure you may want to try a higher minpoll and maxpoll. The defaults are 4 and 6 respectively.

maxpoll - sets the maximum polling period. Same format as minpoll.

cat > $HOME/chrony.conf << EOF
pool au.pool.ntp.org        iburst minpoll 2 maxpoll 4 maxsources 3
pool time.cloudflare.com       iburst minpoll 2 maxpoll 4 maxsources 3
pool time.google.com       iburst minpoll 2 maxpoll 4 maxsources 3

# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
keyfile /etc/chrony/chrony.keys

# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift

# Uncomment the following line to turn logging on.
#log tracking measurements statistics

# Log files location.
logdir /var/log/chrony

# Stop bad estimates upsetting machine clock.
maxupdateskew 5.0

# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
rtcsync

# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 0.1 -1
EOF

Now move the config to the correct location so that crony will read it

sudo mv $HOME/chrony.conf /etc/chrony/chrony.conf

And restart the crony service

sudo systemctl restart chronyd.service

Rince and repeat on your other nodes / block producer / relays to ensure all of them are in sync

Also make sure you have added rules to your firewall to allow the udp traffic on port 123. If you are using ubuntu with ufw then you can run the following command

sudo ufw allow 123

If you are using AWS Security Groups you will need to configure it in the AWS console; however, AWS typically allows NTP by default across Security Groups. Something like Vultr doesn't have a built-in outbound firewall so you will need to configure ufw or similar on the node itself.

Last updated