Using DNS for naming hosts

The most important use of DNS (and the reason it was invented), is to find an IP number by a domain name. When used for this, DNS is something like the telephone directory for the Internet: if you type in a domain name such as www.posadis.org in, for example, your browser, it will be looked up and converted to an Internet IP number, the Internet equivalent of a telephone number, which is used by your computer to make a connection. See the following diagram:

Using DNS for naming hosts is pretty easy: it is done with two record types: A for IPv4 addresses and AAAA for IPv6 addresses1). For example, to assign the IPv4 address 66.35.250.210 to the domain name www.posadis.org., use something like the following record:

www.posadis.org.   2h  A       66.35.250.210

Or to assign the hypothetical IPv6 address dead:beef::1 to www.posadis.org., use:

www.posadis.org.   2h  AAAA    dead:beef::1

You can have both A and AAAA records at the same domain name. A client which supports IPv6 will try a lookup for any AAAA records first, and if there are no AAAA records for a domain name, it will try A records. A client which does not support IPv4 will just look up the IPv4 address.

You can also have multiple A records, or multiple AAAA records, at one domain name: each IP number will be used about equally often2). This depends on a feature called round robin which is supported by pretty much any DNS server out there, including Posadis, which does this by default.

Aliases and wildcards

You can also make a domain name an alias to another domain name, or redirect all non-existing domain names to another domain name. These things are discussed in What makes up a zone.

The ''SRV'' record type

There are several important things that A and AAAA record don’t do:

  • You can not set the port a client connects to
  • You can not direct different protocols to different IP numbers (e.g. mail requests go to another IP than FTP requests)
  • If you have multiple servers for a domain, you cannot control how many requests go to one server and how many to the other: it will be split in half
  • You can not set some servers as backup servers that are used only when the normal servers are down (as is the case with MX records)

In general, A and AAAA records map domain names to servers, but what we would really want is to map services for a domain name to servers.

On the bright side, there is a record type that does the things mentioned, called the SRV record. The problem though, is that the SRV record type is not really widely used (except for local networks, and for specific internet applications), mainly because the standard DNS functionality of operating systems does not take services in mind. Given how useful SRV records could be, this is really a shame. This is discussed in more detail in this forum topic.

The syntax of the SRV record, and how it can be used to do these four things, is discussed in the SRV section in Resource records.

1) There exists another record type, called A6, for IPv6 as well, which is more powerful but also a lot more complex. It does not seem to be used much.
2) There is no real way to control this in a more fine-grained matter using A records; see the remark on SRV later on
 
  dns/using_dns_for_naming_hosts.txt · Last modified: 2005/03/18 14:17
 
Copyright © Meilof Veeningen, 2002-2005 - About Posadis.org