1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
|
<!--startcut ======================================================= -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<META NAME="generator" CONTENT="lgazmail v1.4F.u">
<TITLE>The Answer Gang 80: How to send email without a DNS server?</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"
LINK="#3366FF" VLINK="#A000A0">
<!--endcut ========================================================= -->
<P> <hr>
<!--startcut ======================================================= -->
<CENTER>
<!-- *** BEGIN navbar *** -->
<!-- *** END navbar *** -->
</CENTER>
</p>
<!--endcut ========================================================= -->
<!--startcut ======================================================= -->
<P> <hr>
<!-- begin tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::-->
<p align="center">
<table width="100%" border="0"><tr>
<td align="right" valign="center"
><IMG ALT="" SRC="../../gx/navbar/left.jpg"
WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="middle" border="0"
><A HREF="../index.html"
><IMG SRC="../../gx/navbar/toc.jpg" align="middle"
ALT="[ Table Of Contents ]" border="0"></A
><A HREF="../lg_answer.html"
><IMG SRC="../../gx/dennis/answertoc.jpg" align="middle"
ALT="[ Answer Guy Current Index ]" border="0"></A></td>
<td align="center" valign="center"><A HREF="../lg_answer.html#greeting"><img align="middle"
src="../../gx/dennis/smily.gif" alt="greetings" border="0"></A>
<A HREF="../tag/bios.html">Meet the Gang</A>
<A HREF="1.html">1</A>
<A HREF="2.html">2</A>
<A HREF="3.html">3</A>
<A HREF="4.html">4</A>
<A HREF="5.html">5</A>
<A HREF="6.html">6</A>
<A HREF="7.html">7</A>
</td>
<td align="left" valign="center"><A HREF="../../tag/kb.html"
><IMG SRC="../../gx/dennis/answerpast.jpg" align="middle"
ALT="[ Index of Past Answers ]" border="0"></A
><IMG ALT="" SRC="../../gx/navbar/right.jpg" align="middle"
WIDTH="14" HEIGHT="45" BORDER="0"></td></tr></table>
</p>
<!-- end tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<!--endcut ========================================================= -->
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<center>
<H1><A NAME="answer">
<img src="../../gx/dennis/qbubble.gif" alt="(?)"
border="0" align="middle">
<font color="#B03060">The Answer Gang</font>
<img src="../../gx/dennis/bbubble.gif" alt="(!)"
border="0" align="middle">
</A></H1>
<BR>
<H4>By Jim Dennis, Ben Okopnik, Dan Wilder, Breen, Chris, and...
(<a href="tag/bios.html">meet the Gang</a>) ...
the Editors of Linux Gazette...
and You!
<br>Send questions (or interesting answers) to
The Answer Gang
for possible publication
(but read the <a href="../tag/ask-the-gang.html">guidelines</a> first)
</H4>
</center>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<p><hr><p>
<!-- begin 2 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>How to send email without a DNS server?</H3>
<p><strong>From Faber Fedor
</strong></p>
<p align="right"><strong>Answered By John Karns, Mike "Iron" Orr, Mike Martin, Heather Stern, Ben Okopnik
</strong></p>
<P><STRONG>
Hi Gang!
</STRONG></P>
<P><STRONG>
A client of mine is discovering the Joy That Is Linux. He recently
asked me if it was possible to send email from applications (written in
JBASE, a PICK shell that runs on Linux). I mentioned that you could do
this:
</STRONG></P>
<P><STRONG><CODE>
mail -s "Some Subject" user1@domain.com < output_from_app
</CODE></STRONG></P>
<P><STRONG>
and he was impressed. He has since come up with several time- and
resource-savings applications of that simple redirection to the mail
command.
</STRONG></P>
<P><STRONG>
He has raised an intersting (to me) question and although I can come up
with two solutions, I'm looking for a better one. Also, it's generated
a question that I can't answer, hence this posting.
</STRONG></P>
<P><STRONG>
The question is: How do you send mail between two linux boxen if there
is no DNS server from which to query for an MX record?
</STRONG></P>
<P><STRONG>
Now, I'm not asking for the impossible here. The two boxen run
sendmail/postfix and they are on the same internal network (the sender
is 10.10.10.1 and the receiver is 10.10.10.2).
</STRONG></P>
<P><STRONG>
I could tell him to install a DNS server, which he would do (I love
clients that listen to me
<IMG SRC="../../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle"> but there should be a simpler solution.
We could send the email to a local user on .1 and fetchmail the mail
from .2, but that's too much of a kludge for my taste.
</STRONG></P>
<P><STRONG>
I've been through the HOWTOS and google and didn't find anything
applicable (at this point Ben walks in, donning his mirrored
sunglasses, executes a google search using 1.5 words (without quotes),
finds The Canonical Page that answers this question and makes me look
like a fool (again
<IMG SRC="../../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle">).
</STRONG></P>
<P><STRONG>
Ideas?
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
<mock growl> Don't <EM>do</EM> that, Faber; the fact that one of us has the
answer <em> _does not</em> make the rest of us look like fools. Unproductive
attitude there, sir. Me, I'm always happy when I see one of the other
Gangsters come up with an answer to something I don't know (how d'you
think I <EM>got</EM> this smart?
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> - I get to learn stuff, which is a very
good thing indeed.
</blockQuote>
<blockquote><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] half a search word?
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</blockquote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Iron]
mail remote_user@10.10.10.2
</blockQuote>
<blockQuote>
Some mail transfer agents may balk at it, but I've found it to work
most of the time.
</blockQuote>
<blockquote><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] Works even better if the IP address is in brackets:
remote_user@[10.10.10.2]
</blockquote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Mike]
Also, you can put the domain names in the poor man's DNS: <TT>/etc/hosts.</TT>
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Mike Martin]
Assuming that the network is small with no server (as implied)
<TT>/etc/hosts</TT> is the right idea
</blockQuote>
<blockQuote>
If you are sending externally you would need a DNS either locally or
via the isp anyway
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
"<TT>/etc/hosts</TT>", or maybe even a lightweight local (caching?) DNS. I'm
coming to really like PDNSD; painless to install, dirt-simple to set up.
Or, you could always use "ssmtp" to rotate the mail off the local hosts
to the actual MTA, since it's local; that's my solution (farm the job
out to the guy who's good at it.)
</blockQuote>
<blockquote><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] Yes, you can use /etc/hosts, but it can't do an MX record lookup. Your
smtp daemon will need some
tweaking. In sendmail you can tell it that transport for a given named host
will go through an explicit IP address host, and
then it would never try an MX lookup, just use the burned in route.
</blockquote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [John]
Depending on the distro, distro version, and MTA you're using ...
</blockQuote>
<blockQuote>
Using <A HREF="http://www.suse.com/">SuSE</A> 7.x & sendmail, and a psuedodomain I use, I've come up with the
following solution to that problem:
</blockQuote>
<blockQuote><CODE>
edit /etc/mailertable to add entries like the following
</CODE></blockQuote>
<blockquote><pre>mylinuxServer1.my.domain smtp:mylinuxServer1.my.domain
mylinuxServer2.my.domain smtp:mylinuxServer2.my.domain
</pre></blockquote>
<blockQuote>
I don't have DNS setup, as the servers are isolated, but sendmail via
dialup. I do have the hostnames listed in the hosts file on each server
though. In this way, any mail addressed to user@mylinuxServer1.my.domain
only goes out when connected to that server.
</blockQuote>
<blockquote><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] The postfix equivalent to that is /etc/postfix/transports, although
that's actually mentioned in /etc/postfix/main.cf to activate it, so you
could name the file anything you like.
</blockquote>
<blockquote>You can't use nullmailer for these even if it's only two boxes, because
that won't accept mail for local deliveries. You could keep all the mail
on only one of 'em and use nullmailer on the rest of the machines though.
At that point the machine becomes a very tiny server and also needs to run
a pop or IMAP daemon to allow mail pickup. At which point you may as well
also set up a dummy local DNS, maybe for a silly domain name that won't be
used by the outside world because there are no root servers for it, like
fabershouse.local -- which would serve A and MX records for say...
livingroom.fabershouse.local, den.fabershouse.local, etc.
</blockquote>
<blockquote>You could skip mail and drop notes in a samba share at each other, or
ssh in and share a kibitz session using your favorite text editor. Which
means somebody becomes a server but may bother people a lot less.
</blockquote>
<!-- end 2 -->
<P> <hr> </p>
<!-- *** BEGIN copyright *** -->
<H5 align="center">This page edited and maintained by the Editors
of <I>Linux Gazette</I>
<a href=""
>Copyright ©</a> 2002
<BR>Published in issue 80 of <I>Linux Gazette</I> July 2002</H5>
<H6 ALIGN="center">HTML script maintained by
<A HREF="mailto:star@starshine.org">Heather Stern</a> of
Starshine Technical Services,
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
</H6>
<!-- *** END copyright *** -->
<!--startcut ======================================================= -->
<P> <hr>
<!-- begin tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::-->
<p align="center">
<table width="100%" border="0"><tr>
<td align="right" valign="center"
><IMG ALT="" SRC="../../gx/navbar/left.jpg"
WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="middle" border="0"
><A HREF="../index.html"
><IMG SRC="../../gx/navbar/toc.jpg" align="middle"
ALT="[ Table Of Contents ]" border="0"></A
><A HREF="../lg_answer.html"
><IMG SRC="../../gx/dennis/answertoc.jpg" align="middle"
ALT="[ Answer Guy Current Index ]" border="0"></A></td>
<td align="center" valign="center"><A HREF="../lg_answer.html#greeting"><img align="middle"
src="../../gx/dennis/smily.gif" alt="greetings" border="0"></A>
<A HREF="../tag/bios.html">Meet the Gang</A>
<A HREF="1.html">1</A>
<A HREF="2.html">2</A>
<A HREF="3.html">3</A>
<A HREF="4.html">4</A>
<A HREF="5.html">5</A>
<A HREF="6.html">6</A>
<A HREF="7.html">7</A>
</td>
<td align="left" valign="center"><A HREF="../../tag/kb.html"
><IMG SRC="../../gx/dennis/answerpast.jpg" align="middle"
ALT="[ Index of Past Answers ]" border="0"></A
><IMG ALT="" SRC="../../gx/navbar/right.jpg" align="middle"
WIDTH="14" HEIGHT="45" BORDER="0"></td></tr></table>
</p>
<!-- end tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<!--endcut ========================================================= -->
<P> <hr>
<!--startcut ======================================================= -->
<CENTER>
<!-- *** BEGIN navbar *** -->
<!-- *** END navbar *** -->
</CENTER>
</p>
<!--endcut ========================================================= -->
<!--startcut ======================================================= -->
</BODY></HTML>
<!--endcut ========================================================= -->
|