Postfix 不知道自己的主機名

Postfix 不知道自己的主機名

在我的 postfix 日誌中,我經常看到 postfix 無法向 root@levinus [我的主機名稱] 發送電子郵件,因為沒有 levinus 的 DNS 記錄。但在我的 /etc/hosts 中有一個 levinus 條目(--> 127.0.0.1 和我的靜態 IP)。透過 ping,我可以聯繫到 Levinus,然後我可以 ping 自己。但是為什麼 postfix 不接受 /etc/hosts 條目呢?

後綴日誌的一部分:

BC59A2FE000B: to=<root@levinus>, relay=none, delay=0.03,    
delays=0.01/0/0.02/0, dsn=5.4.4, status=bounced (Host or domain name not   
found. Name service error for name=levinus type=AAAA: Host not found)
Oct 11 14:47:29 levinus postfix/qmgr[29217]: BC59A2FE000B: removed

/etc/hosts 的一部分:

[STATIC IP] levinus
127.0.0.1 localhost.localdomain localhost levinus

系統是Ubuntu 14.04 LTS。

//在 postfix 的 main.cfg 中編輯 inet_protocols = ipv4 。只有錯誤訊息是另一個(類型 = A)。當我將 levinus 新增至 /etc/hosts 中的 IPv6 條目 ::1 時,它是相同的(類型 = AAAA)

//編輯2後綴日誌,即使有levinus主機名稱:

Oct 12 14:40:33 levinus postfix/smtpd[10103]: connect from levinus[127.0.0.1]
Oct 12 14:40:33 levinus postfix/smtpd[10103]: disconnect from levinus[127.0.0.1]

但所有來自 root@levinus 的郵件仍然被退回。

即使我將 /etc/nsswitch.conf 編輯為hosts: files只有 postfix 也不知道自己的主機名稱。在設定為 之前hosts: files dns

答案1

問題不在於 IPv4 位址,而在於 IPv6,因為AAAA記錄不存在。

這可以透過將 postfix 切換為僅使用 IPv4 來解決。sudo postconf -e 'inet_protocols = ipv4'然後重新載入postfix。

相關內容