Skip to content

Instantly share code, notes, and snippets.

@joelambert
Created December 3, 2013 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelambert/7777519 to your computer and use it in GitHub Desktop.
Save joelambert/7777519 to your computer and use it in GitHub Desktop.
Update Dynamic DNS record hosted with DNSMadeEasy with current local IP address. This is useful for local web testing on mobile devices on the same WiFi Network
#!/bin/bash
# Auth/DNS Record Details
USERNAME="USERNAME"
PASSWORD="PASSWORD"
ID="DNS-RECORD-ID"
# Get the IP Address
IP=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
# Make the API Request
URL="http://www.dnsmadeeasy.com/servlet/updateip?username=${USERNAME}&password=${PASSWORD}&id=${ID}&ip=${IP}";
curl -s "${URL}" > /dev/null
# Clear the local cache
dscacheutil -flushcache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment