Shortening hostnames for fun and profit

December 23, 2007

Once upon a time I needed to NFS export filesystems to a lot of workstations, in a situation where I was worried about size limits in /etc/exports (and we didn't use YP/NIS, so we couldn't just put everything in netgroups). In situations like this, one thing to do is to shrink hostnames down as much as possible, and that's what we did.

(This was back in an era where the existence of such limits were at least plausible.)

First, we named the workstations after elements. This let us make their canonical names in DNS be the short abbreviations for each element (although the local hostname was still the friendlier element name), meaning that workstations had a canonical hostname that was only one or two characters long. Then we put them all in /etc/hosts, using shortened names: their canonical hostname, plus only the subdomain of their lab.

All of this gave us hostnames for /etc/exports that were only four to six characters long, far shorter than they normally would have been, and I stopped worrying about the potential problem.

(In the end I don't know if the exports file actually had any size limits; possibly I did all of this work merely out of paranoia.)

Perhaps we could have done all of this without making the abbreviation be the canonical name in the DNS, but I didn't feel like finding out the hard way that mountd did DNS lookups under some circumstances. And we were clearly going to have the abbreviations in DNS, since having names in /etc/hosts that aren't in DNS is a recipe for future confusion and explosions.

Written on 23 December 2007.
« Getting a useful persistent VNC session
Multihomed hosts and /etc/hosts »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sun Dec 23 23:34:05 2007
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.