Git Product home page Git Product logo

namecheap-ddns's Introduction

Namecheap-DDNS

A Bash script to update DNS record on Namecheap.

Preparation

Set Up A Record

Before you run the script, please make sure that you have set up your Namecheap DDNS A record. Instruction can be found here.

How To Get DDNS Password

Also make sure you have the DDNS password with you. If you haven't, please follow the steps below.

First, login to your Namecheap panel, then go to Domain List >> click Manage next to the domain >> Advanced DNS tab >> Scroll to Dynamic DNS section. If it is not enabled, enable it to get the password.

Get Started

Things You Should Know

Your record will not hit the Namecheap API if the given IP is identical to the remote DDNS record. However, if you still want to force push the already existed record for testing purpose, you could pass -f or --force argument.

$ ./updateDNS.sh --force

By doing this, the script will send a request even if the DDNS record needs not to be updated. It is not recommended to use in production mode.

Run With Prompt

  1. Clone the repository to you local machine
  2. Change directory into the cloned repository
  3. Run updateDNS.sh script
    $ ./updateDNS.sh
  4. Following prompt, enter required parameters

Run With Automated Script

Just export required environment variables, and run updateDNS.sh script.

Required Environment Variables

Env Variable Comment Example
HOST The "A + Dynamic DNS record" to be updated @, www
DOMAIN_NAME The domain name haomingin.com
PASSWORD Namecheap DDNS password sample-password
IP [Optional] If not given, the IP address that hits namecheap API will be used 127.0.0.1

How To Set Environment Variables

You can use export to set environment variables in your current terminal session, and you can reuse them. For example,

$ export HOST=www
$ export DOMAIN_NAME=haomingyin.com
$ export PASSWORD=sample-password
$ ./updateDNS.sh

Or simply,

$ HOST=www DOMAIN_NAME=haomingyin.com PASSWORD=smaple-password ./updateDNS.sh

Reference

Official Instruction

Namecheap official guideline of setting up DDNS using your browser.

Sample Response

  • Successful response
<?xml version="1.0"?>
<interface-response>
    <Command>SETDNSHOST</Command>
    <Language>eng</Language>
    <IP>127.0.0.1</IP>
    <ErrCount>0</ErrCount>
    <ResponseCount>0</ResponseCount>
    <Done>true</Done>
    <debug>
        <![CDATA[]]>
    </debug>
</interface-response>
  • Error response
<?xml version="1.0"?>
<interface-response>
    <Command>SETDNSHOST</Command>
    <Language>eng</Language>
    <ErrCount>1</ErrCount>
    <errors>
        <Err1>No Records updated. A record not Found;</Err1>
    </errors>
    <ResponseCount>1</ResponseCount>
    <responses>
        <response>
            <ResponseNumber>380091</ResponseNumber>
            <ResponseString>No updates; A record not Found;</ResponseString>
        </response>
    </responses>
    <Done>true</Done>
    <debug>
        <![CDATA[]]>
    </debug>
</interface-response>

namecheap-ddns's People

Contributors

haomingyin avatar

Stargazers

 avatar  avatar

Watchers

 avatar

namecheap-ddns's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.