Install NTP on your home server
sudo apt-get install ntp
Bare in mind that I’m in the UK so I’m obviously I’m going to choose NTP servers that are geographically close to me.
After reading a fair bit about configuring ntp safely, what to include and what to block. My server is now serving all the machines on my home network.
My /etc/ntp.conf now looks like this.
ntp.conf file below.
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
# Enable this if you want statistics to be logged.
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
# You do need to talk to an NTP server or two (or three).
restrict 0.uk.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 1.uk.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 2.uk.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 3.uk.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details. The web page <http: //support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.
# By default block connections from unauthorized hosts
# restrict default ignore
# restrict -6 default ignore
# By default, exchange time with everybody, but don't allow configuration.
# restrict -4 default kod notrap nomodify nopeer noquery
# restrict -6 default kod notrap nomodify nopeer noquery
# restricted to my subnet without cryptograpically authentication
# This does work
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Not sure if this works
# restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap nopeer
# restrict -6 2001:838:0:1:: mask ffff:ffff:ffff:ffff:: nomodify notrap nopeer
# Local users may interrogate the ntp server more closely.
# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
# restrict 192.168.1.0 mask 255.255.255.0 notrust
# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
# broadcast 192.168.1.255
# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines. Please do this only if you trust everybody on the network!
Now that we have a server list in the /etc/ntp.conf, it’s time to run the daemon and see if it synchronsize properly. Make sure you have and active internet connection, then run the following command
sudo /etc/init.d/ntp restart
Next to monitor the server to see if it synchronized with a time server.
[code lang=”bash”]tail -f /var/log/syslog[/code]
Give it 20-30 seconds, but if all is going well you should see a message similar to this.
[code lang=”bash”]Oct 26 16:43:05 Orion ntpd: synchronized to 2001:470:9779:1:225:22ff:fe68:9836, stratum 2
Oct 26 16:45:17 Orion ntpd: synchronized to 126.96.36.199, stratum 2