Subject: Re: ifconfig and aliases
To: Darren Reed <darrenr@reed.wattle.id.au>
From: Mike Pelley <mike@pelley.com>
List: tech-net
Date: 07/19/1999 14:46:32
> - configuring aliases for interfaces.  The method `supported' by netstart
>   is unsatisfactory if you wish to configure more than one interface.
>
> - the method suggested in netstart for setting the netmask does not work.
>   If I have an interface setup as 192.168.1.1/29 and add an alias, the
>   netmask does not appear to be applied, instead a /24 (class C) netmask
>   is applied to the alias.  Perhaps ifconfig should do a `head -1' of
>   /etc/ifconfig.ifname to set initial options with a loop processing the
>   rest of the file (if any).

The netstart on my 1.4 maching has the following comment:

    Check if each configured interface xxN has an $ifaliases_xxN
    variable associated, then configure additional IP addresses for that
    interface.  The variable contains a list of "address netmask" pairs,
with
    "netmask" set to "-" if the interface default netmask is to be used.

I'm not sure why this is not suitable for more than one interface.  If you
prefer to use the /etc/ifaliases file it seems to operate in a similar
manner - at least w.r.t. multiple interfaces - but you just leave the
netmask out instead of using the "-".  I believe the /24 problem relates to
the problem below as well, and the proper netmask entry might clear it up.
However, I could not reproduce the problem quickly so I'm not sure.

> - when setting an IP address alias on an interface where the IP number
>   falls inside the network for the interface, ifconfig prints out an
>   error ("ifconfig: SIOCAIFADDR: File exists") but sets it up anyway.

I believe this error exists because it attempts to add the network your
ip/netmask describes.  If your IP address falls inside a network already
assigned to the interface, setting the netmask to "-" as suggested in the
comment mentioned above (or leaving it blank in the /etc/ifaliases file)
seems to work well.

> - ifconfig should be capable of setting netmasks without needing the
>   "inet" portion of the command line syntax present.

I'm not sure about this one - I rarely use "inet" and it seems to work ok
;o)

Not sure if I understood your problems thoroughly;  just thought I should
pass on how it works for me.

CU!  Mike.