Now, why do we need dynamic DNS?
Dynamic DNS provides a convenient protocol for frequent DNS updates.
This service allows members who do not have a static IP address (in other
words, they have a dynamic IP address) to update their zone file records as
often as they wish.
This is different from the DNS service which may not be as accessible or
convenient for handling frequent update requests.
Lets say someone is operating a part time server or web site from home.
Building a web page or setting up any interface for such a home-based server
(for instance) requires only a little knowledge and not much money. Getting
your own domain name- also not a big problem, it's cheap enough if not free.
However, what will cost more than your average lunch at Burger-Shmurger is
acquiring your own IP.
What usually happens is one of two possibilities:
The first is this: if you are an established company, you would probably want
to acquire a range of IPs. Your company will pay some money to be assigned a
range of static IPs, which it will get from any level ISP (be it your local
ISP, or the one which assigns IPs to your local ISP, of course, we know by now
that the "root" organization which assigns IPs to everyone is IANA).
No problem here..
The second option is: you don't have your own IP. You connect to the Internet
by first connecting to your local ISP- be it by modem, ADSL, ISDN etc.
This ISP will assign any one of the currently free IPs from its IP pool. This is
your IP right now. As soon as you disconnect (even if you reconnect in two
seconds), it's likely that the next time you reconnect you will be assigned a
different IP.
Do you see the problem here?
Now, considering the latter, you want to make sure that whenever anyone wants
to visit your website, the IP record that's associated with your domain name in
the zone file is the current and updated one. It's worthless if the IP is not
properly updated- no one will get to your web site. ever.
This problem introduces the motivation for dynamic DNS.
While non-Dynamic DNS zone file records get updated only a few times a day,
dynamic DNS zone file records get updated every few minutes.
In case you use a dynamically allocated IP (the second option here), you would
need to update your records in your zone file very frequently.
Basically, we can use one of two options for dynamically updating our DNS:
First: we could update the zone files ourselves.
Second: we could use a configuration in which the DHCP server updates the DNS
server.
First step: get your own IP
In any case, the first move is being assigned an IP number by our ISP
provider.Once we have an IP number, be it the user or the DHCP server that
makes the update request, we are expected to know the name of the zone we
intend to update, as well as the zones server name.
It is reasonable to send an update message to any authoritative server,
however, in case we know the name of the primary master server, the message
should be sent there.
Second step: send your update message to the name server.
Next, the request holding the following data will be sent to that name server.
The header section is slightly changed from the regular DNS update message. It
holds the following fileds:
- ID: a 16 bit identifier assigned by the entity making the request. This ID
will be copied onto the response message.
-QR: one bit marking the message as either the request (0) or the response (1),
and will be changed accordingly.
- Opcode: 4 bits which state the nature of this request. For example, opcode=5
means that this is an update request. This field as well will be copied onto
the response message.
- Z: should be 0 in all messages. (it's reserved for future use).
- RCODE: 4 bit response code. See the response code table.
- NOTAUTH: not authoritative server for the zone requested in the Zone section.
- NOTZONE: no such zone in the zone section.
- ZOCOUNT: The number of RRs in the zone section.
- PRCOUNT: The number of RRs in the prequisite section.
- UPCOUNT: The number of RRs in the update section.
- ADCOUNT: The number of RRs in the additional data section
specifies the zone details of the zone we want
to update.
The zone segment has the same format, however, the fields have been redefined.
-ZNAME: zone name.
-ZTYPE: SOA (always).
-ZCLASS: zone class.
There is more information about this section both at the DDNS rfc number 2136, or the DNS rfc, number 1035.
To make things easier,
choose a dynamic DNS service provider. These providers will give you a friendly
interface to update your IP, and then do all of the "dirty work" of
contacting the servers.
A quick search for dynamic DNS service providers shows us that there are more
service providers than we care to know about. It's even possible to find free
service providers. In this case, though, the amount of hosts is usually
limited.