![POSTFIX 无法启动提示:绑定 0.0.0.0 端口 25:地址已在使用中](https://linux22.com/image/733132/POSTFIX%20%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%E6%8F%90%E7%A4%BA%EF%BC%9A%E7%BB%91%E5%AE%9A%200.0.0.0%20%E7%AB%AF%E5%8F%A3%2025%EF%BC%9A%E5%9C%B0%E5%9D%80%E5%B7%B2%E5%9C%A8%E4%BD%BF%E7%94%A8%E4%B8%AD.png)
抱歉,我已阅读了大量相关主题,但没有找到针对我的问题的解决方案。
今天早上突然 POSTFIX 没有响应。我没有在服务器上进行任何特殊操作。
POSTFIX 状态显示:
postfix.service - LSB: Postfix Mail Transport Agent
Loaded: loaded (/etc/init.d/postfix)
Drop-In: /run/systemd/generator/postfix.service.d
└─50-postfix-$mail-transport-agent.conf
Active: active (exited) since Sat 2019-02-02 13:40:22 CET; 10s ago
Process: 19382 ExecStop=/etc/init.d/postfix stop (code=exited, status=0/SUCCESS)
Process: 19398 ExecStart=/etc/init.d/postfix start (code=exited, status=0/SUCCESS)
Feb 02 13:40:22 ns339072.ip-188-165-253.eu postfix[19398]: Starting Postfix Mail Transport Agent: postfix.
Feb 02 13:40:22 ns339072.ip-188-165-253.eu systemd[1]: Started LSB: Postfix Mail Transport Agent.
Feb 02 13:40:22 ns339072.ip-188-165-253.eu postfix/master[19507]: fatal: bind 0.0.0.0 port 25: Address already in use
说端口 25 已经在使用但我找不到是谁使用的?
我的服务器上未激活 sendmail。
netstat -lnp |grep :25
不返回任何内容
后配置-n:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
home_mailbox = Maildir/
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
mydestination = $myhostname, localhost.$mydomain, $mydomain
mydomain = bilp.fr
myhostname = mail.bilp.fr
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $mydomain
readme_directory = no
recipient_delimiter = +
sender_bcc_maps = hash:/etc/postfix/bcc
sender_dependent_default_transport_maps = hash:/etc/postfix/dependent
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
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
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = hash:/etc/postfix/virtual
在/etc/网络/接口:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo eth0 eth0:1 eth0:2 eth0:3 eth0:4 eth0:5 eth0:6 eth0:7 eth0:8 eth0:9
iface lo inet loopback
iface eth0 inet static
address 188.165.253.141
netmask 255.255.255.0
broadcast 188.165.253.255
gateway 188.165.253.254
iface eth0 inet6 static
address 2001:41d0:0002:c88d::
netmask 64
dns-nameservers 2001:41d0:3:163::1
post-up sleep 5; /sbin/ip -family inet6 route add 2001:41d0:0002:c8ff:ff:ff:ff:ff dev eth0
post-up sleep 5; /sbin/ip -family inet6 route add default via 2001:41d0:0002:c8ff:ff:ff:ff:ff
pre-down /sbin/ip -family inet6 route del default via 2001:41d0:0002:c8ff:ff:ff:ff:ff
pre-down /sbin/ip -family inet6 route del 2001:41d0:0002:c8ff:ff:ff:ff:ff dev eth0
iface eth0:1 inet static
address 188.165.53.208
netmask 255.255.255.0
broadcast 188.165.53.255
network 188.165.53.0
iface eth0:2 inet static
address 149.202.31.242
netmask 255.255.255.0
broadcast 149.202.31.255
network 149.202.31.0
iface eth0:3 inet static
address 178.33.162.237
netmask 255.255.255.0
broadcast 178.33.162.255
network 178.33.162.0
iface eth0:4 inet static
address 178.32.54.176
netmask 255.255.255.0
broadcast 178.32.54.255
network 178.32.54.0
iface eth0:5 inet static
address 149.202.114.212
netmask 255.255.255.0
broadcast 149.202.114.255
network 149.202.114.0
iface eth0:6 inet static
address 149.202.115.224
netmask 255.255.255.0
broadcast 149.202.115.255
network 149.202.115.0
iface eth0:7 inet static
address 46.105.76.217
netmask 255.255.255.0
broadcast 46.105.76.255
network 46.105.76.0
iface eth0:8 inet static
address 91.121.34.20
netmask 255.255.255.0
broadcast 91.121.34.255
network 91.121.34.0
iface eth0:9 inet static
address 94.23.45.172
netmask 255.255.255.0
broadcast 94.23.45.255
network 94.23.45.0
IP地址:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 42:6a:1c:b2:03:b5 brd ff:ff:ff:ff:ff:ff
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 92:0b:61:9e:4a:1c brd ff:ff:ff:ff:ff:ff
4: ifb0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 32
link/ether ea:d2:75:2b:ec:b0 brd ff:ff:ff:ff:ff:ff
5: ifb1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 32
link/ether c2:c6:f1:b0:2b:72 brd ff:ff:ff:ff:ff:ff
6: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether a4:bf:01:00:ca:15 brd ff:ff:ff:ff:ff:ff
inet 188.165.253.141/24 brd 188.165.253.255 scope global eth0
valid_lft forever preferred_lft forever
inet 188.165.53.208/24 brd 188.165.53.255 scope global eth0:1
valid_lft forever preferred_lft forever
inet 149.202.31.242/24 brd 149.202.31.255 scope global eth0:2
valid_lft forever preferred_lft forever
inet 178.33.162.237/24 brd 178.33.162.255 scope global eth0:3
valid_lft forever preferred_lft forever
inet 178.32.54.176/24 brd 178.32.54.255 scope global eth0:4
valid_lft forever preferred_lft forever
inet 149.202.114.212/24 brd 149.202.114.255 scope global eth0:5
valid_lft forever preferred_lft forever
inet 149.202.115.224/24 brd 149.202.115.255 scope global eth0:6
valid_lft forever preferred_lft forever
inet 46.105.76.217/24 brd 46.105.76.255 scope global eth0:7
valid_lft forever preferred_lft forever
inet 91.121.34.20/24 brd 91.121.34.255 scope global eth0:8
valid_lft forever preferred_lft forever
inet 94.23.45.172/24 brd 94.23.45.255 scope global eth0:9
valid_lft forever preferred_lft forever
inet6 2001:41d0:2:c88d::/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::a6bf:1ff:fe00:ca15/64 scope link
valid_lft forever preferred_lft forever
7: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether a4:bf:01:00:ca:16 brd ff:ff:ff:ff:ff:ff
8: teql0: <NOARP> mtu 1500 qdisc noop state DOWN group default qlen 100
link/void
9: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1
link/ipip 0.0.0.0 brd 0.0.0.0
10: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN group default qlen 1
link/gre 0.0.0.0 brd 0.0.0.0
11: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
12: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1
link/sit 0.0.0.0 brd 0.0.0.0
13: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN group default qlen 1
link/tunnel6 :: brd ::
在 /etc/hosts 中:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
188.165.253.141 ns339072.ip-188-165-253.eu ns339072
2001:41d0:0002:c88d:: ns339072.ip-188-165-253.eu ns339072
# The following lines are desirable for IPv6 capable hosts
#(added automatically by netbase upgrade)
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
postconf-M:
188.165.253.141:smtp inet n - - - - smtpd -o smtpd_sasl_auth_enable=yes
smtp inet n - - - 1 postscreen
smtp4 unix - - - - - smtp -o inet_protocols=ipv4
pickup unix n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr unix n - n 300 1 qmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
relay unix - - - - - smtp
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail unix - n n - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
188.165.253.141:submission inet n - - - - smtpd -o smtpd_sasl_auth_enable=yes
91.121.34.20:smtp inet n - - - - smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_cert_file=/home/terrasse-bois/ssl.cert - o smtpd_tls_key_file=/home/terrasse-bois/ssl.key
127.0.0.1:smtp inet n - - - - smtpd -o smtpd_sasl_auth_enable=yes
91.121.34.20:submission inet n - - - - smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_cert_file=/home/terrasse-bois/ssl.cert -o smtpd_tls_key_file=/home/terrasse-bois/ssl.key
127.0.0.1:submission inet n - - - - smtpd -o smtpd_sasl_auth_enable=yes
178.33.162.237:smtp inet n - - - - smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_cert_file=/home/pergola_comoconstruir/ssl.cert -o smtpd_tls_key_file=/home/pergola_comoconstruir/ssl.key
178.33.162.237:submission inet n - - - - smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_cert_file=/home/pergola_comoconstruir/ssl.cert -o smtpd_tls_key_file=/home/pergola_comoconstruir/ssl.key
178.32.54.176:smtp inet n - - - - smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_cert_file=/home/pergola.howtodiyhome/ssl.cert -o smtpd_tls_key_file=/home/pergola.howtodiyhome/ssl.key
178.32.54.176:submission inet n - - - - smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_cert_file=/home/pergola.howtodiyhome/ssl.cert -o smtpd_tls_key_file=/home/pergola.howtodiyhome/ssl.key
以 root 身份执行 netstat -ntlp 命令:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:8012 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8013 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8014 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 1522/dovecot
tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN 1544/sshd
tcp 0 0 0.0.0.0:8015 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 1/init
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 2582/perl
tcp 0 0 0.0.0.0:8016 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8017 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8018 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8019 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8020 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8021 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 1499/named
tcp 0 0 0.0.0.0:8022 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8023 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8024 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8025 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 1499/named
tcp 0 0 0.0.0.0:8026 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8027 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8028 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8029 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8030 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8031 0.0.0.0:* LISTEN 944/php-fpm: pool 1
tcp 0 0 0.0.0.0:20000 0.0.0.0:* LISTEN 2580/perl
tcp 0 0 0.0.0.0:8032 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8033 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8001 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8034 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8002 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8003 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8004 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8005 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8006 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8007 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 127.0.0.1:10023 0.0.0.0:* LISTEN 1479/postgrey.pid -
tcp 0 0 0.0.0.0:8008 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 2247/mysqld
tcp 0 0 0.0.0.0:8010 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp 0 0 0.0.0.0:8011 0.0.0.0:* LISTEN 1795/php-fpm.conf)
tcp6 0 0 :::110 :::* LISTEN 1522/dovecot
tcp6 0 0 :::2222 :::* LISTEN 1544/sshd
tcp6 0 0 :::143 :::* LISTEN 1/init
tcp6 0 0 :::10000 :::* LISTEN 2582/perl
tcp6 0 0 :::80 :::* LISTEN 2217/apache2
tcp6 0 0 ::1:53 :::* LISTEN 1499/named
tcp6 0 0 ::1:953 :::* LISTEN 1499/named
tcp6 0 0 :::443 :::* LISTEN 2217/apache2
我尝试重启服务器。没有进展。
请帮忙!
答案1
您似乎正在尝试在不同的 IP 地址上运行不同的 TLS 证书。您已配置为使用不同的 TLS 证书master.cf
来应答特定 IPv4 地址的smtp
和端口。submission
但是,您还保留了原始smtp
行,出于某种原因,该行设置为调用postscreen
。此行触发错误。它无法绑定到 INADDR_ANY,因为特定的 IP 地址侦听器已绑定。这就是您收到错误的原因。而您在或输出Address already in use
中看不到任何内容的原因是因为 Postfix 退出并且地址未绑定。netstat
lsof
您应该将那一行注释掉master.cf
。