歡迎您光臨本站 註冊首頁

(sendmail問題)hosts已設置,但無法解析

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

(sendmail問題)hosts已設置,但無法解析

sendmail已經設置好,mail -v 測試sendmail正常,但是向外發送(abc@xxx.com)收不到郵件,查看/etc/log/maillog有如下記錄:
Mar 12 17:42:13 host-a sendmail: l2C9gDut027870: from=root, size=72, class=0, nrcpts=1, msgid=<200703120942.l2C9gDut027870@localhost.localdomain>, relay=root@localhost
Mar 12 17:42:13 host-a sendmail: l2C9gDEJ027872: from=<root@localhost.localdomain>, size=377, class=0, nrcpts=1, msgid=<200703120942.l2C9gDut027870@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=host-a
Mar 12 17:42:13 host-a sendmail: l2C9gDEJ027872: to=<abc@xxx.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=30377, relay=xxx.com., dsn=4.0.0, stat=Deferred: Name server: xxx.com.: host name lookup failure
Mar 12 17:42:13 host-a sendmail: l2C9gDut027870: to=abc@xxx.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30072, relay= , dsn=2.0.0, stat=Sent (l2C9gDEJ027872 Message accepted for delivery)

在maillog日誌中發現「host name lookup failure」記錄,但是在/etc/hosts中已經做了靜態解析:
# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1      host-a  localhost.localdomain          localhost
xx.xx.xx.xx    xxx.com mail

疑惑的是用nslookup解析不出xxx.com,但是能telnet xxx.com 的25埠:
# nslookup mail
;; connection timed out; no servers could be reached
#
#  telnet xxx.com 25
Trying xx.xx.xx.xx...
Connected to mail (xx.xx.xx.xx).
Escape character is '^]'.
220 SMTP Proxy Server Ready


為什麼telnet能進入25埠,而nslookup錯誤而且日誌報解析錯誤?請各位高手指點是哪裡出了問題?小弟實在弄不明白,謝謝!

[ 本帖最後由 wind_7th 於 2007-3-12 19:42 編輯 ]
《解決方案》

1)不是所有程序都會使用 hosts 文件的,把你的 /etc/resolv.conf 貼出來。

2)sendmail 應該是不查 hosts 文件的,都是先查 MX 記錄,沒有再查 A 記錄。
《解決方案》

謝謝樓上的dx!

這台機器沒有配置/etc/resolv.conf文件,這台機器要求不能配置dns。

sendmail的解析應該如何檢查和配置?MX記錄和A記錄在哪裡可以查到?

操作系統版本:Red Hat Enterprise Linux ES release 3 (Taroon Update 3)
《解決方案》

你所說的應該是啟用 DNS 服務吧?

resolv.conf 是 client 方面(sendmail 程序)用到的,並不需要在本機上開 DNS 服務
《解決方案》

resolv.conf原來有,內容為空,當時也出現同樣的錯誤。後來我嘗試把resolv.conf改名為了resolv.conf.bak,但是錯誤還是一樣的。

不太清楚sendmail是在哪裡進行域名解析的,對這個問題很是疑惑。
《解決方案》

內容為空自然不對(表示使用本地主機作為 name server),

你可以 gogle 一下 BIND 方面的基礎信息,或者到我的 blog 上看一下,建議從第1章看起。

http://blog.chinaunix.net/u/12066/showart.php?id=74370 (DNS 和 E-mail)
《解決方案》

我想先解決這個問題再慢慢研究。我現在把resolv.conf文件刪除了還是同樣的問題,按理沒有這個文件了就應該是用/etc/hosts解析的啊。

難道linux上的sendmail只能用dns解析地址?hpux上可以用hosts做解析的,只要不存在resolv.conf文件就行了。

望高手指點指點,謝謝!
《解決方案》

把 /etc/host.conf 的 order 改為 hosts, bind
《解決方案》

/etc/host.conf 原來就是
order hosts,bind

這個文件前面已經檢查過了,還有哪裡可能有問題?
《解決方案》

如果直接ping 該目的地呢?網路方面的呢

[火星人 ] (sendmail問題)hosts已設置,但無法解析已經有1028次圍觀

http://coctec.com/docs/service/show-post-14052.html