Tutorials Linux DDNS Update Client wget

From WebOS Internals
Revision as of 04:15, 10 September 2009 by Bkw (talk | contribs) (additional info section)
Jump to navigation Jump to search

This document contains instructions for setting up your Pre to automatically update a dynamic DNS hostname to your Palm Pre's IP address (assigned by your data service provider).

If you're using the Optware Package Feed you might want to check out ez-ipupdate or INADYN. However, if your dynamic DNS service isn't supported by either of these, you're building a custom service, or you want a freedns.afraid.org solution that doesn't require an always-on daemon, this guide may be for you.

This mechanism functions by adding a priority default routing rule that forces all traffic to go over the ppp0 (EV-DO) connection. This ensures we're updating your service with your ppp0 ip and not your eth0 (Wifi) ip. It optionally then finds your IP address from http://checkip.dyndns.org. Then, it calls your update URL. Finally, it removes the default route it created in step 1.

Prerequisites

  • This page assumes that you have just finished the procedure on the Portal:Accessing_Linux page, and are still logged in as root via telnet, novaterm, or novaproxy.
  • This page assumes you have a Dynamic DNS service account with a service that provides URL based updating (i.e. http://freedns.afraid.org)

Enabling write access to the file system

 mount -o remount,rw /

Obtain the Update URL provided by your service

For http://freedns.afraid.org, log in, and find the 'Direct Update URL' for your dynamic DNS entry. Mine looks like this:

 http://freedns.afraid.org/dynamic/update.php?ZzYyXxWwUuTtSsRr==

This updates the IP of my DNS entry to the IP of the client. We need to make sure we call this address from the ppp0 interface so that it updates to the correct IP. When the Pre is connected to a wifi connection, a default routing entry forces all data to go over that connection.

However, your service may differ, and require different information (example):

 http://mydynamicdnsservice.com/?host=myhost.com&Ip=99.123.222.101


This example doesn't require the caller to be from the new target IP address, and won't need the routing entries.

Update your service whenever your ppp0 (EV-DO) IP address changes

You can do this by adding a script to /etc/ppp/ip-up.d called 09update-ddns.

This is the script for the first example:
Use this one if you don't get to or don't want to submit an IP arbitrarily, and your dynamic dns service just uses whatever IP the http request came from.

 #!/bin/sh
 # pppd provides IFNAME and IPREMOTE for us
 ip route add default via $IPREMOTE dev $IFNAME metric 1
 wget -qO- http://freedns.afraid.org/dynamic/update.php?ZzYyXxWwUuTtSsRr==
 ip route del default via $IPREMOTE dev $IFNAME metric 1

This is the script for the second example:
Use this one if you need to or want to supply the IP yourself to the dynamic dns service.

 #!/bin/sh
 # pppd provides IPLOCAL for us
 wget -qO- http://mydynamicdnsservice.com/?host=myhost.com&Ip=$IPLOCAL

Make this script executable

 chmod 755 /etc/ppp/ip-up.d/09update-ddns

Also note that curl is also installed. Wget is a faster and lighter and works in most cases, but curl can do more and harder things than wget so it's something to remember if you want to hit some web pages that weren't necessarily designed to be accessed non-interactively.

Remount the file system as readonly

 mount -o remount,ro /
  • by raeb
  • big thanks to dreadchicken's tutorial

It didn't work. What else can I try?