Many tutorials don't explain what to do if your server is behind a router, but this one will. I recently set up a backup server on an internet connection that has a dynamic IP address. This time though, I didn't have that option, and I didn't want to configure a dynamic dns client on that router either, so I had to set it up on the server itself. The one I am going to use is called ddclient, it's free and open source, and written in Perl.
Use this command to install ddclient: Log into namecheap and select the relevant domain, then choose "Dynamic DNS" under Miscellaneous settings.
Use the radio buttons to enable dynamic DNS, and then make a note of the password. It should go without saying, but be really careful what you do with this password - anyone with access to it could change any DNS record for your domain that they wanted to. Unfortunately, namecheap doesn't let you restrict the dynamic DNS to just one subdomain. Next, navigate to "All host records" add a DNS A record for your domain use the symbol for this , or subdomain. Use the dummy IP address For namecheap the value is "namecheap" server is the hostname of the dynamic DNS server.
The dynamic DNS servers used by namecheap are located at "dynamicdns. Leave the single quotation marks around the string. The last line is the subdomain to be modified. In my case this was backup, for backup.
If you wanted to update your root domain, you would put an symbol on this line instead WAN IP discovery The above configuration would work fine if ddclient was installed on a router, since the router knows your WAN IP address. There is a configuration parameter called use, which determines the method ddclient uses to find the WAN IP. If you specify it below, it won't work!
This caused me quite a lot of grief. The default value for use is if, which uses information from the netwrok interface think ifconfig. There are two more types of value you can set: Getting your WAN IP from your router's status page Although I haven't opted for the router firmware method, I think it's quite interesting and worth discussing.
Router firmware settings look something like this: If the status page is not available to unauthenticated users, you must set the username and password to allow ddclient to authenticate with the router. Some popular router manufacturers have their own settings for ease of use, for example if you have a Linksys router you can use this line: Getting your WAN IP address from a web service The web method involves ddclient querying one of the many "what is my ip" type web services on the internet, and extracting your IP address from the page returned.
You can tell ddclient to use this method by using this line: Some options with preset values are dnspark, dyndns and loopia, although you can use any site you like. For example, you could use somedomain. Secure submission Remember how I said anyone with your dynamic dns password can change your DNS records? Sending your password via http not https is a bad idea.
This parameter will force https: For this to work, you need a perl library that can use SSL. Install it with this command: IP address set to 1. Look for lines like this: Save and close the file, and then run: Since some ISPs seem to only allocate new IP addresses when the modem is power cycled, and some dynamic DNS providers will time out if you don't update the record in a while, there is one thing left to do - we need to add a cron job to force an update weekly, just in case. Choose whether you want to force an update daily or weekly, and then create a file called ddclient in the relevant directory, e.