If you have a web server running on your linode and another location on a Dynamic DNS, and would like to update linode’s DNS without logging in via ssh, here’s my implementation.
This is a PHP script that runs on your web server and returns the IP address of the client. Create it in the web root on your web server and save as MyIP.php
<?php echo $_SERVER['REMOTE_ADDR']; ?>
This is a shell script that runs on the remote (dynamic) machine. Name it anything you like and put it /etc/cron.hourly.
Change the variables to reflect your settings.
Note that it only updates the DNS when your WAN IP has actually changed.
You can pick up this entire document without any formatting problems at:
#!/bin/sh LINODE_API_KEY=your linode key DOMAIN_ID=your domain id RESOURCE_ID=your resource id # Ask your linode what your current home/remote WAN IP is WAN_IP=`wget -O - -q http://www.yourlinode.com/MyIP.php` # Get your old WAN IP OLD_WAN_IP=`cat /var/CURRENT_WAN_IP.txt` # See if the new IP is the same as the old IP. if [ "$WAN_IP" = "$OLD_WAN_IP" ]; then echo "IP Unchanged" # Don't do anything if th eIP didn't change else # The IP changed. Update Linode's DNS to show the new IP echo $WAN_IP > /var/CURRENT_WAN_IP.txt wget -qO- https://api.linode.com/?api_key="$LINODE_API_KEY"\&api_action=domain.resource.update\&DomainID="$DOMAIN_ID"\&ResourceID="$RESOURCE_ID"\&Target="$WAN_IP" fi