Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jan 2004 16:50:31 +0000
From:      Alex Zbyslaw <xfb52@dial.pipex.com>
To:        addymin@pacbell.net
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: Configuring IP address aliasing
Message-ID:  <40154557.3060906@dial.pipex.com>
In-Reply-To: <401542F2.8000309@pacbell.net>
References:  <401542F2.8000309@pacbell.net>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
Mike wrote:
> # ifconfig -a
> ed0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>         inet 192.168.1.40 netmask 0xffffff00 broadcast 192.168.1.255

> # ifconfig ed0 alias 192.168.1.41 netmask 255.255.255.0 broadcast 
> 192.168.1.255
> ifconfig: ioctl (SIOCAIFADDR): File exists
> [using same netmask as real interface]

> However, THIS WORKED:
> # ifconfig ed0 alias 192.168.1.41 netmask 255.255.255.255 broadcast 
> 192.168.1.255
> [using a netmask of 255.255.255.255]
> 
> QUESTION: Why do I use a different netmask (255.255.255.255) for a IP 
> alias on FreeBSD?  Why isn't 255.255.255.0 used?

 From the ifconfig man page on 4.9

alias   Establish an additional network address for this interface.  This
         is sometimes useful when changing network numbers, and one wishes
         to accept packets addressed to the old interface.  If the address
         is on the same subnet as the first network address for this
         interface, a non-conflicting netmask must be given.  Usually
         0xffffffff is most appropriate.

Since 192.168.1.41 is on the same subnet as 92.168.1.40 you must use 
0xffffffff (aka 255.255.255.255) as the netmask.  (I don't know *why* I'm afraid).

You could always stick the alias on a different subnet at which point you can 
use the netmask you expect.

e.g. # ifconfig ed0 alias 192.168.2.40 netmask 255.255.255.0 broadcast 
192.168.2.255

--Alex




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?40154557.3060906>