You have several choices.
You can use the .local
domain name, which is reserved for machines that are not accessible from the Internet. (You can use it on a machine that can make outgoing connections to the Internet, or even from a machine that can but normally doesn't receive incoming connections from the Internet.) This name is reserved for that use, it will never be used by a machine on the Internet.
Another similar, more common but not officially-sanctioned name is .localdomain
. It is preferable as some systems only support .local
for names discovered by mDNS (Linux doesn't care but OSX does, thanks roima).
Alternatively, you can use a name that you pick, that isn't in use as a TLD. This has the advantage that you can use different names for different private networks.
Alternatively, you can use names under a public TLD, even if the machine isn't reachable from the Internet. This can be confusing if these names aren't recorded in the domain name system however.
For a single machine, having a domain name recorded is pretty much useless. The domain name setting is not used much. Its most common use is as a default zone to search for host names, as a default for the domain
or search
setting in /etc/resolv.conf
, i.e. when you access the host foo
, the application will try foo.localdomain
or whatever you've picked.
Setting a domain name is useful when you have multiple machines on your local network — either physical or virtual machines. If you have multiple machines, you'll probably want to set up a local name server (which doesn't require using a domain name, you can stick to dot-less host names).
Setting a distinctive domain name is useful when some of your computers have variable network connectivity, e.g. a laptop, or a computer where you sometimes use a VPN. You can then use the domain name as an indication of which network you're currently connected to.