我正在尝试将电子邮件从我的 Debian 服务器转发到我常用的电子邮件地址。我可能错过了一些重要的东西,因为我无法在网上找到一个好的解决方案来寻找以下错误消息:
dnslookup defer (-1): host lookup did not complete
我找到了这个答案,但它对我没有帮助: https://serverfault.com/questions/370489/exim-cannot-send-to-remote-mail-servers
我有一个用户 Debian-exim:
uid=101(Debian-exim) gid=103(Debian-exim) groups=103(Debian-exim)
我不认为端口 25 在我的网络上被过滤。无论如何,我认为目前这是一个 DNS 问题。我不确定这里的以下服务器是否仍在工作并且无法找到另一个地址来测试:
telnet 209.85.225.27 25
Trying 209.85.225.27...
telnet: Unable to connect to remote host: Connection timed out
这有效:
echo "This is a test." | mail -s Testing user@localhost
这不会:
echo "This is a test." | mail -s Testing [email protected]
echo "This is a test." | mail -s Testing [email protected]
在 /var/log/exim4/mainlog 中我得到:
1YDDm0-0007mZ-BS <= [email protected] U=user P=local S=464
1YDDm0-0007mZ-BS == [email protected] R=dnslookup defer (-1): host lookup did not complete
1YDE1X-0007v5-EG <= [email protected] U=user P=local S=456
在 /etc/resolv.conf 中:
domain home
search home
nameserver 192.168.1.1
最后(有趣的部分似乎在最后):
sudo exim -bt -d-resolver [email protected]
[sudo] password for user:
Exim version 4.80 uid=0 gid=0 pid=31872 D=fbb95cfd
Berkeley DB: Berkeley DB 5.1.29: (October 25, 2011)
Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch nis nis0 passwd
Authenticators: cram_md5 plaintext
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
Compiler: GCC [4.6.3]
Library version: GnuTLS: Compile: 2.12.20
Runtime: 2.12.20
Library version: PCRE: Compile: 8.30
Runtime: 8.30 2012-02-04
Total 13 lookups
WHITELIST_D_MACROS: "OUTGOING"
TRUSTED_CONFIG_LIST: "/etc/exim4/trusted_configs"
changed uid/gid: forcing real = effective
uid=0 gid=0 pid=31872
auxiliary group list: <none>
seeking password data for user "uucp": cache not available
getpwnam() succeeded uid=10 gid=10
changed uid/gid: calling tls_validate_require_cipher
uid=101 gid=103 pid=31873
auxiliary group list: <none>
tls_validate_require_cipher child 31873 ended: status=0x0
configuration file is /var/lib/exim4/config.autogenerated
log selectors = 00000ffc 00612001
trusted user
admin user
seeking password data for user "mail": cache not available
getpwnam() succeeded uid=8 gid=8
user name "root" extracted from gecos field "root"
originator: uid=0 gid=0 login=root name=root
sender address = [email protected]
Address testing: uid=0 gid=103 euid=0 egid=103
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Testing [email protected]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering [email protected]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing [email protected]
--------> hubbed_hosts router <--------
local_part=my domain=mail.eu
checking domains
expansion of "${if exists{/etc/exim4/hubbed_hosts}{partial-lsearch;/etc/exim4/hubbed_hosts}fail}" forced failure: assume not in this list
hubbed_hosts router skipped: domains mismatch
--------> dnslookup_relay_to_domains router <--------
local_part=my domain=mail.eu
checking domains
mail.eu in "@:localhost:example.dynu.com"? no (end of list)
mail.eu in "empty"? no (end of list)
mail.eu in "! +local_domains : +relay_to_domains"? no (end of list)
dnslookup_relay_to_domains router skipped: domains mismatch
--------> dnslookup router <--------
local_part=my domain=mail.eu
checking domains
cached no match for +local_domains
cached lookup data = NULL
mail.eu in "! +local_domains"? yes (end of list)
R: dnslookup for [email protected]
calling dnslookup router
dnslookup router called for [email protected]
domain = mail.eu
DNS lookup of mail.eu (MX) gave TRY_AGAIN
mail.eu in dns_again_means_nonexist? no (option unset)
returning DNS_AGAIN
dnslookup router: defer for [email protected]
message: host lookup did not complete
[email protected] cannot be resolved at this time: host lookup did not complete
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=31872 terminating with rc=1 >>>>>>>>>>>>>>>>
有人可以帮我吗?
多谢!
答案1
exim 的标准 dnslookup 路由器使用一种算法来决定如何解析电子邮件地址(这在 Exim 手册中详细介绍的章节中有详细介绍)域名解析路由器)。看看挖掘的结果,这似乎很好:
$ dig mail.eu mx
; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> mail.eu mx
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5467
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 4
;; QUESTION SECTION:
;mail.eu. IN MX
;; ANSWER SECTION:
mail.eu. 86400 IN MX 10 in1-smtp.messagingengine.com.
mail.eu. 86400 IN MX 20 in2-smtp.messagingengine.com.
;; ADDITIONAL SECTION:
in1-smtp.messagingengine.com. 72474 IN A 66.111.4.70
in1-smtp.messagingengine.com. 72474 IN A 66.111.4.73
in1-smtp.messagingengine.com. 72474 IN A 66.111.4.72
in1-smtp.messagingengine.com. 72474 IN A 66.111.4.71
;; Query time: 33 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Mon Jan 19 16:51:24 2015
;; MSG SIZE rcvd: 158
这意味着您的本地解析器 (192.168.1.1) 要么返回 SRV 请求的 TRY_AGAIN 响应(您的 exim 配置中是否启用了 SRV),要么“负缓存”了失败的结果(当时您的 DSL 是否已关闭)发生了?)。
我建议使用开放的 DNS 服务器(例如 Google 的)来测试您的解析器,添加:
nameserver 8.8.8.8
在你之前
nameserver 192.168.1.1
语句resolv.conf
,然后尝试再次运行测试以排除此解析器响应。exim -bt [email protected]
如果使用 Google 的 DNS 缓存服务器解决了问题,则重新启动您的 DNS 解析器(192.168.1.1 处的设备)以查看是否可以解决当前问题(在重新测试之前,不要忘记注释掉 Google 缓存条目! )
如果即使使用 Google 的 DNS 缓存服务器(或者如果您不想使用外部 DNS 解析器)仍然出现错误,本章中还详细介绍了其他选项。请注意,通过添加nameserver
行全部DNS 查找将传递给 Google 进行解析。这会给 DNS 请求以及传递带来一点延迟全部您的主机将向 Google 发出的 DNS 请求 - 并非每个人都认为这是“好事”™。