On 2004-02-21, Anthony Campbell penned:
> On 20 Feb 2004, Monique Y. Herman wrote:
>> On 2004-02-20, Anthony Campbell penned:
>> >
>> > My /etc/hosts is as follows, in case this indicates the problem:
>> > (The alternative lines are because I tried both the IP which my domain
>> > name resolves to and also the ip on my router. I don't know which, if
>> > either, I need.)
>> >
>> > --------cut------------------
>> > 127.0.0.1 localhost loopback
>> > # 194.176.77.5 acampbell.org.uk arcadia
>> > 192.168.0.20  acampbell.org.uk arcadia
>> > 0.0.0.0 accampbell.uklinux.net
>> >
>> > 10.0.0.1   arcadia
>> > 10.0.0.2   mimosas
>> >
>> > -------cut-------------
>> 
>> 1) It looks like you're mixing internal network numbers here.  192.168.0.20
>> for arcadia, then later 10.0.0.1 for arcadia and .2 for mimosas ... I'm
>> fairly sure that this is not what you want.
>> 
>> Is there a web interface to your router?  Mine lets me set the LAN IP
>> address.  Does yours, and if so, does it say 192.168.0.something or
>> 10.0.0.something?
>> 
>> It might also be enlightening for you to share your
>> /etc/network/interfaces ... specifically, the "gateway" value for your
>> network device should be the same as the router's IP address.  At least,
>> if you want outbound traffic, it should be.
>> 
>> 2) What's that 0.0.0.0 entry for?  I don't have any such entries on my
>> machine, and I'm not sure it's what you want.
>> 
>> 3) You probably don't need to specify the external address (194.etc) in
>> the hosts file.  In fact, it's a little misleading, as from outside your
>> router, all of your machines look like that address.  All the hosts file
>> does is give your machine a cheat-sheet for the names of some
>> commonly-used hosts.  If you frequently wanted to connect to a machine
>> that's outside the router (say, work or home) and wanted it to have a
>> nice, easy-to-remember name, then you might list an external IP address
>> for it.
>> 
>> --
>> monique
>> 
> If you think I've got myself into a right muddle with this business,
> you're correct. Not a case of failing to rtfm, rather of too much rtfm
> (or the wrong fm, perhaps).

Believe me, I've been there!  Don't despair ... over time, this will all
start to make sense.  Honest.

> The lan IP address in the router is 192.168.0.20, which is why I had it
> in /etc/hosts.

That part is good!  I was questioning the mixture of 192.168.0.x with
10.0.0.x.  Generally speaking, you want the IP addresses of your
machines to look very similar to the IP address of your router.

> I added the 192... business because I read in various places that you
> were supposed to have this line (I didn't previously) and because
> without it all hostname commands (hostname, hostname -f, hostname -s)
> produce the same thing, i.e. just arcadia. But perhaps that doesn't
> matter? I've taken it out at present.

No, it matters =)

> The 0.0.0.0 line also came from a how-to I found on the Net, but I've
> taken it out.

I can't swear that you don't need it.  I just know that I don't have
one, and my setup works.

> My /etc/network/interfaces:
>
> ----------cut--------------------------
> # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
>
> # The loopback interface
> # automatically added when upgrading
> auto lo 
> iface lo inet loopback
>       address 127.0.0.1
>       netmask 255.0.0.0
>       broadcast 127.0.0.255
>       gateway 127.0.0.1
>
> #Router stuff
> auto eth0 
> iface eth0 inet static 
>    address 192.168.0.20
>    netmask 255.255.255.0
>    gateway 192.168.0.1
>    broadcast 192.168.0.255
> ---------------cut------------------------
>

All of that looks good.  For comparison's sake, why don't I show you the
relevant portions of /etc/network/interfaces and /etc/hosts on one of my
machines?  (I'm ignoring the loopback entry in interfaces; that should
be fine.)

Okay, I'm munging things a bit, but the sense should still be there:

Here's the relevant portion of my /etc/network/interfaces on foo :
 ---------------cut------------------------
auto eth0
iface eth0 inet static
address 192.168.1.15
netmask 255.255.255.0
gateway 192.168.1.1
 ---------------cut------------------------

Here's the relevant portion of my /etc/hosts , also on foo :

 ---------------cut------------------------
127.0.0.1       localhost
192.168.1.15    foo.hostname.org foo
192.168.1.150   bar 
 ---------------cut------------------------


Let me read this in "plain English."  foo is a machine with the static
IP address 192.168.1.15.  The gateway line tells foo that the router is
at 192.168.1.1.  The netmask line tells foo that every possible value of
192.168.1.x is on the same network as foo.  On foo, the term 'localhost'
when used anywhere that involves networking ('ssh localhost', for
example) will resolve to 127.0.0.1.  On foo, the term 'foo' will resolve
to 192.168.1.15, and so will foo.hostname.org.  Also, if you use the
term 'bar', it will resolve to 192.168.1.150, which is the IP address of
another machine on the network.

Note that you can't make up the netmask:  it has to be the same one that
your router has set. And your address has to be within that block.  

Here's a link explaining netmasks:
http://www.johnscloset.net/primer/subnet.html

The simplest is if you just use 255.255.255.0 -- then you don't have to
remember anything =)

Here's what I think will work as the /etc/hosts file *on arcadia*:
127.0.0.1       localhost
192.168.0.20    arcadia.acampbell.org.uk arcadia
192.168.0.x     mimosas #here x needs to be whatever IP address mimosas is

Here's a question for you that I don't think has yet been asked: what's
with the two FQDNs?  Why both acampbell.org.uk and uklinux.net?  Perhaps
you should first get things working without FQDNs, then work on that
part.

-- 
monique


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to