This year I moved from MS Windows to Ubuntu Linux, to Arch Linux, and finally to OpenBSD, which I'm rather enjoying.

During the installation I was asked to provide a host-name, and domain-name. Can anyone come up with a terse explanation of the their significance?

e.g. Suppose I made my hostname "bilbo" and my domainname "shire.middleearth" (is that period even necessary?) I know that "bilbo@shire.middleearth" is me, I'm "bilbo", in the TLD "middleearth", in the subdomain "shire" ... but what does THAT mean? How can I just go making up domain names? I thought I had to register to get those. If someone wanted to send mail to that address how would the DNS servers know where to look?

If you never connect to the Internet, you can use anything you want for a domain name. The default, you'll note, is "my.domain" which is not usable on the Internet.

Leaving the Internet OUT of the discussion for the moment:

Domain names are, however, tied to DNS -- domain name resolution to IP address. Some applications will attempt to resolve your fully qualified name, such as bilbo.shire.middle-earth. If that name is not provisioned in a DNS server (and you may have one, Internet or not) you must use file based resolving -- the /etc/hosts file.

On the Internet:

If your OpenBSD platform is publicly exposed to the Internet -- you can use the domain name that resolves to that IP address.

If your OpenBSD platform has an indirect connection, such as on a private IP network, you can use /etc/hosts or your own DNS servers to resolve bilbo.shire.middle-earth.

Am I correct in thinking this? And if I registered a new domain name, would it then take the place of my router's domain name? Something about this doesn't seem right!

If my computer is in a private network with about 2 other computers, it would seem completely unnecessary to specifying the domain name during OpenBSD installation (i.e. if all the computers share the router's domain name, then really they just need unique hostnames; in the above example, the domain middleearth, mtdoom, and shire, are useless)

To be honest, I didn't really know what to put when OpenBSD asked so for a domain name I put "^_^" which it gladly accepted (I installed disconnected from my LAN) so now I'm wondering what if I set up two computers with OpenBSD with exactly the same hostname and domain name?

*looks up* hmm, sorry for the longish reply, and thanks in advance (again) to anyone that cares to give their input!

First, it's user@host.domain.name -- this is not what you have been considering.

Second, you are right. If it is a private network, or no network at all, you do not need a domain name. But you will still need the name to resolve, via DNS or via /etc/hosts files.

Example: Two computers, "Barbie" and "Ken" are on a private network together. Barbie is at 10.0.0.1, and Ken is at 10.0.0.2.

Obviously, in order for Barbie to reach Ken, applications must either use the 10.0.0.2 IP address, or resolve "Ken" to 10.0.0.2.

What is not quite so clear is that Barbie needs to know it is at 10.0.0.1. This is done through the resolver, which points to DNS server(s), or to the /etc/hosts file, or to both -- in the order you choose. See the resolv.conf(5) man page.

There are many network applications that look up their host name (fully qualified -- meaning including the domain name if there is one) to figure out their own IP address.

You can change your hostname (and domain name) at any time. It's in the /etc/hostname file. See the hostname(5) man page. But what you put in /etc/hosts or in your DNS server configurations should match it.

Both Barbie and Ken need to be able to resolve each other's IP addresses. But they also need to be able to resolve their own.

(I'm still not sure which mechanism is responsible for ensuring hosts share and learn the host/domain names of other hosts in a LAN--likely some type of ARP protocol methinks--but that I can discover myself.)

One last lingering obscurity remains...while it makes perfect sense on a scale as large as the Internet, is there any practical reason for hosts in small LANs to have domain names???

...is there any practical reason for hosts in small LANs to have domain names???

For communication between hosts, one would need to identify other hosts by IP address unless the hosts file is appropriately configured or a DNS server is in place. While the technically oriented can remember a number of hosts numerically, most people can better deal with descriptive names.

Quote:

***Comon people, don't make jggimi answer ALL the questions!***

You are making the assumption that this site has members who can answer questions live as they are posted. This isn't always true; in fact, it is rarely the case. Most members can only check once or twice a day which means that any questions asked are much more likely of getting an answer sometime within 24 hours, not within minutes.

There is no automatic propagation of host names, as has been repeated several times.

During installation when you specify your hostname as "bilbo" no other system is made aware of this name, systems on your internal network must list this hostname in their /etc/hosts file or it must be added to a local resolver.. for example your router might intercept requests for "shire.middleearth" and if "bilbo" is known it would return the IP.

Before the existence of DNS servers all known host/domain names were distributed in a large /etc/hosts file, "hosts" were publicly addressable on the Internet as part of a "domain", for example a university or college.

Also, I'd recommend not using underslashes as part of a host or domain name as their violation of the RFC specifications (..which you may wish to read), basically just avoid choosing a domain name that is on the public Internet, as you'll be unable to reach them.

A small helpful man page exists that attempts to explain the concept of "hostnames" which themselves are just special forms of "domain names", see hostname(7).

ARP is used only on and among local subnets -- to convert IP addresses to MAC addresses (the serial number of the NIC, if you will) and MAC addresses to IP addresses.

A local DNS server can replace or supplement various /etc/hosts files, or their equivalents on each OS. It can also act as a "local network resolver cache" for resolutions of Internet addresses made by requests from machines on the local network. A request from "Barbie" to resolve the IP address for yahoo.com can be obtained from the local server by "Ken".

But even the DNS server needs to have at least two records for every host provisioned -- one for each direction: IP address to name, name to IP address. This is usually a manual operation, but because DNS is designed to be a tree of servers, each server in most cases only needs a small, humanly managed configuration. And yes, the Internet's DNS, if you combine all the servers interconnected by it, is a very, very large tree.

... just avoid choosing a domain name that is on the public Internet, as you'll be unable to reach them.

Exactly so. Hence be sure to avoid choosing a top level domain (TLD) from this list.

What has always puzzled me is that the IANA (or whoever is in charge of deciding these things), apparently has not reserved at least one TLD permanently for private use, i.e., guaranteed that it won't ever be used on the public internet. (Although there have been some suggestions for private name space.) This would be the analog, for domain names, of the well known private IP addresses like 10.x.x.x etc. Since the name space is effectively infinite, the cost of reserving a piece of it would seem negligible.

it's a little disappointing that the OpenBSD installation let me set my domain-name to "^_^"

I can't claim that I can give a definitive reason why this is the case other than:

The domain name is written to /etc/myname. If you want to change it, open up the file as root or preferably through sudo(8) or su(1).

The installation process is done simply by a shell script. The community sees this as a plus. The installation script is not meant to save users from themselves. It is meant to be a minimalistic tool which gets the job done.

It is also worth repeating that while the OpenBSD developers do make the results of their efforts available to the public with a minimum of restrictions (meaning the BSD license...), the target audience of OpenBSD is the OpenBSD developers themselves. The rest of us sponge off their work. The stated goals of the project can be found at the following: