[olug] FQDN in Debian

Christopher Cashell topher at zyp.org
Thu Jan 9 08:18:48 UTC 2003


At Wed, 08 Jan 03, Unidentified Flying Banana Eric Penne, said:
> I am redoing my webserver with Debian.  The hostname of the PC will be
> webserver and the domain name is thepennes.net but how do I set that in
> Debian?  i don't think it is all supposed to go into /etc/hostname and
> google searches mention putting it in /etc/hosts but that sounds wrong.
>  I thought it might need to be put in /etc/network/option but I am
> having trouble finding any info on that file.

The quickest thing to do is what Phil Brutsche mentioned in his post,
and most of the time, that will work for you.  That's the short answer.
;-)

Here's the long answer. ;-)

The file /etc/hostname does generally contain your fully qualified
domain name (FQDN).  However, the only time that file is usually read is
during boot up.  Some applications will use this information later on,
as well, but most of them use a slightly more complicated process.

The typical way to properly get a FQDN is by calling gethostbyname() on
the hostname returned by gethostname().

What this means is that how you change your domain name will vary
depending on your setup.  Your configuration can (usually) be determined
by examining the file /etc/host.conf.  This file determines the order in
which different "services" are consulted for name information.  Usually
it will list 'hosts' first, which means that it will first check the
/etc/hosts file.  The next entry is usually 'bind', which tells the system
to do an actual DNS lookup request to find the name.  Sometimes you will
also see 'nis', if your configuration makes use of NIS.

Assuming that your /etc/host.conf file has a line something like
"order hosts,bind", then editing the /etc/hosts file will set your
domain name (for your lookups!).

To really change it, for everyone, you'll need to make sure that the DNS
entries match up to what you have.  So, in summary, you should update
/etc/hostname and /etc/hosts.  Depending on what you're doing, you'll
prolly also want to updated the "domain" line in /etc/resolv.conf, if
you want to be able to give a simple hostname and have it interpreted to
be hostname.default-domain-name.com.

Luckily, though, Debian actually makes this easier than all of the
above. ;-)

What you can do is 'apt-get install etherconf', and it will use DebConf
(the standard Debian package configuration system) to prompt you for the
information needed to set up your networking. . . including host/domain
names and IP addies.  If you've already installed etherconf, you can
make changes with 'dpkg-reconfigure etherconf'.

I hope this clears things up. . . and if you actually read to the end of
the (long) e-mail, you can use etherconf and have your changes made in
30 seconds. <g>

> Eric

--
| Christopher
+------------------------------------------------+
| A: No.                                         |
| Q: Should I include quotations after my reply? |
+------------------------------------------------+




More information about the OLUG mailing list