*BSD News Article 99134


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!uunet!in1.uu.net!194.87.0.28!demos!newsfeed.direct.ca!europa.clark.net!howland.erols.net!rill.news.pipex.net!pipex!tank.news.pipex.net!pipex!news.utell.co.uk!shift.utell.net!nobody
From: brian@shift.utell.net (Brian Somers)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Hostname for box w/ part time internet connection
Date: Mon, 7 Jul 1997 11:26:11 +0100
Organization: Awfulhak Ltd.
Lines: 142
Message-ID: <38gqp5.rqd.ln@shift.utell.net>
References: <33B462A3.C9A68B9C@auburn.campus.mci.net>
    <5pknen$l9c$1@the-fly.zip.com.au>
Reply-To: brian@awfulhak.org, brian@utell.co.uk
NNTP-Posting-Host: shift.utell.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Newsreader: knews 0.9.8
Cc: brian@FreeBSD.org
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:44045

In article <5pknen$l9c$1@the-fly.zip.com.au>,
	sue@zip.com.au (Sue Blake) writes:
> Anthony Jenkins (ajenkins@auburn.campus.mci.net) wrote:
>> What do I set as the host name for my machine, which occasionally
>> dials-up a connection to the internet?  Do I use the domain name of my
>> ISP, or would that be naughty?  I have a single PC running FreeBSD
>> (Win95 on another partition), no network (though I soon hope to delve
> 
> 
> I'm in a similar situation, but I'm also hoping to connect the two other
> freebsd and linux(alpha) machines here to the one (2.2.1) that occasionally
> dials my ISP. The arguments that followed this question are probably
> constructive in a general sense, but don't help us much. While you enjoy
> your arguments on the topic of perfection, let me add a question and a
> whinge. I've got a lot to get off my chest, sorry.
> 
> My question is:
> Should I a) fiddle  b) ask here (what Q?) c) employ someone to help me set
> up my personal computer which is supposed to be for fun d) read the two or
> three books I have read but don't understand e) buy some more books f) enrol
> in some university course f) install another operating system ?

The "answer" is this, and I'll put this in the FAQ at some point:

Find out from your ISP if you have a fixed IP number or a dynamic
one.

  A "fixed" one means you have your own machine name that never
  changes, for example, mine is "awfulhak.demon.co.uk" and the IP is
  158.152.17.1.  This never changes.  It also means that I have the
  ability to create as many mail accounts as I want - this, I like.

  A "dynamic" one means that your ISP gives you an IP number randomly
  based on the time of day and what he had for breakfast.  The "random"
  IP number will resolv to some arbitrary name (like dial123.myisp.net)
  and means that you will have only a few fixed email addresses such
  as "myname@myisp.net".

With a "fixed" IP number (and therefore a fixed name), the easiest way
to do things is to use the fixed name as your hostname.  The "arguments"
on this thread were about whether you really need to do this.  If you
do that, the default sendmail.cf will work and everything's a piece
of piss to set up :-)

With a "dynamic" IP number, you have to get creative.  You have to
think of a machine name (the most tricky bit).  Think of a name that's
not likely to be used in the real world - say ending in .lan.  Once
you've done this (say it's "flacid.twinkletoes.lan"), your mailer
will use this name by default.  You've got to make it use
"myname@myisp.net", otherwise people that reply to your mail will
fail to resolve "flacid".  Now you're into the "sendmail" world
(unless you know of a better mailer, in which case you don't need
to be reading this - go away).

Sendmail isn't too bad any more since the intro of the m4 stuff.
What you do is write a small config file, then turn it into the
sendmail.cf monstrosity.  I *only* know how to do this w/ sources
installed, but I believe Joerg packaged this stuff up - maybe he'll
fill in the gap.

To do this *my* way (Joerg's is probably better), create a directory
called /etc/mail, and put the following "makecf" script in there:

#! /bin/sh
test "${1%.mc}" = "$1" && {
        echo Specify your .mc file as an argument >&2
        exit 1
}
CFDIR=/usr/src/usr.sbin/sendmail/cf/
m4 -D_CF_DIR_=$CFDIR ${CFDIR}m4/cf.m4 "$1" >"${1%.mc}.cf"

This script takes a .mc file as an arg and creates a .cf file.  Now
create your "flacid.mc" file:

VERSIONID(`flacid.mc 1.0')
OSTYPE(bsd4.4)dnl
DOMAIN(generic)dnl
MAILER(local)dnl
MAILER(smtp)dnl
Cwflacid.twinkletoes.lan
Cwmyisp.net
MASQUERADE_AS(`myisp.net')dnl
FEATURE(allmasquerade)dnl
FEATURE(nocanonify)dnl
FEATURE(nodns)dnl
define(`confDOMAIN_NAME',`myisp.net')dnl

Then create flacid.cf by running "./makecf flacid.mc", and make
it real by saying

  cd /etc
  mv sendmail.cf sendmail.cf.orig
  ln -s mail/flacid.cf sendmail.cf
  killall -HUP sendmail

Now, when you send mail, sendmail will fill in the correct fields.

You probably also need to "pop" your mail with a "dynamic" account.
For this, I'd use fetchmail.  The nice bits about fetchmail are that
you can put all of your default args in a config file and you can
set up "encrypted" channels for the paranoid (if the server has
sshd running).

Your .fetchmailrc would look like this:

poll pop.myisp.net proto pop3 user myname fetchall password mypass

(remember to make it read only - don't allow people to know your
password).

Now, to tie the whole lot in together, use user-ppp to grab things:

ppp.linkup:

myisp:
  delete ALL
  add 0 0 HISADDR
  ! sh -c "/etc/ppp/ppp.connected &"

and in /etc/ppp/ppp.connected:

#! /bin/sh

sendmail -q &
su myname -c fetchmail


I'll leave the news setup for the next installment (hint, there's now
a port of "leafnode") :-)

> Regards,
>         -*Sue*-
> 
> (PS, If you say "give up" I'll blow you a raspberry)
> 
> sue@welearn.com.au
> 

-- 
Brian <brian@awfulhak.org> <brian@freebsd.org>
      <http://www.awfulhak.org>
Don't _EVER_ lose your sense of humour !