Linux: Setup ntp server


linux can, of course 🙂 , act as an ntp server.

For debian 9 the following steps are necessary.

Install requiered packages

root@debdev ~ # apt-get install ntp

Configure the time server to synchronize time from. For Germany I recommend to use the NTP Server from the “physikalisch-technische Bundesanstalt” and Telekom/t-online. Insert

pool iburst
pool iburst
pool iburst

and remove the preconfigured ones.

By default the ntp answers to all clients. If you want to restrict the computer who can contact your server add

restrict default ignore
restrict -6 default ignore

to your /etc/ntp.conf.
also ensure that this lines are set

restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

means by default only allow ntp queries and no server status information.
Then you have to add restriction entries for all subnets which can send time queries including server status (noquery not set)

restrict mask nomodify notrap nopeer

and if another time server should taken its time from your time servers

restrict nomodify notrap nopeer noquery

Enable and start ntpd

root@debdev ~ # systemctl enable ntp
root@debdev ~ # systemctl start ntp

Check from Windows

D:\> w32tm /stripchart /computer:

or from linux

root@debdev ~ #  apt-get install ntpdate
root@debdev ~ #  ntpdate -qv


Advertisment to support

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.