Skip to content

Instantly share code, notes, and snippets.

@whalesalad
Last active December 27, 2015 23:09
Show Gist options
  • Select an option

  • Save whalesalad/7404432 to your computer and use it in GitHub Desktop.

Select an option

Save whalesalad/7404432 to your computer and use it in GitHub Desktop.
DIY Dynamic DNS for DNSimple (running on my pfSense firewall) You need to acquire a domain API token from DNSimple.com, and you'll also need the record id # of the specific record that you want to update. This will figure out your IP with the command on line #7, then fire off an API call to DNSimple to update your record. I have this running on …
#!/bin/bash
DOMAIN_TOKEN="XXXXXXXXXXXXXXXXXXXXX"
DOMAIN_ID="example.com"
RECORD_ID="12345678"
IP="`curl -s -f http://icanhazip.com/`"
curl -s -S \
-H "X-DNSimple-Domain-Token: $DOMAIN_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X PUT \
-d "{\"record\":{\"content\":\"$IP\"}}" \
-o /dev/null \
https://dnsimple.com/domains/$DOMAIN_ID/records/$RECORD_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment