Click to See Complete Forum and Search --> : Force sendmail to relay through specific host


singlespeed
06-21-2004, 01:08 PM
I've got an internal RH server running sendmail. I'm a Qmail man myself, sendmail is just too much a pain in the butt to learn but I have no time to setup qmail on this new server.

The problem I have is that to send mail from this server (which I need to do for admin stuff, reports, logs etc...) It does an MX lookup for Foo.org.

the sendmail server is on foo.net.

Our mail relay server's real IP is 10.96.1.2 which is a private internal IP. Our firewall NAT's our external address for the mail server, the one you get when you do an nslookup to that private ip..

the problem is, becuase the public "Official" ip is a NAT on the firewall, our internal servers can't get to it.

So how do I force sendmail to relay all mail through a specific server at an IP address.

I tried putting in:

DSrelay:mail.foo.org

and then adding:

10.96.1.2 maill.foo.org

to the /etc/hosts file but this didn't work (yes I did restart sendmail).

any suggestions?

thanks,

jeff

mdwatts
06-22-2004, 01:06 PM
Let's move this to the Networking forum in hopes one of our 'kind' network experts will be able to offer assistance.

singlespeed
06-22-2004, 01:41 PM
Thanks MD!

mdwatts
06-22-2004, 02:48 PM
No problem.

No quarantees, but you will stand a better chance with the networking crowd. :)

jumpedintothefire
06-22-2004, 07:14 PM
Should sendmail not do that by default???

FEATURE(`nullclient', `10.96.1.2 ')dnl

added to the sendmail.mc file "should" do that, (i'd need to see the rest of the file to be sure...) remember to do the M4 thing.. and restart sendmail

http://www.lagmonster.org/docs/sendmailrules.html has a nullclient setup near the bottom.

singlespeed
06-23-2004, 03:12 PM
Thanks JITF I'll give that a shot...

singlespeed
06-25-2004, 10:02 AM
JITF,

when I run the M4 I get the following...

[root@mis02tc07927 log]# m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
*** FEATURE(local_procmail) must occur before MAILER(local)


I can't find "MAILER(local)" in the file anywhere...

mdwatts
06-25-2004, 01:21 PM
I did a G4L search for 'sendmail.cf mailer' and the first hit

http://www.faqs.org/docs/linux_network/x14661.html

shows MAILER(`local').

singlespeed
06-25-2004, 01:44 PM
MD,

That's all well and good but the point is, I'm getting an error that to me (and I could be wrong) indicates that I have the MAILER(`local') entry in the wrong place. In fact, it doesn't exist....

even if I add MAILER(`local') to the sendmail.mc file, it still returns the same error.

Modorf
06-25-2004, 03:53 PM
what about adding this line:

define(`SMART_HOST', `other.mail.server.foo.org')

this page should help:
http://www.sendmail.org/m4/masquerading_relaying.html

singlespeed
06-25-2004, 03:58 PM
Did that but when I run the M4 command I get the error message noted above. I restarted sendmail but still no good.

jumpedintothefire
06-26-2004, 11:04 AM
include(`/usr/share/sendmail-cf/m4/cf.m4') is at the top of the mc file right? Do you have the sendmail-cf rpm installed?

linnov
06-26-2004, 02:42 PM
Just add this line to your sendmail.cf and restart it

# "Smart" relay host (may be null)
DSother.mail.server.foo.org

singlespeed
06-28-2004, 03:07 PM
Linnov,

as I've stated furhter up in the thread that doesn't work becuase the sending server is behind the firewall and does a DNS lookup for any server I put in that setting.

When it does the DNS lookup it gets the real world IP address of the relay server (which is NAT'd by our firewall) but can't reach that address because they are both behind the firewall.

relay server:

outside IP NAT'd by firewall: 207.99.x.x
Real (Inside) IP: 10.96.1.2

What I need to do is force sendmail to relay through an IP address I give it OR
use the local hosts file instead of a dns MX lookup.

Jeff

linnov
06-28-2004, 03:31 PM
I'd do it the easy way and give it a hosts record and point it to the 10. addy

singlespeed
06-28-2004, 03:42 PM
Linnov,

I DID give it a hosts file. Sendmail ignors the /etc/hosts file..

linnov
06-28-2004, 04:27 PM
u may wanna look @ doing it via iptables nat rules wise

http://www.netfilter.org/documentation/HOWTO//NAT-HOWTO.html

http://www.netfilter.org/documentation/HOWTO//netfilter-double-nat-HOWTO.html

singlespeed
06-28-2004, 05:03 PM
Linnov,

I appreciate your attemps to help but you don't seem to understand the situation.

Please re-read the entire thread before posting again.

The firewall is an external device, that is doing the NAT'ing. I'm not using IPTables on the system sending the email.....

jumpedintothefire
09-19-2004, 07:28 AM
I'm bad, sendmail needs to have [] around the "server name" so it won't do a dns lookup, and use the literal ip. Works the same for smarthost also.

FEATURE(`nullclient', `[10.96.1.2] ')dnl