NTP Servers

Multicast Server

we dont talk to strangers

except to our lan

and upstream

Localhost users could be allowed to interrogate the ntp server more closely.

ntpd may needs to be instructed to stay away from interfaces we enslaved in bridges and link aggregation.

And only use the ones we want

Multicast server

ntpd can operate as unicast server for any permitting restriction, an additional directive is used to produce autonomous multicasts sent out of the specified interface, with the source IPv6 address of that interface.

Although extra lines might be added to send from other interfaces, it is neater to decide on a primary source interface, specified here, and copy to others with smcroute

If autokey is configured, instead:

Client directives

Recently it has been possible to add mostly any ntp.conf file rule whilst ntpd is running. This is most useful to add client lines as these require a connection to the associated server to be live to work.

Using a script from NetworkManager dispatcher directory, or dhcp client, to prod ntpd when the interface is ready

ntpdc wants to open /dev/tty to get your password, but it can be tricked with expect.

  1. PASSWORD=$(grep ^8 /var/lib/ntp/ntp.keys | cut -f3)
  2. /usr/bin/expect -c $' spawn ntpdc -c "keyid 8" -c ":config multicastclient ff05:101%${IFACE}"; expect "MD5 Password:"; send "'${PASSWORD}'\r"; expect "done!" ' > /dev/null

Change multicastclient ff05:101%${IFACE} to a line like pool ntp.example for a unicast client

GPSD client

Example for option gsm card

Though it does not need a sim card in it for the gps receiver to work, ModemManager might not like that idea so it has to be activated manually.

/etc/gpsd/device-hook

Can try activating via gpsdctl add /dev/ttyHS1 or manually

  1. #!/bin/sh
  2. # date --utc "+AT_OGCLK=\"%g/%m/%d,%H:%M:%S\""
  3. if test "`cat /sys/class/tty/${1##/dev/}/hsotype`" = "GPS"
  4. then
  5. for N in /dev/ttyHS?
  6. do
  7. if test "$N" = "/dev/ttyHS?"
  8. then
  9. break
  10. fi
  11. if test "`cat /sys/class/tty/${N##/dev/}/hsotype`" = "GPS Control"
  12. then
  13. if test "$2" = "ACTIVATE"
  14. then
  15. /usr/sbin/chat -V -f /etc/gpsd/gps-up.chat -T `date --utc +"\"%g/%m/%d,%H:%M:%S\""` <$N >$N
  16. fi
  17. if test "$2" = "DEACTIVATE"
  18. then
  19. /usr/sbin/chat -V -f /etc/gpsd/gps-down.chat <$N >$N
  20. fi
  21. fi
  22. done
  23. fi

gps-up.chat

  1. ABORT ERROR
  2. TIMEOUT 10
  3. "" ATZ
  4. OK "AT_OGCLK=\T"
  5. OK "AT_OGPSP=7,1^m"
  6. OK "AT_OGPS=2^m"
  7. OK "AT_OGPSEVT=1^m"
  8. OK ""

gps-down.chat

  1. ABORT ERROR
  2. TIMEOUT 10
  3. "" ATZ
  4. OK "AT_OGPS=0^m"
  5. OK ""

Extra lines for ntp.conf