ClearFoundation Tracker - ClearOS
View Issue Details
0000371ClearOSapp-ntp - NTP Serverpublic2011-10-24 00:292013-08-14 19:12
devferret 
user2 
normalminoralways
closedfixed 
 
6.5.0 Beta 16.5.0 Beta 1 
0000371: ntpd will stop working when network interfaces change
My external interface uses pppoe; if that ever goes down and up again (which it does regularly, grrrr. ADSL grrr.) ntp stops being able to communicate with any external servers.

The problem is fully described here:
http://lists.ntp.org/pipermail/questions/2005-August/006332.html [^]

ntp.org admits the issue here: http://support.ntp.org/bin/view/Support/ConfiguringNTP#Section_6.13. [^]
> Currently, ntpd does not rescan the network interfaces after it has started.
> If you are have a dynamic IP (use DHCP), this means ntpd will no longer be
> able to communicate with "outside" sources after your IP changes.

My hack for fixing it is below. It's not ideal... in particular the init scripts start ntpd with -g which will cause a step-jump in the time; in this case ntpd should be restarted with -x so the time is slewed. Also not sure if /etc/ppp/ip-up.local is the best place.

/etc/ppp/ip-up.local:

/usr/share/system/scripts/firewall-up $1
# gid -- ntpd can't handle changing interface, so restart
if [[ $1 == ppp0 && -x /etc/init.d/ntpd ]] ; then
  logger "ppp0 up -- restarting ntpd"
  /etc/init.d/ntpd condrestart
fi

Finally, I think this means that modifying any network interfaces via the webconfig will also cause this to happen (for the modified interface). Not sure if ntpd already gets restarted in that case.
Sample logs... ADSL goes down, ntpd starts erroring:

Oct 11 11:33:22 office pppd[21695]: Connection terminated.
Oct 11 11:33:22 office pppd[21695]: Modem hangup
Oct 11 11:33:27 office pppd[21695]: Exit.
Oct 11 11:33:27 office pppoe[21696]: read (asyncReadFromPPP): Session 4185: Input/output error
Oct 11 11:33:27 office pppoe[21696]: Sent PADT
Oct 11 11:33:27 office adsl-connect: ADSL connection lost; attempting re-connection.
Oct 11 11:33:29 office adsl-stop: Killing pppd
Oct 11 11:33:29 office adsl-stop: Killing adsl-connect
Oct 11 11:33:33 office ntpd[21887]: sendto(64.34.185.196) (fd=24): Invalid argument

That last message will repeat each time ntpd tries to talk to any peer.
No tags attached.
Issue History
2011-10-24 00:29devferretNew Issue
2011-10-24 12:31user2Statusnew => confirmed
2013-02-02 11:02user2Target Version => 6.4.0 Beta 2
2013-02-21 20:00user2Target Version6.4.0 Beta 2 => 6.4.0
2013-03-14 11:56user2Target Version6.4.0 => 6.4.0 Updates
2013-07-29 13:57user2Target Version6.4.0 Updates => 6.5.0 Beta 1
2013-08-02 11:19user2Checkin
2013-08-02 11:19user2Note Added: 0000969
2013-08-02 11:19user2Statusconfirmed => resolved
2013-08-02 11:19user2Fixed in Version => 6.5.0 Beta 1
2013-08-02 11:19user2Resolutionopen => fixed
2013-08-02 11:19user2Assigned To => user2
2013-08-14 19:12user2Statusresolved => closed

Notes
(0000969)
user2   
2013-08-02 11:19   
Source Code Changelog
---------------------------------------------------
- Added network event to ntp to handle restarts on dynamic IPs [tracker 0000371]

File Changes
---------------------------------------------------
Details: http://code.clearfoundation.com/svn/revision.php?repname=ClearOS&rev=6298 [^]
U webconfig/apps/ntp/trunk/deploy/info.php
U webconfig/apps/ntp/trunk/packaging/app-ntp.spec
A webconfig/apps/ntp/trunk/packaging/network-connected-event