2010
05.20

DynDNS offers “free Dynamic DNS service that lets you easily connect to your home network from anywhere. Use your personalized URL to view home security cameras, download shared files from your VPN, or even host a personal website. Don’t pay for a static IP address; our software syncs your domain to your network automatically”

Of course it is (completely) pointless, but what the hack. You could use it for running public services (apache, ssh et cetera) on your N900 if your 3G provider assigns you a public IP address, but I guess the main purpose would be tracking your phone when it’s lost or stolen.

Since Python is already present on the N900 the easiest way to get things working would be a Python based DynDNS client. Such a client is available at sourceforge.net and is named ipcheck. So what we do is:

And I assume that you already have SSH (root) access to your phone

  • Download ipcheck to the N900
    mkdir /opt/ipcheck -p
    cd /opt/ipcheck
    wget http://downloads.sourceforge.net/project/ipcheck/ipcheck.py?use_mirror=ovh
    chmod 0755 ipcheck.py
  • Test it
    ./ipcheck.py --makedat -l -r \
    checkip.dyndns.org:8245 #username #password #domain
    
  • Create a if-up.d script
    touch /etc/network/if-up.d/ipcheck
    chmod 0755 /etc/network/if-up.d/ipcheck
    vi /etc/network/if-up.d/ipcheck
    

    And paste these lines in it:

    #!/bin/sh
    #
    if [ ! -d /opt/ipcheck ]; then
      exit 1;
    else
      cd /opt/ipcheck;
      ./ipcheck.py -l -r checkip.dyndns.org:8245 #username #password #domain;
      exit 0;
    fi
    
  • Check if it works (by switching connection 3G/Wireless and watching what happens at DynDNS.org)

References:

1 comment so far

Add Your Comment
  1. Mischa ter Smitten

    I got this error and I already resolved:

    Error:
    File “./ipcheck.py”, line 1519, in _main
    logger.logit(“opt_https_only set to ” + opt_https_only)
    TypeError: cannot concatenate ‘str’ and ‘int’ objects

    The solution:
    Change line 1519 to:
    logger.logit(“opt_https_only set to %s” % opt_https_only)

    Regards