Operating System - Linux
1753449 Members
6356 Online
108794 Solutions
New Discussion юеВ

Mail : Connection refused by [127.0.0.1]

 
SOLVED
Go to solution
MikeL_4
Super Advisor

Mail : Connection refused by [127.0.0.1]

Mail being sent from our Linux servers is being refused bt 127.0.0.1.. A message from the maillog follows...

Mar 3 23:56:13 spct2-12 sendmail[16395]: m244uCkA016395: to=CVGcpu@perf.dcd.convergys.com, ctladdr=adm (3/4), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=67738, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

Other mail seems to be going through fine from the servers...

What do we have setup wrong for this ??
6 REPLIES 6
Ivan Ferreira
Honored Contributor
Solution

Re: Mail : Connection refused by [127.0.0.1]

Check your firewall settings. Check your DAEMON_OPTIONS configuration in your mc file. Ensure that you can telnet to localhost on port 25.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Matti_Kurkela
Honored Contributor

Re: Mail : Connection refused by [127.0.0.1]

Sendmail should normally display the hostname in addition to the IP address, e.g. "Connection refused by localhost [127.0.0.1]".

127.0.0.1 is the standard loopback address: each server should be able to use it to reach its own services.

The loopback address should be associated with the name "localhost" in /etc/hosts. Every DNS server should also have this information. See RFC 1912, chapter 4.1:

https://community.hpe.com/t5/system-administration/mail-connection-refused-by-127-0-0-1/m-p/5095826#M49513


Is your /etc/nsswitch.conf configured to only try DNS? Or has the "localhost" line been deleted from /etc/hosts?

MK

MK
MikeL_4
Super Advisor

Re: Mail : Connection refused by [127.0.0.1]

# grep "DAEMON_OPTIONS" ./sendmail.mc
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
dnl DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')dnl
dnl DAEMON_OPTIONS(`Name=MTA-v4, Family=inet, Name=MTA-v6, Family=inet6')

# telnet localhost 25
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host: Connection refused

# cat /etc/nsswitch.conf
passwd: files ldap
shadow: files ldap
group: files ldap
hosts: files dns
bootparams: files
ethers: files
netmasks: files
networks: files
protocols: files
rpc: files
services: files
netgroup: files
publickey: files
automount: files
aliases: files

# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
10.25.88.57 spct2-12.spc.speechport.net spct2-12
MikeL_4
Super Advisor

Re: Mail : Connection refused by [127.0.0.1]

I also noticed on a server that works correctly and one that doesn't, that it is not listening for snmp....

Working server:
$ netstat -a | grep LISTEN |grep smtp
tcp 0 0 spcdist1:smtp *:* LISTEN


Non-Working:
# netstat -a | grep LISTEN |grep smtp
#
skt_skt
Honored Contributor

Re: Mail : Connection refused by [127.0.0.1]

i had don this on my RHEL AS 3 and worked. which version u r using?


sendmail.cf file coming with RH7.2 only listens on loopback interface. u can see that in netstat -an

it looks like this

tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN

I Commented following option and restarted the sendmail daemon.

O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA


Then after restarting the daemon using netstat -an.
the output changed to

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN

My mail now works
MikeL_4
Super Advisor

Re: Mail : Connection refused by [127.0.0.1]

Thanks