Linux – Set up an NTP server to allow local machines to be syncronised for Linux

linuxntptime

I am trying to set up a machine to act as an ntp server to which the other local machines will syncronise their times to. This needs to happen regardless of whether the ntp server machine is connected to the internet, i.e: it is not important that the time is correct, just that the machines are synchronised with each other.

My configuration files are as follows:

NTP server /etc/ntp.conf

driftfile /var/lib/ntp/ntp.drift

server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 10

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

restrict 127.0.0.1
restrict ::1

NTP client /etc/ntp.conf

driftfile /var/lib/ntp/ntp.drift

server 192.168.1.146 iburst

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

restrict 127.0.0.1
restrict ::1

I change the time on the server
I then run the ntp server with sudo /etc/init.d/ntp start
And try test that the client can receive an ntp update with sudo ntpdate 192.168.1.146

This works, but only when connected to the Internet (even though the master has the time set by my command and not from an external ntp server/s).

Anything in my configuration files wrong? Any step I am missing?

Best Answer

I provided a detailed answer, some time back, of how we do exactly what you're looking to do in our data centers. Not much has changed since I made that post.

Link to the post:

Using NTP to sync a group of linux servers to a common time source