[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ntp and dynamic IP



>
> my ISP disconnects me once a day, so that I won't keep a quasi-static IP
> I don't pay for. Now, pppd reconnects swiftly, but ntp doesn't seem to
> like this anyway. Soon after the dis-/reconnect I get this:

> Feb  9 13:15:01 zwerg ntpd[4732]: sendto(192.53.103.104): Invalid argument
> Feb  9 13:15:07 zwerg ntpd[4732]: sendto(130.149.17.21): Invalid argument
> Feb  9 13:16:08 zwerg ntpd[4732]: sendto(195.145.119.188): Invalid argument
> Feb  9 14:41:27 zwerg ntpd[4732]: synchronisation lost

> As it will never recover, I resorted to restarting ntp every day. But
> surely, there's a more elegant solution. Or is there?

Hi,
An elegant (I think) way of solving this is to 
put scripts in /etc/ppp/ip-[up|down].d/ to stop 
and start ntpd when pppd reconnects.

My /etc/ppp/ip-down.d/ntp-server simply says,

-----
#!/bin/sh

[ -x /usr/sbin/ntpd ] || exit 0

echo "Stopping NTP server"
/etc/init.d/ntp-server stop
-----

and my /etc/ppp/ip-up.d/ntp-server,

-----
#!/bin/sh

[ -x /usr/sbin/ntpd ] || exit 0

echo "Starting NTP server"
/etc/init.d/ntp-server start
-----

Just make sure these scrips are executable (755).

Ricardo



Reply to: