Re: Auto-notify remote user of IP address change?
On Monday 07 March 2005 19:52, debian-user-digest-request@lists.debian.org
wrote:
> The best way to accomplish this is to set up a dynamic dns account (e.g.,
> one at http://dyndns.com). Then, install one of the clients (apt-cache
> search dyndns); there are also Windows clients.
>
> I have a script that does the following:
> *Checks for a change in IP address at an interval (via ipconfig or the
> Internet).
> *Updates the dyndns account only if the address has changed.
I am also doing stuff like this. I do not need the email but that is simple
enough. The IP only changes when the connection falls so I need to reconnect
and then get the new one which will most always be different.
This is the script, mostly suggested by another poster awhile back:
#!/bin/sh
if ! /sbin/ip addr show ppp0 ; then
sleep 2
/usr/sbin/pptp alcatel
sleep 15
if /sbin/ip addr show ppp0 ; then
/usr/sbin/ipcheck -l -i ppp0 dyndnsuser dyndnspassword dyndnsdomain
# I could do the email here if I wanted
fi
fi
If I have a connection, nothing is done. I have already done the ipcheck on a
startup script. The pptp alcatel is what reconnects to the ADSL, "alcatel"
in /etc/hosts as modem IP 10.0.0.138. Should probably test this result as
well.
This thing runs as a cron every 5 minutes. On startup, I will get one
cron-emailed failure message ppp0 does not exist, followed by one warning
that repeated ipchecks are abusive. Then everything is OK. Maximum unconnect
time is 5 minues unless the ADSL or provider is really down.
What is really bad about this script is the password being exposed. It will
sometimes appear in log entries and such. An alternative to this is needed.
A possible problem is that running a server with this thing means that a
remotely reported dns may not be current--it takes time to propagate. So an
email or web access could fail.
Some email servers reject mail outright from dynamic dns senders so exim4
should be configured to smarthost through a static IP such as the provider
itself and I fetch email from the provider as well. When I have opened the
smtp port, I have successfully received email send to the dyndns domain.
Reply to: