Operating System - HP-UX
1748227 Members
4308 Online
108759 Solutions
New Discussion юеВ

Re: sendmail relay and DNS query

 
Mike Lynch_4
Occasional Contributor

sendmail relay and DNS query

A bit of a newbie to sendmail..

I want to configure sendmail to relay
all non-local mail to an MS-Exchange server

The exchange mail server is set up in /etc/hosts

I have added the mail server hostname to sendmail.cf
DSmymailserver.mydomain.com

I do not have DNS set up on this machine i.e. I can't do an nslookup on yahoo.com or anything like that.

The hosts line of /etc/nsswitch.conf looks like this :
hosts: files [NOTFOUND=continue TRYAGAIN=continue] dns

Whenever I try to send mail to a non-local address I get a "Name Server Timeout Error"

When I remove dns from nsswitch.conf it works fine.
This is what I do not understand.
Why does it bother trying DNS when I have a relay server configured ?
When DNS lookup fails why does it not then go to the relay server ?

I know that having dns in the nsswitch.conf file is a bit redundant but I would have though that it did not matter as I was routing all non-local mail to MS Exhange.
12 REPLIES 12
Christopher Caldwell
Honored Contributor

Re: sendmail relay and DNS query

The qualification and canonicalization of the name are used to:
1) determine mail routing
2) deal with security/anti-spam measures

What's in resolv.conf?

What do the source and destination e-mail addresses look like (are they qualified or un-qualified; local, non-local, both)?
Steven E. Protter
Exalted Contributor

Re: sendmail relay and DNS query

Procedure:

In /etc/mail/sendmail.cf

At the DS directive

DS
[IP_addr_of_Exchange_server]

save it

/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start

The IP of the HP box must be explicitly set up in the Exchange server to allow relay. By default, Exchange WILL NOT allow it.

Diagnostic.

sendmail -v -d8.99 -d38.99 mail@yourdomain.net



type a message



.



This will give you good diagnostics so you can tell whether its a network problem or Exchange is rejecting the mail.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Bill Douglass
Esteemed Contributor

Re: sendmail relay and DNS query

sendmail will try to log the IP address of the sending host. This is probably what is causing the DNS look-ups.

Your nsswitch.conf is not redundant, it's broken. You're telling all deamons on the system that dns is available as a fallback for name service. Since this is not true, any service that wants to look up a host IP not in your /etc/hosts file will try DNS-based look-ups, and eventually time out.

Change your hosts line to read

hosts: files

and you should have fewer problems.
Steven E. Protter
Exalted Contributor

Re: sendmail relay and DNS query

If it works okay when the DNS entry is removed, my fix will correct the issue.

To keep environments from needing regular modifications of the /etc/hosts file, many organizations are going to a DNS first setup in name resolution. It allows you to change network configuration at a more central point.

sendmail can either use DNS to resolve mail destination or relay to an explicit IP address. It can probably do a lot of other things, but those are the two I know.

If the exhcange server is handling outbound mail, my previous post will finish it for you. If this HP box needs to route mail to the public Internet, then you need to have working DNS entries in /etc/resolv.conf

I would use the same DNS servers as the outbound Microsoft Exchange box uses if available.

I think the DS directive will solve your current issue, though it would be nice if DNS worked too.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Geoff Wild
Honored Contributor

Re: sendmail relay and DNS query

# Relay all non-local mail to the "Smart" relay host (DS) via smtp: #
# #
# This macro is optional. If you wish to send all non-local mail #
# to a smart relay via SMTP just set macro S (DS) to the name of the #
# smart relay. If this macro is not set, then all mail addresses to #
# a non-local user will be send to the relay. #

DSyourexchangeservername

You may also want to set the DM macro in your sendmail.cf:

DMyourdomain.com


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Bryan D. Quinn
Respected Contributor

Re: sendmail relay and DNS query

Hey Mike,

I am not by any means a sendmail guru, but I did have to set it up to relay to an MS-Exchange server a couple of months ago. When I read your post I went back and looked at my sendmail.cf file because I know I had some issues with my setup also. I noticed above the DS portion in the sendmail.cf file that I had this info in there also:
#My official domain
Dj$w.yourdomain.com
Also, in my sendmail.cw I have the following appended to the end of the file
hostname
hostname.yourdomain.com

I don't know if this will help you, but it probably would not hurt.

Oh, and as for my nsswitch.conf file, this is what my hosts line looks like:
hosts: files [NOTFOUND=continue] dns

One last thing, make sure that you have an entry in your /etc/hosts file for your MS Exchange server.

I will look back in my notes and see if I can find anymore info that might help you.

Hope this helps!
-Bryan
Bryan D. Quinn
Respected Contributor

Re: sendmail relay and DNS query

Hey Mike,

I am not by any means a sendmail guru, but I did have to set it up to relay to an MS-Exchange server a couple of months ago. When I read your post I went back and looked at my sendmail.cf file because I know I had some issues with my setup also. I noticed above the DS portion in the sendmail.cf file that I had this info in there also:
#My official domain
Dj$w.yourdomain.com
Also, in my sendmail.cw I have the following appended to the end of the file
hostname
hostname.yourdomain.com

I don't know if this will help you, but it probably would not hurt.

Oh, and as for my nsswitch.conf file, this is what my hosts line looks like:
hosts: files [NOTFOUND=continue] dns

One last thing, make sure that you have an entry in your /etc/hosts file for your MS Exchange server.

I will look back in my notes and see if I can find anymore info that might help you.

Hope this helps!
-Bryan
Bryan D. Quinn
Respected Contributor

Re: sendmail relay and DNS query

Hey Mike,

I am not by any means a sendmail guru, but I did have to set it up to relay to an MS-Exchange server a couple of months ago. When I read your post I went back and looked at my sendmail.cf file because I know I had some issues with my setup also. I noticed above the DS portion in the sendmail.cf file that I had this info in there also:
#My official domain
Dj$w.yourdomain.com
Also, in my sendmail.cw I have the following appended to the end of the file
hostname
hostname.yourdomain.com

I don't know if this will help you, but it probably would not hurt.

Oh, and as for my nsswitch.conf file, this is what my hosts line looks like:
hosts: files [NOTFOUND=continue] dns

One last thing, make sure that you have an entry in your /etc/hosts file for your MS Exchange server.

I will look back in my notes and see if I can find anymore info that might help you.

Hope this helps!
-Bryan
Bryan D. Quinn
Respected Contributor

Re: sendmail relay and DNS query

Hey Mike,

I am not by any means a sendmail guru, but I did have to set it up to relay to an MS-Exchange server a couple of months ago. When I read your post I went back and looked at my sendmail.cf file because I know I had some issues with my setup also. I noticed above the DS portion in the sendmail.cf file that I had this info in there also:
#My official domain
Dj$w.yourdomain.com
Also, in my sendmail.cw I have the following appended to the end of the file
hostname
hostname.yourdomain.com

I don't know if this will help you, but it probably would not hurt.

Oh, and as for my nsswitch.conf file, this is what my hosts line looks like:
hosts: files [NOTFOUND=continue] dns

One last thing, make sure that you have an entry in your /etc/hosts file for your MS Exchange server.

I will look back in my notes and see if I can find anymore info that might help you.

Hope this helps!
-Bryan