356 lines
13 KiB
HTML
356 lines
13 KiB
HTML
<!--startcut ======================================================= -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<html>
|
|
<head>
|
|
<TITLE>The Answer Guy 31: 'sendmail' requires DNS ... won't use /etc/hosts</TITLE>
|
|
</head>
|
|
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
|
|
ALINK="#FF0000">
|
|
<!--endcut ========================================================= -->
|
|
<H4>"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
<P> <hr> <P>
|
|
|
|
<!-- =============================================================== -->
|
|
<H1 align="center"><A NAME="answer">
|
|
<img src="../gx/dennis/qbubble.gif" alt="" border="0" align="middle">
|
|
<a href="./index.html">The Answer Guy</a>
|
|
<img src="../gx/dennis/bbubble.gif" alt="" border="0" align="middle">
|
|
</A></H1> <BR>
|
|
<H4 align="center">By James T. Dennis,
|
|
<a href="mailto:linux-questions-only@ssc.com">linux-questions-only@ssc.com</a><BR>
|
|
Starshine Technical Services,
|
|
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A> </H4>
|
|
<p><hr><p>
|
|
<H3><img src="../gx/dennis/qbub.gif" alt="(?)" width="50" height="28"
|
|
align="left" border="0">'<tt>sendmail</tt>' requires DNS ...
|
|
won't use /etc/hosts</H3>
|
|
|
|
<p><strong>From Carlos Javier Castro Pe\qa on Fri, 03 Jul 1998
|
|
|
|
Hi,
|
|
<br><br>
|
|
|
|
I have been looking for an answer for my question for a long time,
|
|
but I could find no useful solution. I am building a Linux LAN and I
|
|
cannot send mail with <tt>sendmail</tt> ! I do not have a DNS server. I have
|
|
found a lot of people with the same problem and no answer.
|
|
<br><br>
|
|
|
|
I am using Red Hat 5 with the version of sendmail distributed by
|
|
them. My kernel 2.0.33 and networking enabled. The mails don't get
|
|
delivered because a 'hostname lookup failure'. The manual of Red Hat
|
|
5 says how to configure <tt>sendmail</tt>, but that does not work if you
|
|
don't have a DNS server. I was also suggested to change the
|
|
<tt>/etc/nsswitch.conf</tt> file, but it didn't work. Can you help me,
|
|
please?
|
|
<br><br>
|
|
|
|
Regards, javier
|
|
</strong></p>
|
|
|
|
<blockquote><img src="../gx/dennis/bbub.gif" alt="(!)" width="50" height="28"
|
|
align="left" border="0">
|
|
I understand your problem and feel your pain.
|
|
<br><br>
|
|
|
|
The problem is that '<tt>sendmail</tt>' is conforming to the
|
|
SMTP standards --- which require that it look up the
|
|
MX record for any host prior to sending mail to it.
|
|
<br><br>
|
|
|
|
This sort of record (MX) can only be served over DNS (there
|
|
isn't any way that I know of to mark an <tt>/etc/hosts</tt> entry as an
|
|
"MX" record) (There might be some weird NIS or NIS+ way to do it
|
|
-- but I don't know much about those protocols).
|
|
<br><br>
|
|
|
|
I've worked around that here at my house (I don't run DNS
|
|
internally --- I just point to a caching DNS server on my
|
|
gateway router (a Linux box doing masquerading for
|
|
<strong>external</strong> references).
|
|
<br><br>
|
|
|
|
Internally I just use a mailertable that relays all mail from my
|
|
systems to the mail router (which then spools them out over
|
|
uucp). That mailertable refers to the gateway system using its
|
|
IP address (which forces <tt>sendmail</tt> to skip the DNS MX query). On
|
|
another system I just use uucp over TCP (for outgoing mail) and
|
|
POP (for incoming).
|
|
<br><br>
|
|
|
|
It would be much easier for me to set up DNS and leave it at
|
|
that -- but I can be incredibly stubborn sometimes and my main
|
|
mail feed is over uucp in any event --- so it's just as easy to
|
|
use that internally.
|
|
<br><br>
|
|
|
|
The reason modifying your <tt>/etc/nsswitch.conf</tt> (or
|
|
<tt>/etc/host.conf</tt>
|
|
--- as it's usually done under the Linux resolvers) doesn't work
|
|
for <tt>sendmail</tt> --- but does work for normal programs using other
|
|
protocols is that other protocols are normally only interested
|
|
in address and reverse address records (using the
|
|
<tt>gethostbyname()</tt> and
|
|
<tt>gethostbyadd()</tt> library calls). '<tt>sendmail</tt>'
|
|
is looking for MX records since it is common to require special
|
|
routing for mail.
|
|
<br><br>
|
|
|
|
As I said --- the easiest solution is to create a local DNS
|
|
domain or subdomain for yourself. For example I'd create the
|
|
<tt>lan.starshine.org</tt> domain and name my local systems things like
|
|
<tt>antares.lan.starshine.org</tt> etc. This would allow me to set up an
|
|
"authoritive" set of records on my internal LAN and still defer
|
|
to my ISP for the virtually hosted <tt>www.starshine.org</tt>
|
|
<tt>ftp.starshine.org</tt>, and <tt>mail.starshine.org</tt> (I'd
|
|
list myself as an
|
|
"unregistered secondary" to my ISP's nameservers for the
|
|
<tt>starshine.org</tt> zone).
|
|
<br><br>
|
|
|
|
(I could also just copy his records into my own db and
|
|
essentially <strong>lie</strong> to my system about being
|
|
authoritative for the
|
|
whole zone. This would break any time my ISP changed any of my
|
|
publicly accessible address records --- but that would probably
|
|
only be a minor issue. It would only affect my systems while
|
|
they were resolving my virtual hosts. My ISP would never refer
|
|
to my name servers as authorities or secondaries --- and I could
|
|
use IPFW (now IPChains) to prevent any such requests from
|
|
getting through to my internal nameserver in any event).
|
|
<br><br>
|
|
|
|
The point is that SMTP (the mail transport protocol to which
|
|
sendmail defaults) relies on DNS --- and it is not trivial to
|
|
get SMTP working with DNS disabled. You can use a different
|
|
transport protocol (such as I do with uucp) or you can configure
|
|
your systems to use direct IP addresses rather than names
|
|
in their configuration files. This last option isn't so
|
|
bad if your plan is to set up masquerading and null clients
|
|
(a sort of sendmail client that forward <strong>all</strong> of its mail
|
|
to a hub, even the local addressed items -- and lets the
|
|
hub deal with it).
|
|
<br><br>
|
|
|
|
Naturally I'm glossing over the details here. I have the
|
|
<a href="http://www.ora.com/">O'Reilly</a>
|
|
'sendmail' and 'DNS & BIND' books here at my side
|
|
--- and I have the notes from a week long seminar I took
|
|
on these topics (Robert Harker ---
|
|
<A HREF="http://www.harker.com">http://www.harker.com</A>)
|
|
--- which are also about 1000 pages. It is basically
|
|
impossible to comprehensively explain DNS and <tt>sendmail</tt> in
|
|
this column, or on the newsgroups and mailing lists.
|
|
<br><br>
|
|
|
|
I hope though that this helps. If you like I'll post
|
|
(sanitized) copies of my <tt>sendmail.mc</tt> files and my
|
|
uucp configuration files to show a couple of examples of
|
|
how I do it --- with the warning that my configuration is
|
|
uniquely atypical!
|
|
</blockquote>
|
|
<p><hr width="40%"></p>
|
|
<H3><img src="../gx/dennis/qbub.gif" alt="(?)" width="50" height="28"
|
|
align="left" border="0">More on:
|
|
'sendmail' requires DNS ... won't use /etc/hosts</H3>
|
|
|
|
<p><strong>From Carlos Javier Castro Pe\qa on Thu, 09 Jul 1998
|
|
<br>Also posted in Newsgroups:</strong>
|
|
<a href="news:comp.unix.questions">comp.unix.questions</a>
|
|
</strong></p>
|
|
|
|
<p><strong>
|
|
Dennis,
|
|
</strong></p>
|
|
|
|
<p><strong>
|
|
Thank you for your answer. Maybe the most important thing is that
|
|
you let me know that I cannot use sendmail for my purpouses wihthout
|
|
a DNS server. If I knew that from the beginning, I would have spared
|
|
a lot of time trying different configurations. If you don't mind,
|
|
I'll post your answer in some Linux mailing lists, because a lot of
|
|
people has the same question, and there is no usefull answer.
|
|
</strong></p>
|
|
|
|
<blockquote><img src="../gx/dennis/bbub.gif" alt="(!)" width="50" height="28"
|
|
align="left" border="0">
|
|
Like the rest of the Linux Gazette all of my articles
|
|
are covered by the LDP GPL (the variation of the GNU
|
|
General Public License that is applied to the Linux
|
|
Documentation Project). Please feel free to post, copy,
|
|
modify, publish, sell, spindle, mutilate, cite it to
|
|
your heart's content.
|
|
</blockquote>
|
|
|
|
<blockquote>
|
|
I hope it helps. I don't get into the newsgroups as much
|
|
as I'd like (and I spend a bit more of my time in the
|
|
<a href="news:comp.text.tex">comp.text.tex</a> and
|
|
<a href="news:comp.unix.security">comp.unix.security</a> and
|
|
<a href="news:comp.unix.admin">comp.unix.admin</a>
|
|
groups when I do make it out there).
|
|
</blockquote>
|
|
|
|
<blockquote>
|
|
Over the years I've always drifted from one newsgroup
|
|
and mailing list to another (except for the security stuff
|
|
--- I always stay up on that, though mostly as a "lurker").
|
|
For awhile I was the most frequent poster on the
|
|
<a href="news:comp.lang.awk">comp.lang.awk</a>
|
|
(formerly the alt.lang.awk) newsgroup. About 5 years ago
|
|
I was in the top 5 or 10 posted on
|
|
<a href="http://www.compuserve.com/">Compuserve</a>'s "UNIXFORUM"
|
|
</blockquote>
|
|
|
|
<blockquote>
|
|
I start by reading and lurking. When I've read for a few
|
|
weeks (and usually done some experimentation and other research)
|
|
I start to recognize the common questions, and start to piece
|
|
things together. After about a month I start answering questions.
|
|
For a few months I'll answer questions in the NG or ML. Eventually,
|
|
I move on.
|
|
</blockquote>
|
|
|
|
<blockquote>
|
|
That turns out to have been good experience for answering
|
|
questions in LG --- since the run the gamut of Unix, Linux,
|
|
and PC related questions.
|
|
</blockquote>
|
|
|
|
<p><strong><img src="../gx/dennis/qbub.gif" alt="(?)" width="50" height="28"
|
|
align="left" border="0">
|
|
<font color="navy"><em> You can use a different
|
|
transport protocol (such as I do with uucp) or you can configure
|
|
your systems to use direct IP addresses rather than names
|
|
in their configuration files. This last option isn't so
|
|
bad if your plan is to set up masquerading and null clients
|
|
(a sort of sendmail client that forward <em>all</em> of its mail
|
|
to a hub, even the local addressed items -- and lets the
|
|
hub deal with it).
|
|
</em></font></strong></p>
|
|
|
|
<p><strong>
|
|
Is it possible to make that sendmail uses IP addresses. I need to
|
|
forward the mail of the Linux host, to the Linux gateway. The users
|
|
of the Linux host can download the mail from the gateway with POP
|
|
and IMAP.
|
|
</strong></p>
|
|
|
|
<blockquote><img src="../gx/dennis/bbub.gif" alt="(!)" width="50" height="28"
|
|
align="left" border="0">
|
|
I think the one time I did this was with a slight variant
|
|
of the "<tt>clientproto.mc</tt>" file that ships with
|
|
'<tt>sendmail</tt>'
|
|
</blockquote>
|
|
|
|
<blockquote>
|
|
It looks like this:
|
|
</blockquote>
|
|
|
|
<pre>
|
|
divert(-1)
|
|
divert(0)dnl
|
|
VERSIONID(`@(#)clientproto.mc 8.7 (Berkeley) 3/23/96')
|
|
|
|
OSTYPE(linux)
|
|
FEATURE(nullclient, `[192.168.1.1]')
|
|
</pre>
|
|
|
|
<blockquote>
|
|
... replacing the IP address with the one for your
|
|
smart hub or gateway. You use the m4 package (also
|
|
include with all recent versions of sendmail) to generate
|
|
a cf file from this using a command like:
|
|
</blockquote>
|
|
|
|
<blockquote><blockquote><code>
|
|
m4 ../m4/cf.m4 betel.mc > /etc/sendmail.cf
|
|
</code></blockquote></blockquote>
|
|
|
|
<blockquote>
|
|
(after making backups of your existing cf file, of course).
|
|
</blockquote>
|
|
|
|
<blockquote>
|
|
The important thing is that is will define a line like:
|
|
</blockquote>
|
|
|
|
<pre>
|
|
DM[192.168.64.1.1]
|
|
</pre>
|
|
|
|
<blockquote>
|
|
... which should prevent '<tt>sendmail</tt>' from using DNS to
|
|
do any resolution.
|
|
</blockquote>
|
|
|
|
<blockquote>
|
|
Try that and see if it works. I really can't set up a test
|
|
environment for that at the moment. If that doesn't work, try
|
|
changing the address to an arbitrary name, adding the
|
|
"mailertable" <tt>FEATURE</tt> and creating a small mailertable that
|
|
points the name at the IP address using the syntax:
|
|
</blockquote>
|
|
|
|
<blockquote><blockquote><code>
|
|
myhub: smtp:[192.168.1.1]
|
|
</code></blockquote></blockquote>
|
|
|
|
<blockquote>
|
|
Please let me know how it goes.
|
|
</blockquote>
|
|
|
|
<!--================================================================-->
|
|
<P> <hr> <P>
|
|
<H5 align="center"><a href="http://www.linuxgazette.com/copying.html"
|
|
>Copyright ©</a> 1998, James T. Dennis <BR>
|
|
Published in <I>Linux Gazette</I> Issue 31 August 1998</H5>
|
|
<P> <hr> <P>
|
|
<!--================================================================-->
|
|
<table width="98%"><tr valign="center" align="center">
|
|
<td rowspan="3"><A HREF="./lg_answer31.html"><IMG
|
|
SRC="../gx/dennis/answernew.gif"
|
|
ALT="[ Answer Guy Index ]"></A></td>
|
|
<td><A HREF="tag_backup.html">backup</A></td>
|
|
<td><A HREF="tag_uidgid.html">uidgid</A></td>
|
|
<td><A HREF="tag_connect.html">connect</A></td>
|
|
<td><A HREF="tag_95slow.html">95slow</A></td>
|
|
<td><A HREF="tag_badblock.html">badblock</A></td>
|
|
<td><A HREF="tag_trident.html">trident</A></td>
|
|
<td><A HREF="tag_sound.html">sound</A></td>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<td><A HREF="tag_kernel.html">kernel</A></td>
|
|
<td><A HREF="tag_solprint.html">solprint</A></td>
|
|
<td><A HREF="tag_idescsi.html">idescsi</A></td>
|
|
<td><A HREF="tag_distrib.html">distrib</A></td>
|
|
<td><A HREF="tag_modem.html">modem</A></td>
|
|
<td><A HREF="tag_NDS.html">NDS</a></td>
|
|
<td><A HREF="tag_rpm.html">rpm</A></td>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<td><A HREF="tag_guy.html">guy</A></td>
|
|
<td><A HREF="tag_maildns.html">maildns</A></td>
|
|
<td><A HREF="tag_memleak.html">memleak</a></td>
|
|
<td><A HREF="tag_multihead.html">multihead</A></td>
|
|
<td><A HREF="tag_cdr.html">cdr</A></td>
|
|
</tr></table>
|
|
<P> <hr> <P>
|
|
<!--================================================================-->
|
|
<A HREF="./index.html"><IMG SRC="../gx/indexnew.gif"
|
|
ALT="[ Table Of Contents ]"></A>
|
|
<A HREF="../index.html"><IMG SRC="../gx/homenew.gif"
|
|
ALT="[ Front Page ]"></A>
|
|
<A HREF="lg_bytes31.html"><IMG SRC="../gx/back2.gif"
|
|
ALT="[ Previous Section ]"></A>
|
|
<A HREF="./searls.html"><IMG SRC="../gx/fwd.gif"
|
|
ALT="[ Next Section ]"></A>
|
|
<!--startcut ======================================================= -->
|
|
</body>
|
|
</html>
|
|
<!--endcut ========================================================= -->
|
|
|
|
|