Operating System - Linux
1824294 Members
5067 Online
109669 Solutions
New Discussion юеВ

Linux Sendmail - Hostname lookup failure

 
SOLVED
Go to solution

Linux Sendmail - Hostname lookup failure

Hi,

I need to send automatic mail from my linux machine to my smtp domain. I don't have DNS.

My hostname is host
smtp domain is smtp.domain.com

I have made following changes to sendmail.cf
- DSsmtp.domain.com
- D{M}domain.com
- Dj$w.domain.com

have added below in hosts file
x.x.x.x smtp.domain.com

/etc/nsswitch.conf
hosts files

Is that right? What else configuration is required to just send mail to user@domain.com.

When I start sendmail, it takes lot of time. And when I send mail, it says smtp.domain.com: host name lookup failure

Please help. I am lost.

Thanks in Advance,
Kusuma
8 REPLIES 8
Robert-Jan Goossens
Honored Contributor

Re: Linux Sendmail - Hostname lookup failure

Hi Kusuma,

This what I use in my sendmail.cf file (NO DNS).

DSwebmail.$m

/etc/hosts
145.x.x.15 webmail webmail.

Regards,
Robert-Jan
Muthukumar_5
Honored Contributor

Re: Linux Sendmail - Hostname lookup failure

Hai,

Did you check the hostname and smtp.domain.com with nslookup for the hostname lookup test. You will face the problem there too.

Change the format on /etc/hosts file as

x.x.x.x host smtp.domain.com

where,
host - your hostname
smtp.domain.com - Alias for sendmail

check the hostname with nslookup command.

Regards,
Muthukumar
Easy to suggest when don't know about the problem!
Ravi_8
Honored Contributor

Re: Linux Sendmail - Hostname lookup failure

Hi

your hosts file should look like this:

x.x.x.x DOMAIN HOST NAME (manchine name hosting the domain)
never give up

Re: Linux Sendmail - Hostname lookup failure

Hello Muthukumar,

Why should i put my hostname as an alias to smtpdomain? smtp.domain.com is the smtp mail server. All I want is i should be able to send mails from linux to the smtp mail server. And i can't do nslookup since i don't have dns server. I am sure it should work without that.

Regards,
Kusuma
Stuart Browne
Honored Contributor
Solution

Re: Linux Sendmail - Hostname lookup failure

If your linux box is running in a DNS-Less environment, and you don't want to use a SMART_HOST (DS) (i.e. send all mail to a mail-gateway), but you only want to send to a single host, then you can get away with one setting.

Add to '/etc/mail/mailertable':

smtp.domain.com esmtp:[ip.add.of.host]

then re-make the mailertable database.

If you have many hosts you want to send to or you want to use a SMART_HOST, then you've got a few things to change.

First, add a 'O ServiceSwitchFile=/etc/mail/service.switch' entry. This is to give sendmail an option other than DNS for host-name lookups.

In '/etc/mail/service.switch', add the entry 'hosts files' (yes, many s's).

Next, change the Resolver options in sendmail.

This is either on the 'OI' line in your cf file, or on the 'O ResolverOptions=' line. Change it to be just '-DNSRCH'.

This is to force it not to use a DNS server.

If you are using MC files (which you should be) to manage your sendmail, we're talking about the following defines:

define(`confBIND_OPTS', `-DNSRC')
define(`confSERVICE_SWITCH_FILE', `/etc/mail/service.switch')

Once like this, your system should be able to relay out like a charmer.
One long-haired git at your service...

Re: Linux Sendmail - Hostname lookup failure

Hi Staurt,

Thanks for all the help. I tried what you said. Now it says user unknown.

Pl. clarify my below doubts:
1. can't i have hostname as shortname with FQDN?

2. Actually, i want to set it up as a smart host. for which, i have done the following :

- /etc/mail/service.switch
added the entry - hosts files

- have added settings for disabling dns lookup as u mentioned in sendmail.mc

- have added DSsmtp.domain.com entry.

3. Is there anything else i hvae missed out? Pl. help. I am trying this for longtime now.

Re: Linux Sendmail - Hostname lookup failure

Thank you all so much. It is working now for one domain. Will figure out how to do it for any domains.

Regards,
Kusuma
Vitaly Karasik_1
Honored Contributor

Re: Linux Sendmail - Hostname lookup failure

Yes, we can hack sendmail in many ways in order to send emails without DNS.

But: what if tomorrow/next year administrator of domain.com will change IPs of his mailservers?

IMHO, installing caching DNS server will provide easier solution for this.

And if you don't want to install chaching DNS [it's just install, you don't need any config!] - you can just put few nameservers addresses in resolv.conf.

Rgds,
Vitaly