Created
May 4, 2014 16:48
-
-
Save dalhundal/89159b3f032588586e91 to your computer and use it in GitHub Desktop.
Shell script to update namecheap.com dynamic dns for a domain with your external IP address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Shell script to update namecheap.com dynamic dns | |
# for a domain to your external IP address | |
HOSTNAME=yoursubdomain | |
DOMAIN=yourdomainname.com | |
PASSWORD=y0urp455w0rd | |
IP=`curl -s echoip.com` | |
curl "https://dynamicdns.park-your-domain.com/update?host=$HOSTNAME&domain=$DOMAIN&password=$PASSWORD&ip=$IP" |
mslinn
commented
Jun 30, 2022
via email
•
I had not created the @ record. When I created it just now, I set it to type "A record", not "A+ Dynamic DNS record" and there was no error message in response to:
curl
"https://dynamicdns.park-your-domain.com/update?host=$SUBDOMAIN&domain=$DOMAIN&password=$PASSWORD&ip=$IP"
Seems to work, is there a reason to use "A+ Dynamic DNS record" instead of "A Record"?
Mike
According to this you should be using the "A+ Dynamic DNS record". Whilst it might work now with a regular "A record" there's a chance that functionality will be deprecated in the future YMMV.
I set the types for the "@" and "www" subdomains to "A+ Dynamic DNS record" but when I saved the modified records, the types reverted to "A record".
Mike
Here's something that brings together several of the ideas above.
- Prevents clobbering the Namecheap update servers
- Only relies on core internet services from OpenDNS/dnsOmatic infrastructure (robust and purpose buit for ddns use cases)
- Will also discover AWS public DHCP IP addresses properly if you have a lot of internal RFC1918 DNS going on.
#!/bin/sh
# Shell script to update Namecheap.com dynamic dns
DDNS_HOSTNAME=hostname
DDNS_DOMAIN=example.com
DDNS_PASSWORD=XXXXXXXXXXX
CURRENT_IP=$(curl myip.dnsomatic.com)
CURRENT_DDNS=$(dig +short $DDNS_HOSTNAME.$DDNS_DOMAIN @resolver1.opendns.com)
echo "current Namecheap ddns record = $CURRENT_DDNS"
echo "current AWS public IP address = $CURRENT_IP"
if [ "$CURRENT_DDNS" != "$CURRENT_IP" ]; then
curl "https://dynamicdns.park-your-domain.com/update?
host=$DDNS_HOSTNAME&domain=$DDNS_DOMAIN&password=$DDNS_PASSWORD&ip=$CURRENT_IP"
fi
What the heck is park-your-domain.com and why would I send them my namecheap credentials? Is this a scam?
A simple search will lead you to NameCheap’s own documentation which shows
that is the URL you use to update your dynamic dns with them.
…On Sun, 14 Jan 2024 at 13:49, Alex Spurling ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
What the heck is park-your-domain.com and why would I send them my
namecheap credentials? Is this a scam?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/dalhundal/89159b3f032588586e91#gistcomment-4830303>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEIXZJLDH6CTVU33FIL4QLYOPO5RBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVAYTCNJRHE3TQONHORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Thanks - I did search and didn't find any mention of park-your-domain.com in Namecheap's documentation. Why don't they use namecheap.com or api.namecheap.com as their API domain?
Documentation:
https://www.namecheap.com/support/knowledgebase/article.aspx/583/11/how-do-i-configure-ddclient/
As for why they chose to use that domain, that would be a question best
directed at them.
…On Sun, 14 Jan 2024 at 14:15, Alex Spurling ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Thanks - I did search and didn't find any mention of park-your-domain.com
in Namecheap's documentation. Why don't they use namecheap.com or
api.namecheap.com as their API domain?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/dalhundal/89159b3f032588586e91#gistcomment-4830332>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEIXZKL4OYBPIHBDAW6UVTYOPR7BBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVAYTCNJRHE3TQONHORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
I made a couple of changes:
- Permits using "@" where you only have the TLD
- "silenced" the first curl
- Displays the Host and Domain values
- Changed the "dig"s to query dns1.registrar-servers.com since those are currently what NameCheap updates
#!/bin/bash
# Bash script to update Namecheap.com dynamic dns
DDNS_HOSTNAME="@"
DDNS_DOMAIN="YourDomainHere.com"
DDNS_PASSWORD="01234567890123456789012345678901"
CURRENT_IP=$(curl -s myip.dnsomatic.com)
if [[ "$DDNS_HOSTNAME" == "@" ]]; then
CURRENT_DDNS=$(dig +short $DDNS_DOMAIN @dns1.registrar-servers.com)
else
CURRENT_DDNS=$(dig +short $DDNS_HOSTNAME.$DDNS_DOMAIN @dns1.registrar-servers.com)
fi
echo "Hostname: $DDNS_HOSTNAME; Domain: $DDNS_DOMAIN"
echo "current Namecheap ddns record = $CURRENT_DDNS"
echo "current public IP address = $CURRENT_IP"
if [ "$CURRENT_DDNS" != "$CURRENT_IP" ]; then
curl "https://dynamicdns.park-your-domain.com/update?host=$DDNS_HOSTNAME&domain=$DDNS_DOMAIN&password=$DDNS_PASSWORD&ip=$CURRENT_IP"
fi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment