System Administration
Showing results for 
Search instead for 
Did you mean: 

Mail : Connection refused by []

Go to solution
Super Advisor

Mail : Connection refused by []

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

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

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

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

Re: Mail : Connection refused by []

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?
Honored Contributor

Re: Mail : Connection refused by []

Sendmail should normally display the hostname in addition to the IP address, e.g. "Connection refused by localhost []". 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:

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

Super Advisor

Re: Mail : Connection refused by []

# grep "DAEMON_OPTIONS" ./
DAEMON_OPTIONS(`Port=smtp,Addr=, 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
telnet: connect to address 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. localhost.localdomain localhost spct2-12
Super Advisor

Re: Mail : Connection refused by []

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

# netstat -a | grep LISTEN |grep smtp
Honored Contributor

Re: Mail : Connection refused by []

i had don this on my RHEL AS 3 and worked. which version u r using? file coming with RH7.2 only listens on loopback interface. u can see that in netstat -an

it looks like this

tcp 0 0* LISTEN

I Commented following option and restarted the sendmail daemon.

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

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

tcp 0 0* LISTEN

My mail now works
Super Advisor

Re: Mail : Connection refused by []