[plug] (Probably) Basic Network question

Anthony J. Breeds-Taurima tony at cantech.net.au
Wed Nov 1 09:27:35 WST 2000


On Wed, 1 Nov 2000, Garry wrote:

> Like most, I enjoy playing with Linux, and gaining knowledge by doing it.
> But as I have always thought the best way to "know" something is to understand
> it, I've found a stumbling block which I'd love to get my head around..
> 
> By default, the distributions I've seen give you "localhost.localdomain". On
> every machine.
> 
> So if you have two machines, call them groundcontrol and majtom. Do we refer to
> both of them as hosts? Do they become groundcontrol.localhost.localdomain or
> groundcontrol.localdomain?
> 
> In my /etc/hosts file, I have:
> 
> 127.0.0.1  groundcontrol  localhost.localdomain localhost

Typically the localhost line should look like:
127.0.0.1  localhost localhost.localdomain localhost

The purpose of the localhost line is to allow any piece of software to say
connect localhost:80 and ALWAYS get the webserver on THIS machine.

Then you add a line(s) like:
192.168.0.1 groundcontrol.home groudncontrol
192.168.0.2 majortom.home majortom

These allow you to ping(web/nmap/whatever) majortom (or groundcontrol) by
name.  Obviously I'm making the assumpution that the NICS(and drivers)/cables 
(hubs if appropriate) are in place.

> I assume that the last entry is an alias, for internal use.

The file is:
IP    FULLNAME   ALIASES
The aliases field is optional BUT can contain many entries

192.168.0.1 my.machine my ftp ns ntp mail ftp proxy www

This says that my.machine is IP 192.168.0.1 BUT I call it anything from 
"my" -> "www"
 
> But if you designate a name to a machine, do we end up losing the
> localhost.localdomain somewhere along the line? This just gets confusinger and
> confusinger.

Nup becuse you assign a name to an IP.
 
> And finally, if we make one machine the gateway with diald, do we need to worry
> about changing the domain or setting it? Or do they stay as just peers on a
> network with one having the "gateway" setting sorted?

On the machine with the Modem let pppd set the default route.  on the other
machine(s) set the default route to the machine with the modem ie:

on 192.168.0.2
route add default gw 192.168.0.1 dev eth0

Also make sure you enable ip_forward on the gatwayt machine and also some
IPchains rules would be very usefull. something like:

echo 1 > /proc/sys/net/ipv4/ip_forward
/sbin/ipchains -F
/sbin/ipchains -P DENY forward 
/sbin/ipchains -a forward -J MASQ -i ppp0 

would be a minimal starting place.


Yours Tony.

/*
 * "The significant problems we face cannot be solved at the 
 * same level of thinking we were at when we created them."
 * --Albert Einstein
 */




More information about the plug mailing list