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

weird behaviour when sendmail solves the hostname of the relay server

Jdamian
Respected Contributor

weird behaviour when sendmail solves the hostname of the relay server

Hi

The sendmail of my node 'node5' is configured to use a relay server (suppose 'relay').

There are 2 domain names due to a company name change. Suppose 'YYY.com' is the older domain name and 'ZZZ.com' is newer one.
They both are equivalent, i.e., node5.YYY.com and node5.ZZZ.com solves to the same IP address BUT

DNS solve the relay host name differently acording to the domain name:

relay.YYY.com --> 1.1.1.7
relay.ZZZ.com --> 1.2.2.7

'node5' cannot access to 1.1.1.7 due to firewall rules, therefore, 'node5' must use relay.ZZZ.com.

NOW pay attention on the following.

The host name of 'node5' is found without domain name in /etc/sysconfig/network:

HOSTNAME=node5

it also appears in the /etc/hosts:

1.2.2.14 node5 node5.YYY.com

but in the file /etc/resolv.conf the domain name is ZZZ.com:

domain ZZZ.com

In the file /etc/mail/sendmail.cf appears

DSrelay.YYY.com

BUT the sendmail log shows the e-mail is delivered to relay.ZZZ.com (1.2.2.7) (resolved wrongly) !!!
How can it be?

The commands nslookup and ping always resolve the name relay.YYY.com to 1.1.1.7.

If I change any of the following:
1. add a domain name in /etc/sysconfig/network (for example node5.ZZZ.com)
2. change the domain name in /etc/resolv.conf (search YYY.com)
3. in the /etc/hosts file, add a domain name (node5.ZZZ.com) OR remove the alias of other domain name (removing node5.YYY.com)

the sendmail tries to deliver e-mail to relay.YYY.com (1.1.1.7) --> resolving right

I think the mixture of domain names might be the root of the sendmail problem but my skills of sendmail configuration are low.

P.D: the DNS server contains MX register pointing to relay.YYY.com

ZZZ.com mail exchanger = 10 relay.YYY.com.
3 REPLIES
Steven E. Protter
Exalted Contributor

Re: weird behaviour when sendmail solves the hostname of the relay server

Shalom,

I would change the DS directive to not use /etc/hosts or DNS to look up the relay name.

I'd hard code the IP address of node5, the relay server into the sendmail configuration.

/etc/nsswitch.conf might be doing something funky about resolve order. If you must use host name, insure that files happens in nsswitch.conf before dns and that the /etc/hosts line resolves any possible combination to the acceptable mail relay.

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

Re: weird behaviour when sendmail solves the hostname of the relay server

You give a nice scenario, but you've not told us what's exactly wrong. That is, something like "the sendmail tries to deliver to..." but I want it to deliver to...

Of course, in there, you say it's "resolving right" so I'm just totally missing the error here.

I've got the background to the problem, but what's the problem? sendmail is doing... what?
sending to the wrong server? sending with an error? not sending anything?
We are the people our parents warned us about --Jimmy Buffett
Jdamian
Respected Contributor

Re: weird behaviour when sendmail solves the hostname of the relay server

In the file /etc/mail/sendmail.cf appears

DSrelay.YYY.com

BUT the sendmail log shows the e-mail is delivered to relay.ZZZ.com (1.2.2.7) (resolved wrongly) !!!
How can it be?