标题说明了一切。我将系统上的主机名更改为 FQDN,现在 Postfix 无法启动,提示:
Sep 1 21:57:06 mailer postfix/master[4759]: fatal: bind 127.0.0.1 port 10029: Cannot assign requested address
有趣的是,错误日志中仍然显示旧名称“mailer”。我已更新配置,以便它具有新的主机名:
myhostname = mailer.xxx.com
mydomain = mailer.xxx.com
但没有快乐。
请帮忙!如果您需要任何其他信息,请告诉我...
Postconf-n:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = mailer.xxx.com
mydomain = mailer.xxx.com
myhostname = mailer.xxx.com
mynetworks = xxx.xxx.xxx.0/24, 127.0.0.0/8
myorigin = /etc/mailname
notify_classes = bounce, 2bounce, delay, policy protocol, resource, software
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_client_restrictions = permit_mynetworks, reject
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
IP地址:
1: lo: <LOOPBACK> mtu 16436 qdisc noop state DOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 40:40:4b:1c:8b:d1 brd ff:ff:ff:ff:ff:ff
inet 173.45.237.59/24 brd 173.45.237.255 scope global eth0
inet6 fe80::4240:4bff:fe1c:8bd1/64 scope link
valid_lft forever preferred_lft forever
在 /etc/hosts 中:
127.0.0.1 localhost localhost.localdomain
173.45.237.59 mailer.xxx.com
/etc/网络/接口
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
# The loopback network interface
auto lo
iface lo inet loopback
pre-up iptables-restore < iptables.up.rules
# The primary network interface
# Uncomment this and configure after the system has booted for the first time
auto eth0
iface eth0 inet static
address 173.45.237.59
netmask 255.255.255.0
gateway 173.45.237.1
dns-nameservers 173.45.224.4 173.45.224.5
答案1
添加为新答案,因为问题的主题已从 Postfix 变为一般网络问题。
我怀疑是中pre-up
的接口子句。如果该脚本 ( ) 失败,则中止处理接口。尝试将其注释掉并运行。lo
/etc/network/interfaces
iptables-restore
ifup
ifup lo
答案2
1: lo: <LOOPBACK> mtu 16436 qdisc noop state DOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
为什么那里没有 127.0.0.1?在我运行的服务器上(可以正常工作),我得到:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
作为测试,请尝试以下操作:
> nc -l -s 127.0.0.1 -v -p 12345
listening on [127.0.0.1] 12345 ...
如果你不明白,这不是 postfix 的问题 :)
答案3
请粘贴 的输出postconf -n
和ip addr
的内容/etc/hosts
。
通常,您描述的错误表示它正在尝试绑定到非本地 IP 地址。上述命令的输出应该可以帮助我们找出原因。
答案4
我刚刚遇到了完全相同的问题。Postfix 和我的 dkim 过滤器无法启动,结果发现这与环回接口关闭有关。我尝试了,ifup lo
但得到了ifup: interface lo already configured
。所以,我只是做了一个ifdown lo
,然后是一个ifup lo
。我没有收到错误消息,所以我尝试启动 dkim/postfix,一切都正常启动了。
不确定为什么重启后环回接口无法正常启动。仍然需要调查此事。