I l@ve RuBoard Previous Section Next Section

2.4 Adding an Alias

2.4.1 Problem

You need to create an alias from one domain name to another.

2.4.2 Solution

Add a CNAME record to the zone that the alias belongs in. For example, to make a.foo.example an alias for b.bar.example, add this CNAME record to the foo.example zone data file:

a.foo.example.    IN    CNAME    b.bar.example.

2.4.3 Discussion

Note that a CNAME record makes the alias equivalent to the target of the alias. Queries for any types of record attached to the alias will end up as queries for the same type of record, but attached to the domain name the alias points to. Consequently, you can't add any other types of records to a domain name that is an alias.

You also shouldn't use aliases on the right side of other types of records, such as NS and MX records. The consumers of NS and MX records -- name servers and mail servers, respectively -- don't expect aliases on the right side and therefore don't process them correctly. The only kind of record that allows an alias on the right side is the CNAME record itself: You can point an alias to another alias, as long as the alias chain ends at a non-alias domain name. Make sure the chain isn't more than eight links long, though, and beware alias loops.

Finally, note that the CNAME record belongs in the zone that contains the domain name of the alias, not the target of the alias.

2.4.4 See Also

Section 2.7 to learn how to set up virtual web hosts; and Chapter 4 and the "Using CNAME Records" section of Chapter 16 in DNS and BIND.

    I l@ve RuBoard Previous Section Next Section