Discussion:
Error: Name service error for localhost: Host found but no data
(too old to reply)
Tony Earnshaw
2003-11-03 15:40:47 UTC
Permalink
ping localhost is doing fine, dig localhost give me
; <<>> DiG 9.2.1 <<>> localhost
;; global options: printcmd
34921
1, ADDITIONAL: 0
;localhost. IN A
localhost. 600 IN A
127.0.0.1
localhost. 600 IN NS
localhost.
;; Query time: 3 msec
;; SERVER: 192.168.10.1#53(192.168.10.1)
;; WHEN: Mon Nov 3 22:21:42 2003
;; MSG SIZE rcvd: 57
I don't understand why it can find localhost. Isn't
it obvious that even if the machine is not connected,
localhost is resolved to 127.0.0.1 anyways?
Try: 'dig -x 127.0.0.1' and report the result here.
What does /etc/hosts look like?

--Tonni
--
Tony Earnshaw

Do not CC me or your mail will probably be rejected.
I don't like this, either. Blame it on Swen and a slow
Internet connection.

http://www.billy.demon.nl
Mail: billy-at-billy.demon.nl
Wietse Venema
2003-11-03 15:45:29 UTC
Permalink
My postfix is working fine, and the problem happens
when I tried to set up to set up clamav, spamassassin
and amavisd-new with postfix to scan virus and spam.
Spamassassin, clamav and amavisd-new seems to be
installed and started fine, but postfix is complaining
with the error
Name service error for localhost: Host found but no
data
record of requested type
add localhost to the mydestination setting, for example:

mydestination = $myhostname, localhost.$mydomain localhost

Wietse
Tony Earnshaw
2003-11-03 15:56:08 UTC
Permalink
Name service error for localhost: Host found but no
data record of requested type
Beg your pardon - this comes from an IPv6 lookup on localhost.

Why Postfix can't find localhost i don't know.

--Tonni
--
Tony Earnshaw

Do not CC me or your mail will probably be rejected.
I don't like this, either. Blame it on Swen and a slow
Internet connection.

http://www.billy.demon.nl
Mail: billy-at-billy.demon.nl
Wietse Venema
2003-11-03 16:07:13 UTC
Permalink
Post by Tony Earnshaw
Name service error for localhost: Host found but no
data record of requested type
Beg your pardon - this comes from an IPv6 lookup on localhost.
Why Postfix can't find localhost i don't know.
The SMTP client should never have to look up localhost. Instead,
localhost should be listed as a local destination in mydestination.

Wietse
Tony Earnshaw
2003-11-03 16:31:16 UTC
Permalink
Post by Wietse Venema
The SMTP client should never have to look up localhost. Instead,
localhost should be listed as a local destination in mydestination.
So "localhost = IP 127.0.0.1" is coded into Postfix?

--Tonni
--
Tony Earnshaw

Do not CC me or your mail will probably be rejected.
I don't like this, either. Blame it on Swen and a slow
Internet connection.

http://www.billy.demon.nl
Mail: billy-at-billy.demon.nl
V***@morganstanley.com
2003-11-03 16:59:33 UTC
Permalink
Post by Tony Earnshaw
Post by Wietse Venema
The SMTP client should never have to look up localhost. Instead,
localhost should be listed as a local destination in mydestination.
So "localhost = IP 127.0.0.1" is coded into Postfix?
No, "localhost" should be listed as a local destination in mydestination.
--
Viktor.
Wietse Venema
2003-11-03 17:56:37 UTC
Permalink
Post by Tony Earnshaw
Post by Wietse Venema
The SMTP client should never have to look up localhost. Instead,
localhost should be listed as a local destination in mydestination.
So "localhost = IP 127.0.0.1" is coded into Postfix?
I beg your pardon?

Some Postfix distributions have append_dot_mydomain turned off.

Consequently, mail for ***@localhost will be mis-delivered unless
localhost is listed in main.cf's mydestination parameter.

Wietse
Tony Earnshaw
2003-11-03 18:14:23 UTC
Permalink
Post by V***@morganstanley.com
Post by Tony Earnshaw
Post by Wietse Venema
The SMTP client should never have to look up localhost. Instead,
localhost should be listed as a local destination in mydestination.
So "localhost = IP 127.0.0.1" is coded into Postfix?
No, "localhost" should be listed as a local destination in mydestination.
In answer to what Wietse answered originally, I sent a reply asking how
Postfix knew what the IP of localhost was without using DNS or
/etc/hosts. Then I found that I had asked a silly question and assumed
that it consulted its own code, so I 'postsuper -d'ed it.

So how does Postfix know what the IP of localhost is?

--Tonni
--
Tony Earnshaw

Do not CC me or your mail will probably be rejected.
I don't like this, either. Blame it on Swen and a slow
Internet connection.

http://www.billy.demon.nl
Mail: billy-at-billy.demon.nl
V***@morganstanley.com
2003-11-03 18:36:24 UTC
Permalink
Post by Tony Earnshaw
Post by V***@morganstanley.com
No, "localhost" should be listed as a local destination in mydestination.
So how does Postfix know what the IP of localhost is?
To delivery mail to ***@localhost, Postfix does not need to know the IP
address of localhost. Just list "localhost" in mydestination. If it needs
the IP, the machine is misconfigured and the mail will bounce.
--
Viktor.
Wietse Venema
2003-11-03 18:38:01 UTC
Permalink
Post by Tony Earnshaw
Post by V***@morganstanley.com
Post by Tony Earnshaw
Post by Wietse Venema
The SMTP client should never have to look up localhost. Instead,
localhost should be listed as a local destination in mydestination.
So "localhost = IP 127.0.0.1" is coded into Postfix?
No, "localhost" should be listed as a local destination in mydestination.
In answer to what Wietse answered originally, I sent a reply asking how
Postfix knew what the IP of localhost was without using DNS or
/etc/hosts. Then I found that I had asked a silly question and assumed
that it consulted its own code, so I 'postsuper -d'ed it.
So how does Postfix know what the IP of localhost is?
It doesn't. Please pay attention to the Subject: line of this thread.

Q: Why does mail for ***@localhost fail with "host not found"?

A: This is a configuration error. List localhost in the main.cf
mydestination parameter, for example:

/etc/postfix/main.cf:
mydestination = $myhostname, localhost.$mydomain localhost

Postfix should never have to look up the IP address of localhost
in order to deliver mail, because localhost should be listed as
a local destination.

Wietse
Pollywog
2003-11-03 18:58:58 UTC
Permalink
On Mon, 3 Nov 2003 11:07:07 -0500 (EST)
Post by Wietse Venema
The SMTP client should never have to look up localhost. Instead,
localhost should be listed as a local destination in
mydestination.
Does this mean that localhost does not need to be listed in
"transports" ?


--
Andrew
Tony Earnshaw
2003-11-03 19:27:52 UTC
Permalink
Post by Wietse Venema
I beg your pardon?
Some Postfix distributions have append_dot_mydomain turned off.
localhost is listed in main.cf's mydestination parameter.
Wouldn't surprise me if I were proved to be more than usually dense.

If:

1: Postfix doesn't consult DNS or /etc/localhost;
2: No idea of what localhost is, is coded into Postfix:

How does Postfix know what IP localhost has?

--Tonni
--
Tony Earnshaw

Do not CC me or your mail will probably be rejected.
I don't like this, either. Blame it on Swen and a slow
Internet connection.

http://www.billy.demon.nl
Mail: billy-at-billy.demon.nl
Wietse Venema
2003-11-03 19:46:32 UTC
Permalink
Post by Pollywog
On Mon, 3 Nov 2003 11:07:07 -0500 (EST)
Post by Wietse Venema
The SMTP client should never have to look up localhost. Instead,
localhost should be listed as a local destination in
mydestination.
Does this mean that localhost does not need to be listed in
"transports" ?
Most Postfix systems don't need a transport map at all.

Wietse
Tony Earnshaw
2003-11-03 20:15:15 UTC
Permalink
Post by Wietse Venema
Post by Tony Earnshaw
In answer to what Wietse answered originally, I sent a reply asking how
Postfix knew what the IP of localhost was without using DNS or
/etc/hosts. Then I found that I had asked a silly question and assumed
that it consulted its own code, so I 'postsuper -d'ed it.
So how does Postfix know what the IP of localhost is?
It doesn't. Please pay attention to the Subject: line of this thread.
I did.
Post by Wietse Venema
A: This is a configuration error. List localhost in the main.cf
mydestination = $myhostname, localhost.$mydomain localhost
Postfix should never have to look up the IP address of localhost
in order to deliver mail, because localhost should be listed as
a local destination.
Ah. localhost is a local destination. Local destinations don't need
looking up. Nothing about localhost in 'man 8 local'.

Thanks!

--Tonni
--
Tony Earnshaw

Do not CC me or your mail will probably be rejected.
I don't like this, either. Blame it on Swen and a slow
Internet connection.

http://www.billy.demon.nl
Mail: billy-at-billy.demon.nl
Chen Shaopeng
2003-11-04 06:58:33 UTC
Permalink
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig0AC2E81DE51A00613B5D22B4
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
localhost, and localhost.$mydomain is already part
of mydestination.
Funny thing, I looked at the debug message, and
postfix
timed out trying to connect to 127.0.0.1.
This does not look like a postfix issue.

Try telnet localhost <port> to see if you can
actually connect, and do netstat -na --ip to see
some program is listening on that specific port.
If you can't telnet, postfix would time out.

Oh, if you have a firewall on that box, verify
your rules too. I fell into this one before,
knowing that my box only offered a number
of services, so I just let those ports
open, and close everything else. Took a while
to figure out that iptables also block the ports
to loopback interface too.

csp

--------------enig0AC2E81DE51A00613B5D22B4
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQE/p02obEMvPqQdkRgRAqldAJ9st6kaIA0+eTGG/8fhrVtUH7SLfQCeJ0+l
yTGd64rNT9x380+dQgw+EJ4=
=vqsY
-----END PGP SIGNATURE-----

--------------enig0AC2E81DE51A00613B5D22B4--
Tony Earnshaw
2003-11-04 08:18:41 UTC
Permalink
Post by Tony Earnshaw
Try: 'dig -x 127.0.0.1' and report the result here.
What does /etc/hosts look like?
Ok, looks like my DNS (or hosts setup) is not correct.
This is what my localhost reverse zone looks like:

$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.

1 IN PTR localhost.


600 seconds for TTL (even 86400 seconds) is ridiculously short, since
the PTR record will never change.

Relevant zone in [/var/named|/etc]/named.conf:

zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};

However, this shouldn't be necessary for Postfix's idea of localhost to
function, as has been pointed out. It *will* be necessary if you do what
you are trying with telnet or whatever, that might need a reverse lookup
(though it won't for 'telnet localhost xx'.
127.0.0.1 mail.mydomain.com localhost.localdomain
localhost
Try swapping:

127.0.0.1 localhost mail.mydomain.com

Do NOT use "localhost.localdomain" - should not exist.

--Tonni
--
Tony Earnshaw

Do not CC me or your mail will probably be rejected.
I don't like this, either. Blame it on Swen and a slow
Internet connection.

http://www.billy.demon.nl
Mail: billy-at-billy.demon.nl
Continue reading on narkive:
Loading...