-1

What is the proper way to configure a BIND9 zone file to allow ping/dig/nslookup/web browsers to query a host using its hostname or a shortened CNAME record that points to this hostname instead of the entire fqdn of the host.

Example: This works.

dnsadmin@tre-lfs4:~$ dig fs.domain.org
; <<>> DiG 9.10.3-P4-Ubuntu <<>> fs.domain.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3925
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;fs.domain.org.           IN      A
;; ANSWER SECTION:
fs.domain.org.    38400   IN      CNAME   tre-lfs1.domain.org.
tre-lfs1.domain.org. 38400 IN     A       10.30.0.31

From this zone file entry:

tre-lfs1.domain.org.    IN  A   10.30.0.31
fs.domain.org.  IN  CNAME   tre-lfs1.domain.org.

I want to be able to do this:

nslookup/ping/dig fs

With a zone file entry that looks more like this:

tre-lfs1.   IN  A   10.30.0.31
fs. IN  CNAME   tre-lfs1.

So that I can both use the entire FQDN OR just the shortened hostname/cname.

The reason is that I may have the same machine hosting web and other services for different domains, but when locally administering I want to just use the short names.

Anyone know how to achieve this or a resource to look to in order to do so?

1 Answers1

2

The ability to use a short name for a host rather than it’s FQDN is a ”trick” performed on the client side and that is not something that can be configured or managed on a name server.

In the client one or more search domains can be configured that will get appended to unqualified hostnames (hostnames without a dot .)

When you configure the search domains example.com and example.org and try to resolve the host fs and if that fails the dns client will then try to see if by appending the search domain it does get a result, I.e. the client will then try if the FQDN fs.example.com. resolves and if that fails it will try to resolve fs.example.org.

HBruijn
  • 84,206
  • 24
  • 145
  • 224