First, make sure your system has the right time itself. You should therefore have the ntp
or ntpd
package installed and configured as a client.
Now simply add a restrict line without nopeer
nor noquery
against the subnetwork you want to. The additional mode7
is required for the deprecated ntpdc
client program to work.
vi /etc/ntp.conf restrict 127.0.0.1 restrict x.x.x.x mask 255.255.255.0 nomodify notrap restrict ::1 enable mode7
Don’t forget to setup the local clock as a fail-over, if internet connection goes down, so you still provide the service,
server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10 #server 127.127.1.1 # LCL, local clock #fudge 127.127.1.1 stratum 12 # increase stratum
and also don’t forget to run hwclock --utc --systohc
once in a while.
restart ntpd
and call the local daemon (mode7
),
ntpdc -l ntpdc -c sysinfo
How to Install and Configure Linux NTP Server and Client http://www.thegeekstuff.com/2014/06/linux-ntp-server-client/
\7. Reference Clocks http://www.ntp.org/ntpfaq/NTP-s-refclk.htm
Reference Clock Support http://doc.ntp.org/current-stable/refclock.html
enable mode7 http://doc.ntp.org/current-stable/miscopt.html#enable
Reference Clock Commands and Options http://doc.ntp.org/current-stable/clockopt.html
Undisciplined Local Clock http://doc.ntp.org/current-stable/drivers/driver1.html
ntpdc - special NTP query program http://doc.ntp.org/current-stable/ntpdc.html
Network Time Protocol (NTP) https://www.meinbergglobal.com/english/info/ntp.htm
14.6. Basic NTP configuration http://www.tldp.org/LDP/sag/html/basic-ntp-config.html
HOWTO ensure your clock is accurate and showing the correct time using the Network Time Protocol http://en.linuxreviews.org/NTP_-_Howto_make_the_clock_show_the_correct_time
6.3. Various Tricks http://www.ntp.org/ntpfaq/NTP-s-config-tricks.htm
ntp.conf — Network Time Protocol (NTP) daemon configuration file format https://www.gsp.com/cgi-bin/man.cgi?section=5&topic=ntp.conf#Miscellaneous_Options
The NTP “ntpdc” shell command “peers” returns “localhost: timed out, nothing received” https://askubuntu.com/questions/799759/the-ntp-ntpdc-shell-command-peers-returns-localhost-timed-out-nothing-rec