Re: ntpd restart on IP address change the Debian way
On Thu, Jan 10, 2008 at 10:51:28AM +0800, Bob wrote:
> Bob wrote:
> >Cameron Hutchison wrote:
> >>Bob wrote:
> >>>Bob wrote:
> >>>
> >>>>Is there such a thing?
> >>>>
> >>>>When my firewall / dhcp server / ntp server gets a fresh IP address
> >>>>from my ISP the ntp daemon stops responding to requests.
> >>>>
> >>>Is the silence because it's a stupid question or because there isn't
> >>>a preferred work around for this?
> >>>
> >>
> >>How does your firewall get its IP address?
> >>If it is by PPP then you can scripts in /etc/ppp/ip-{up,down}.d to start
> >>and stop the ntp daemon. This should get triggered when a new IP
> >>address
> >>is negotiated.
> >
> >Via DHCP, the ADSL 'modem' (D-link DSL-320T) passes it's wan IP
> >address onto the client, and when it doesn't have one it gives you
> >192.168.1.2 with a 30 second lease so you get connected within that
> >time when the link coming up, and if the link doesn't come up then
> >your logs fill up instead.
> >
> >>Check the man page for pppd(8) and search for ip-up to see the details
> >>of how it's used, but just dropping scripts in those directories should
> >>be sufficient.
> >
> >I wonder if it's possible to persuade the dhcp client to run a script?
>
> Sorry to resurrect such an old thread but this is really irritating me,
> after reading through the Bug Reports it seems this has been fixed in
> version 4.2.4 which is fine for Lenny but I don't want to run Lenny on
> my firewall, it's very simple dedicated etch box with nothing other than
> main and updates in its /etc/apt/sources.list so I don't want to start
> messing around with apt pinning.
>
> Is there a simple way to get the dhcp client to restart ntpd on IP
> address change?
Not dhcp, but on my ppp dialup, here's the script with commets that I
have in ip-up.d:
8>--
#! /bin/sh
# ntp
# written by dtutty on 2007-01-19 since no default file is given
# ntp will continue to poll servers even when offline, increasing
# the delay to 1024 seconds.
# However, it doesn't have a way to know when the system is back on line.
# It will also only handle a large variance on initial start up.
# Therefore, whenever ppp goes online, ntp should be restarted.
/etc/init.d/ntp restart
## Note that there doesn't seem to be any reason to stop ntp when ppp goes
# down.
8>--
When dhcp gets a new IP, does it re-run pre-up and post-up commands
found in /etc/network/interfaces? See man interfaces(5) to see what I
mean. If so, put them there.
I don't use dhcp so I can't just read a man page to help further.
Doug.
Reply to: