[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Determining FQDN (was Re: Yow, Madduck!)



On Fri, Jan 11, 2002 at 05:05:42PM -0600, Richard Cobbe wrote:
| Lo, on Thursday, January 10, dman did write:
| 
| <SNIP>
| 
| One minor nit to pick from an otherwise very good explanation (and I
| wouldn't bother, except that I've been bitten by this before).
| 
| > This directive tells exim to use that name as the hostname in the SMTP
| > greeting (HELO/EHLO) instead of that reported by the gethostbyname() C
| > function (which returns the first thing after 127.0.0.1 in
| > /etc/hosts).
| 
| <SNIP>
| 
| Not quite.  gethostbyname() returns the host record for whatever name or
| address you supply as a parameter.  I think, although I'm not actually
| certain, that by default, MTAs like exim use the machine's FQDN on the
| HELO/EHLO line.

Yes, by default exim uses the result of uname() or gethostbyname() in
the EHLO line.

| Finding the FQDN is a somewhat complicated process:

Somewhat.  Here's what I learned from my experiences :

/etc/hosts :
    127.0.0.1  localhost dman
/etc/hostname :
    dman
/etc/resolv.conf
    domain ddts.net

So my machine is "dman.ddts.net", right?  Not quite.

The uname() function only returns "dman".  Since it doesn't contain
any dots, exim continues with gethostbyname() to find the FQHN.

| 2) Pass this value to gethostbyname(3)

That's an interesing choice.  When I was testing out the results to
see what this function does, I passed "localhost" to gethostbyname().

I found that gethostbyname() returned the first thing in the 127.0.0.1
line.  That was why exim was using "localhost" in gethostbyname() (and
hotmail's mx handlers were rejecting that).  When I put
"dman.ddts.net" as the first entry on the 127.0.0.1 line, exim
(correctly) used that in the EHLO line.

The easiest, but not wholly correct, solution was to set
"primary_hostname" in exim.conf.  After determining the above, though,
I corrected /etc/hosts so that all programs can properly determine the
FQHN.

| In either situation, the order of the hostnames on the line *is*
| signficant!

Right.

-D

-- 

It took the computational power of three Commodore 64s to fly to the moon.
It takes at least a 486 to run Windows 95.
Something is wrong here.



Reply to: