Configuration of my newly bought domain name, with dynamic DNS

In an older post, I inquired about the management of a domain name, in the context of a dynamic IP address. I concluded that such a configuration could be handled, notwithstanding the impossibility of a suitable handling of the DNS “PTR” record.

Now that I do have a domain name, let me use it…

Cet article est aussi disponible en français.

I will keep the same examples I have used before. Thus I will call “new.example” the new domain name, and “old.dyn.example” the former dynamic domain name. More over, I will consider my current IP address to be 203.0.113.90.

When I look at the web control panel provided to me by my registrar Gandi for “new.example”, as expected, I see nothing of interest in relation to the management of a dynamic IP address. Thus, as expected, I manage this domain name elsewhere; I chose Hurricane Electric Internet Services (HEIS) as a DNS hosting service: it allows the usage of dynamic IP addresses, and it is free.

Before I can manage my DNS entries, I have to tell my registrar, Gandi, that the DNS servers that will know about my domain will be HEIS’ instead of theirs. To this end, in the administration panel, I choose “Change the DNS servers” and I enter the addresses for HEIS’ servers:

DNS1: ns5.he.net
DNS2: ns4.he.net
DNS3: ns3.he.net
DNS4: ns2.he.net

That is all as far as Gandi is concerned. What follows happens in HEIS’ administration interface, where I have to create the A record:

Name         : new.example
IPv4 address : 203.0.113.90
TTL : 300
[✓] Enable entry for dynamic DNS

Which gives, when written as a standard DNS line:

new.example.	300	IN	A	203.0.113.90

The TTL is short (300 seconds, that is 5 minutes) because this DNS record should not be cached too long by the routers, in case my IP address changes. Propagation of DNS changes is instantaneous; freshening of buffer memory is not… With the above settings, I accept that my server will be unavailable for up to 5 minutes after each DNS change due to a change in my IP address. Do not use a too low value for the TTL, as that would impend routing performance (routers would need to permanently update their data).

Now I have to make sure that HEIS gets notified whenever my IP address changes. This is taken care of on my own server. I happen to already have configuration files, based on Inadyn, for much the same task, but for old.dyn.example:

  • the /usr/local/sbin/update_dyn_old script:
    #!/bin/bash
    /usr/sbin/inadyn --input_file /etc/inadyn_old.conf
  • the /etc/inadyn_old.conf configuration file:
    --background
    --syslog
    --dyndns_system dyndns@dyndns.org
    --username MY_USER_NAME
    --password MY_PASSWORD
    --update_period_sec 1800
    --forced_update_period 864000
    --alias old.dyn.example
  • and a “crontab” entry:
    @reboot /usr/local/sbin/update_dyn_old

Handling the new domain name is just a matter of adding:

  • a new /usr/local/sbin/update_dyn_new script:
    #!/bin/bash
    /usr/sbin/inadyn --input_file /etc/inadyn_new.conf
  • a new /etc/inadyn_new.conf configuration file, adapted to HEIS:
    --background
    --syslog
    --dyndns_system custom@dyndns.org
    --ip_server_name checkip.dns.he.net /
    --dyndns_server_name dyn.dns.he.net
    --dyndns_server_url /nic/update?
    --username new.example
    --password MY_DDNS_KEY
    --update_period_sec 1800
    --forced_update_period 864000
    --alias new.example
  • and a new “crontab” entry:
    @reboot /usr/local/sbin/update_dyn_new

The “DDNS KEY” above is defined through HEIS’ web interface, on the line of the Dynamic A DNS record (🔃 icon). This key does not need to be remembered, so it is perfectly sensible to have it randomly generated.

Note that the above 1800-second period instructs the server to check for the IP address every 30 minutes. Wherefore, in case of a change of IP address (due to my ISP), up to 35 minutes can pass until my server is reachable again.

There ends the basic DNS configuration. My server is now reachable through its new domain name. Other DNS settings are more dictated by software needs.

As a side-note, it is also a good idea to add the new domain name to the /etc/hosts file on the server.

Ajouter un commentaire

Le code HTML est affiché comme du texte et les adresses web sont automatiquement transformées.

La discussion continue ailleurs

URL de rétrolien : http://yalis.fr/cms/index.php/trackback/37

Fil des commentaires de ce billet