Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendmail 8.12 Connection refused by localhost

Status
Not open for further replies.

dslnut01

Technical User
Jan 25, 2003
3
US
I have been searching through the forum and haven't seen a solution to my problem yet.

I am using Redhat 8.0 with Sendmail 8.12. Anytime I try and send a email local or outside my machine, I get this:

Connecting to localhost.xxx.com. via relay...
Deferred: Connection refused by localhost.xxx.com.

I didn't have any problems under RH 7.2.

I have tried modifying the access file and also adding the

FEATURE(`relay_local_from')dnl to my sendmail.mc

when I added the above line, I couldn't get the sendmail.cf to compile correctly. My head is getting sore from banging it on the desk.


Any Suggestions?

Mark
 
It will usually give you a worning message when you use that feature because sendmail feels it's a security issue. It should compile though. If you have a line(s) that start with DAEMON_OPTIONS, you need to delete those or comment them out by putting a "dnl" in front of them. These will make sendmail only work locally. Look for /etc/mail/local-host-names. This should list all the hostnames and domainnames local to your server. When you open it, it should look like this:

localhost
localhost.localdomain
server (name you gave this machine)
yourdomain.com

Then you need to edit /etc/mail/access. It should look like this:

localhost RELAY
yourdomain.com RELAY
server RELAY
username RELAY (username is your system user name)

The 2 main ones are localhost and yourdomain. The others should be included within them. If you edit sendmail.mc or access, you need to run the following commands:

m4 /etc/mail/sendmain.mc > /etc/mail/sendmail.cf

makemap hash /etc/mail/access.db < /etc/mail/access

You don't have to do anything with local-host-names after editing it. You will have to restart sendmail though to get it to read the new sendmail.cf file.

 
Thanks for the responce RhythmAce. I tried everything you meantioned and I am still getting the same error. I loaded RH 7.2 on an old machine and didn't have any problems with running sendmail locally, but Redhat 8.0 doesn't seem to be working for me. Could I be missing something else?

 
Hmmmm. That was pretty much my best shot. :) The error suggests to me that sendmail doesn't know that localhost and your hostname are the same machine. Sendmail thinks the hostname is localhost according to the error. If you open /etc/hosts, it will have a line like the following:

127.0.0.1 localhost localhost.localdomain

This is the loopback device. The first name after the ip is the hostname for that device and the rest are aliases. The ip for your eth0 device should also be listed with your hostname and any domains you may be hosting. Since eth0 is the device internet traffic comes in on, that is the one sendmail looks at first. If none is found, it will default to the loopback device for its name. This file should look a lot like local-host-names.
 
I loaded a spare machine with RH 8.0 and found the problem has something to do with when the hostname is changed. I thought I changed everything you meantion with no go. I will go back through your replies and see if I did miss something and hopefully that will fix my problem.
 
Since its been a couple of months, you probably already have this fixed. I had a similar problem, and it turned out that it was my SMTP port options line, read like this...

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Addr=10.0.0.2, Name=MTA')

When it should read like this...

DAEMON_OPTIONS(`Port=smtp,Name=MTA')

When no Addr is listed, it listens to all. I don't know how you would make it listen to multiple IPs though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top