UNIX System Administration Handbook - Evi Nemeth [268]
Another noteworthy feature of LOC records is that they appear to crash NT 4.0’s name server; take precautions.
SRV records
A SRV record specifies the location of services within a domain. For example, the SRV record allows you to query a remote domain directly and ask for the name of its FTP server. Until now, you mostly had to guess. To contact the FTP server for a remote domain, you had to hope that the remote sysadmins had followed the current custom and added a CNAME for “ftp” to their server’s DNS records.
SRV records make more sense than CNAMEs for this application and are certainly a better way for sysadmins to move services around and control their use. However, they must be explicitly sought and parsed by clients, so it will be a while before their effects are really felt.
SRV records resemble generalized MX records with fields that let the local DNS administrator steer and load-balance connections from the outside world. The format is
service.proto.name [ttl] IN SRV pri wt port target
where service is a service defined in the IANA assigned numbers database (see page 270 or www.iana.org/numbers.htm), proto is either tcp or udp, name is the domain to which the SRV record refers, pri is an MX-style priority, wt is a weight used for load balancing among several servers, port is the port on which the service runs, and target is the hostname of the server that provides this service. The A record of the target is usually returned automatically with the answer to a SRV query. A value of 0 for the wt parameter means that no special load balancing should be done. A value of “.” for the target means that the service is not run at this site.
Here is an example, snitched from RFC2052 (where SRV is defined) and adapted for the cs.colorado.edu domain:
ftp.tcp SRV 0 0 21 ftp-server.cs.colorado.edu.
; don't allow finger anymore (target = .)
finger.tcp SRV 0 0 79 .
; 1/4 of the connections to old box, 3/4 to the new one
ssh.tcp SRV 0 1 22 old-slow-box.cs.colorado.edu.
SRV 0 3 22 new-fast-box.cs.colorado.edu.
; main server on port 80, backup on new box, port 8000
http.tcp SRV 0 0 80 www-server.cs.colorado.edu.
SRV 10 0 8000 new-fast-box.cs.colorado.edu.
; so both http://www.cs.colo... and http://cs.colo... work
http.tcp.www SRV 0 0 80 www-server.cs.colorado.edu.
SRV 10 0 8000 new-fast-box.cs.colorado.edu.
; block all other services (target = .)
*.tcp SRV 0 0 0 .
*.udp SRV 0 0 0 .
This example illustrates the use of both the weight parameter (for SSH) and the priority parameter (HTTP). Both SSH servers will be used, with the work being split between them. The backup HTTP server will only be used when the principal server is unavailable. The finger service is not included, nor are other services that are not explicitly mentioned. The fact that the finger daemon does not appear in DNS does not mean that it is not running, just that you can’t locate the server through DNS.
WKS (well-known services) was an earlier service-related DNS record that did not catch on. Instead of pointing you to the host that provided a particular service for a domain, it listed the services provided by a particular host. WKS seems sort of useless and was also deemed a security risk. It was not widely adopted.
Microsoft uses standard SRV records in Windows 2000 but inserts them into the DNS system in an undocumented, incompatible way. We are shocked, shocked.
TXT records
A TXT record adds arbitrary text to a host’s DNS records. For example, we have a TXT record that identifies our site:
IN TXT "University of CO, Boulder Campus, CS Dept"
This record directly follows the SOA and NS records for the “cs.colorado.edu.” zone and so inherits the name field from them.
TXT records are also used in conjunction with the RP record, which allows you to specify the person responsible for a host in more detail than the contact email address encoded in the SOA record of the zone.
The format of a TXT record is
name [ttl] IN TXT info ...