Subject: Re: Help on loopback configuration
To: None <sutre@labri.fr>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-help
Date: 11/18/2003 23:15:44
On Tue, Nov 18, 2003 at 01:08:31AM +0100, sutre@labri.fr wrote:
> Hi,
> 
> I'm trying to set up NetBSD 1.6.1 on a laptop (i386).  As this laptop might
> get several IPs, I intend to map my laptop's (FQDN) hostname to the loopback
> address 127.0.0.2 (in /etc/hosts).
> 
> So I guess I need to add an alias on the loopback interface (which defaults
> to 127.0.0.1, netmask 0xff000000).
> 
> My question is: should the alias (127.0.0.2) be given a netmask of 0xffffffff,
> or should it be given a netmask of 0xff000000 (as the main loopback address
> 127.0.0.1)? Or another netmask?
> 
> It seems that these two netmask options work: the system seems to behave the
> same whether I use 1) or 2) below:
> 
> 1) ifconfig lo0 alias 127.0.0.2 netmask 0xffffffff
>    (there a route 127.0.0.2 -> 127.0.0.2 on lo0 is automatically created)
> 
> 2) ifconfig lo0 alias 127.0.0.2 netmask 0xff000000
>    route add 127.0.0.2 127.0.0.2 -interface
> 
> 
> Is there a preferred solution?

If netmask 0xffffffff creates the route automatically this is probably the way
to go.

> 
> Thanks for your help,
> 
> Gregoire.
> 
> p.s. BTW, if it's a bad idea to map my hostname to 127.0.0.2 in /etc/hosts,
>      please tell me!

Can't you just add the FQDN to the 127.0.0.1 line ?
This is what I do on my systems with no permanent IP connection.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 24 ans d'experience feront toujours la difference
--