![Postfix 使用接口别名而不是主接口](https://linux22.com/image/31101/Postfix%20%E4%BD%BF%E7%94%A8%E6%8E%A5%E5%8F%A3%E5%88%AB%E5%90%8D%E8%80%8C%E4%B8%8D%E6%98%AF%E4%B8%BB%E6%8E%A5%E5%8F%A3.png)
使用 /usr/sbin/sendmail 发送电子邮件时(例如,使用脚本),Postfix 导致使用主机的接口别名之一发送邮件(eth0:0, 74.50.122.55)而不是使用主接口(eth0,66.232.99.54)...
[root@www ~]# cat test.msg
To: [email protected]
Subject: This is a bogus e-mail
This is a bogus e-mail.
[root@www ~]# sendmail -t -i < test.msg
电子邮件标题的结果如下:
Return-Path: <[email protected]>
Received: from www.rocket-powered.com ([74.50.122.55])
by mx.google.com with ESMTPS id c4si14411712yhe.53.2013.04.13.11.39.16
(version=TLSv1 cipher=RC4-SHA bits=128/128);
Sat, 13 Apr 2013 11:39:16 -0700 (PDT)
Received-SPF: fail (google.com: domain of [email protected] does not designate 74.50.122.55 as permitted sender) client-ip=74.50.122.55;
Authentication-Results: mx.google.com;
spf=hardfail (google.com: domain of [email protected] does not designate 74.50.122.55 as permitted sender) [email protected]
Received: by www.rocket-powered.com (Postfix, from userid 0)
id CA46D39412D; Sat, 13 Apr 2013 18:32:14 +0000 (UTC)
From: [email protected]
To: [email protected]
Subject: This is a bogus e-mail
为什么 Postfix 使用接口别名(eth0:0, 74.50.122.55)而不是使用主界面(eth0,66.232.99.54)?
FWIW:通过 SMTP 提交发送的电子邮件通常使用主接口(eth0,66.232.99.54)。例如,
Return-Path: <[email protected]>
Received: from www.rocket-powered.com (rocket-powered.com. [66.232.99.54])
by mx.google.com with ESMTPS id s61si9056793yhd.296.2013.04.13.17.28.36
(version=TLSv1 cipher=RC4-SHA bits=128/128);
Sat, 13 Apr 2013 17:28:36 -0700 (PDT)
Received-SPF: pass (google.com: domain of [email protected] designates 66.232.99.54 as permitted sender) client-ip=66.232.99.54;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of [email protected] designates 66.232.99.54 as permitted sender) [email protected]
Received: from www.rocket-powered.com (localhost [IPv6:::1])
by www.rocket-powered.com (Postfix) with ESMTPA id 979D23940F7
for <[email protected]>; Sun, 14 Apr 2013 00:21:33 +0000 (UTC)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
s=default; d=rocket-powered.com;
b=Y5YVbjb5mXPJgyDkMjXdanWRCM4gdEjIdbgouOpDJ6hEAObGcaokpiidfhc29lvBezLyZL06++gL1oyd+bjrywd1I9sqlB0i5Tfjig2ufKLEizcSeyTkDWjm/jKP6TIy;
h=Date:To:From:Reply-To:Subject:Message-ID:X-Priority:X-Mailer:MIME-Version:Content-Type;
Date: Sun, 14 Apr 2013 00:21:33 +0000
To: Fred Flintstone <[email protected]>
From: "Rocket-Powered.com" <[email protected]>
Reply-To: "Rocket-Powered.com" <[email protected]>
Subject: Welcome
答案1
你需要设置inet_interfaces
到您希望 Postfix 使用的接口的地址或相应的主机名。根据您希望 Postfix 通过哪些接口(IP 地址)接收邮件,您可能只想在 master.cf 中为 SMTP 客户端服务设置此选项。我喜欢确保myhostname
设置正确,然后用它来设置inet_interfaces
:
smtp unix - - n - - smtp
-o inet_interfaces=$myhostname
请注意,SMTP 客户端服务和 SMTP 服务器守护程序之间的区别master.cf
很微妙;后者已smtpd
在结尾的线。