Re: [Exim] Cyrus-imapd install problems

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Greg Ward
Date:  
À: exim-users
Sujet: Re: [Exim] Cyrus-imapd install problems
On 01 August 2001, Theodore Knab said:
> These have allowed me to setup Cyrus-imapd partially, but I am not sure what else I need.
>
> /etc/hosts
> 192.168.1.111 www.breezysolutions.com breezy
> 192.168.1.111 www.annapolislinux.org annapolis
>
> Also, does this output mean that Exim is miss configured ?
> I telneted using annapolis which is aliased to annapolislinux.org, but it refers to itself as breezysolutions.com.


That's not a mail problem, it's a resolver problem. (The "resolver" is
the part of the C library that converts between hostnames and IP
addresses. Don't confuse it with DNS: it will certainly use DNS if you
ask it to, but it can also use your /etc/hosts file, NIS, NIS+, ...)

Having two lines for the same IP address in /etc/hosts looks dodgy to
me. Having two names for the same host is fine, but one of them must be
canonical. Whatever "hostname" reports is the canonical name for this
system, and it's what the host reports itself as (eg. in an SMTP
greeting).

Debian is like traditional Unices in that "hostname" reports an
unqualified name, eg. on my PC:

$ hostname
cthulhu

This comes from the /etc/hostname file:

$ cat /etc/hostname
cthulhu

which is read at boot time by /etc/init.d/hostname.sh. (Red Hat,
annoyingly, insists on putting a fully-qualified hostname in its
/etc/sysconfig/network file. This sucks if you don't have a domain
name. I *think* it's just an artifact of their config/install scripts,
though.)

The Linux "hostname" utility has the marvelous -f (--fqdn) option to
give you a fully-qualified domain name; you should probably consider
this to be your host's canonical name:

$ hostname -f
cthulhu.gerg.ca

"hostname -f" uses the resolver to work its magic. Here's an example of
what it does, using the Python interface to the resolver:

$ python
Python 2.1 (#2, May 8 2001, 10:50:59)
[GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> from socket import *
>>> gethostname()                    # like "hostname" from the shell

'cthulhu'
>>> gethostbyname_ex("cthulhu")

('cthulhu.gerg.ca', ['cthulhu', 'localhost'], ['127.0.0.1'])
>>> gethostbyname_ex("cthulhu")[0] # this is what "hostname -f" does

'cthulhu.gerg.ca'

The canonical name, alias list, and IP address returned by
gethostbyname_ex() are all determined by my /etc/hosts file:

  127.0.0.1       cthulhu.gerg.ca         cthulhu localhost


This is slightly unorthodox, but I don't know my "real" IP address -- it
comes from my cable company via DHCP, and changes every couple of
weeks. In your case, you seem to have a static IP address, so your
/etc/hosts should probably look like this:

192.168.1.111   breezy.breezysolutions.com www.breezysolutions.com breezy \ 
                www.annapolislinux.org annapolis


Note that the canonical hostname comes first; the other names are just
aliases. Putting "www" names in /etc/hosts is a bit silly; they need to
be in DNS (probably as CNAME records) so the outside world can see them,
so putting them in your /etc/hosts is just redundant.

"man hosts" for details on the hosts file.

Hope this helps --

        Greg
-- 
Greg Ward - software developer                gward@???
MEMS Exchange                            http://www.mems-exchange.org