Dynamic DNS with a python script

Jean-Paul Calderone exarkun at divmod.com
Thu Dec 27 12:53:48 EST 2007


On Thu, 27 Dec 2007 15:27:37 -0200, Marcelo de Moraes Serpa <celoserpa at gmail.com> wrote:
>Hello list,
>
>I'd like to set up ssh access to my home computer so that I will be able to
>access it from work - for this no problem, installing sshd is
>straightforward.
>
>The issue here is that I don't have a fixed IP connection at home. Also, I
>wouldn't like to use services such as no-ip or similar.
>
>What I thought was of writing a python program that would detect when the
>internet network interface was restarted/started for the first time and then
>update a DNS record at my DNS server where I would have a subdomain that for
>my home machine's host.
>
>However, I have no idea on how I could detect if the network has been
>restarted nor how I could update this DNS record. Any suggestion would be
>greatly appreciated :)
>

This depends on platform details.  For example, some Linux distros include
/etc/network/if-up.d/ which can contain arbitrary programs which will be
run after an interface is brought up.

Other platforms may have other ways to get notification of this event, or
they may require you to poll at some interval.

Jean-Paul



More information about the Python-list mailing list