Search:  
Gentoo Wiki

HOWTO_Dynamic_DNS_with_EveryDNS

This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Introduction

Since most home users do not get a static IP address (one that does not change over time), a dynamic DNS service can help you point a domain name to your box, no matter what the IP address is. All you need to do in order to get it working is three things: an account with a dynamic DNS service, a registered domain name, and a script to update your account to point to your current IP.

EveryDNS provides a free dynamic DNS service with expert capabilities to set your nameserver settings however you need to. They are supported by donations.

Register Domain

The first step, is to register a domain somewhere with someone. The only requirement you'll need is to set the nameservers yourself. Once you do find that page, set the nameservers to ns1.everydns.net (64.158.219.3), ns2.everydns.net (216.218.240.206), ns3.everydns.net (80.84.249.169) and ns4.everydns.net (63.219.183.200). Not every service will let you set up to four nameservers, and usually the first two alone will suffice.

EveryDNS Account

Next, create your free account. Once you are finished, go to the admin page. To add your dynamic domain, put the name in "Add new domain: (basic)" (example: everydns.net), then click on the "Make domain dynamic" radio button, and then the "advanced" submit button. Once you do that, you should see domain.com in the left hand side under Dynamic Domains. Now click on the entry to further modify the settings.

Under the Current Records menu, you'll see one entry for domain.com of type A. Type A DNS records point to an actual IP address. When you use your EveryDNS client, it will send your current IP to the system, and will update its nameserver records. Don't worry about what it's set to right now.

Now that you have domain.com registered in the DNS, you most likely would want other subdomains pointing there too. For instance, www.domain.com or blog.domain.com. There's an easy way to do that. In the Add a Record menu, for the FQDN (fully qualified domain name) entry, put *.domain.com Change the Record Type to CNAME. CNAME just means that we're going to point to another domain name, instead of an IP address. Then, for the Record Value, put domain.com Don't worry about the MX value.

That should be it! That will start pointing the name server to your box once you run the client for the first time.

MX Records

Now, if you want to run a mail server on your machine, or if someone else is hosting the email for your domain, you'll need to put in MX records as well. These basically tell someone who is looking up the domain where the mail should be going to.

Again, you can either put in an IP address for the Record Value field or another CNAME. All you would need to do is the same steps as above (using A for an ip address, or CNAME for a pointer to another domain name), and then two MX records, one for 10 and one for 20. Try to use an A record (ip adress) instead CNAME (domain name) for more standard compliant. CNAME is tolerated but not encouraged.

An example would be lets say we are hosting our email externally with mailserver.com. If they want us to point mail.domain.com to them, then you'd add that as the FQDN. The record type would be CNAME, and the record value mail.domain.com. The MX value would be 10. Add the record, then do the exact same thing, but with an MX value of 20.

If you're still confused, try checking out the FAQ.

Note that it might be a bad idea to try sending mail from your dynamic IP address because it is common for big and small mail server admins to simply block such IPs - they are getting way too much spam from infected home computers. Use some mail server with a static IP as a smarthost for relaying to the net.

EveryDNS Client

Like I've said before, you're going to need a script to notify EveryDNS of what your dynamic IP address is, so they can update their records. EveryDNS provides its own perl script, which you can download from here: http://faq.everybox.com/dynamic-domain/other-clients

Save the script to your harddrive. It will not be executuable, so you will have to change the modal values on it.

$ chmod 755 eDNS.pl

Now, you should be able to run it just fine.

$ ./eDNS.pl
Usage: eDNS.exe -u username -p password -ip IP_Address -d domain
Or   : eDNS.exe -u username -p password -d domain
Or   : eDNS.exe -u username -p password

So, a simple way to update all your domains with EveryDNS would be to run:

$ ./eDNS.pl -u username -p password

If it works, you'll see "Succeeded in setting domain to current ip address".

After that, if you refresh the page, you should notice that the DNS service is pointing to your dynamic IP. Try the domain, too, and see if it is resolving correctly. If it doesn't work right away, you might want to try waiting a few minutes for the records to update. In some cases, hours, if you just registered the domain.

Gentoo Init Script

Now, since your IP address assigned by your Internet provider is by nature, changing (dynamic), you'll want to run the EveryDNS client periodically to ensure that the domain is always pointing to your box.

One very simple way to do that is to create a custom init script in /etc/init.d/ that will be executed by the default runlevel every time you startup your computer.

Note: If you are behind a router that is always online, and it fetches the IP address from your provider, chances are they won't just change your IP address on you while you're connected, since it would sever your connection. It has been known to happen. Ideally, you'd only need to run it once everytime your router gets a new IP address.

First of all, copy eDNS.pl to /usr/local/bin/edns

# cp eDNS.pl /usr/local/bin/edns

Then, as root, create this file:

File: /etc/init.d/edns
#!/sbin/runscript
depend() {
       need net
}
start() {
       ebegin "Setting dynamic ip"
       /usr/local/bin/edns/eDNS.pl -u username -p password
       eend $?
}

Set the permissions to 700 on the script so that only root can see the username and password variables:

# chmod 700 /etc/init.d/edns

Try the init script out, and see how it works! If if it's not giving you any errors, then add it to the default runlevel:

# rc-update add edns default

And now you should have your EveryDNS working just great. Congratulations. :)

Cron job

Alternately you can run your edns updater client as part of a cronjob. If you don't have a crontab installed, you can emerge vixie-cron

# emerge vixie-cron

You can create a cron that runs every 2 hours at the 28th minute.

File: cronjob.cron
#Cron job to start client
#Mins Hour Days Months DayofWeek Command
28 0-23/2 * * * /pathto/eDNS.pl -u namehere -p passhere

Then just

# crontab /pathto/cronjob.cron

However if your ip changes inbetween updates (see note above), your server won't be accessable as discussed in the discussion page.

External Links

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Dynamic_DNS_with_EveryDNS"

Last modified: Mon, 29 Sep 2008 01:18:00 +0000 Hits: 15,192