Bug #3446
closedNTP server doesn't bind to assigned interfaces on automatic service restart after queriing his assigned master time server
0%
Description
Every morning my pfsense synchronizes with a master timeserver on the internet. The ntpd is taken down while synchronizing and put up again afterwards. When starting the service manually, this is the expected log output I'm actually seeing in the logs as well:
Feb 13 06:17:07 ntpd87695: Listening on routing socket on fd #31 for interface updates
Feb 13 06:17:07 ntpd87695: peers refreshed
Feb 13 06:17:07 ntpd87695: Listen normally on 8 lo0 ::1 UDP 123
Feb 13 06:17:07 ntpd87695: Listen normally on 7 lo0 127.0.0.1 UDP 123
Feb 13 06:17:07 ntpd87695: Listen normally on 6 igb1 xxxx::xxx:xxxx:xxxx:xx UDP 123
Feb 13 06:17:07 ntpd87695: Listen normally on 5 igb1 xxx.xxx.xx.x UDP 123
Feb 13 06:17:07 ntpd87695: Listen normally on 4 igb0 xxxx::x UDP 123
Feb 13 06:17:07 ntpd87695: Listen normally on 3 igb0 xxxx::xxxx:xxxx:xxxx:xxxx UDP 123
Feb 13 06:17:07 ntpd87695: Listen normally on 2 igb0 xxx.xxx.xx.x UDP 123
Feb 13 06:17:07 ntpd87695: Listen and drop on 1 v6wildcard :: UDP 123
Feb 13 06:17:07 ntpd87695: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Feb 13 06:17:07 ntpd87695: ntp_io: estimated max descriptors: 11095, initial socket boundary: 20
Feb 13 06:17:07 ntpd87695: proto: precision = 0.838 usec
Feb 13 06:17:07 ntpd87681: ntpd 4.2.6p5@1.2349-o Wed Jul 24 14:35:11 UTC 2013 (1)
When the service is restarted automatically after synchronizing with the time source, I see the following output instead:
Feb 13 06:17:12 ntpd88688: ntpd 4.2.6p5@1.2349-o Wed Jul 24 14:35:11 UTC 2013 (1)
Feb 13 06:17:12 ntpd87695: ntpd exiting on signal 15
In consequence after such a service restart I do have a running ntpd, but no timesource internal clients could synchronize with.
When restarting the ntpd on the console, it doesn't come up again reliably.
Currently I'm helping myself with the following script run every 15 minutes by cron, which I use to monitor and restart the service if necessary:
#!/bin/sh
start() {
while [ `/bin/pgrep -f 'ntpd' | wc -l` -eq 0 ]
do
echo "NTPD is dead, restarting: /usr/local/bin/ntpd -g -c /var/etc/ntpd.conf -p /var/run/ntpd.pid" >> $logfile
/usr/local/bin/ntpd -g -c /var/etc/ntpd.conf -p /var/run/ntpd.pid
sleep 5
done
}
logfile="/var/log/ntpd-restart.log"
date=$(date)
if [ `/bin/pgrep -f 'ntpserver-check.sh' | wc -l` -eq 0 ]
then
echo "Running ntpd-restart: $date" > $logfile
start
while [ `ntpq -pn xxx.xxx.xx.x | grep -E -c '^\*'` != 1 ]
do
date >> $logfile
echo "NTPD is no time source, restarting: /usr/local/bin/ntpd -g -c /var/etc/ntpd.conf -p /var/run/ntpd.pid" >> $logfile
killall ntpd >> $logfile
start
sleep 5
done
fi
Updated by Michael Noack about 11 years ago
I just saw that my report is most likely a duplicate of: https://redmine.pfsense.org/issues/3317