Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jan 2004 12:52:52 -0800
From:      Mike <addymin@pacbell.net>
To:        Matthew Seaman <m.seaman@infracaninophile.co.uk>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: Configuring IP address aliasing
Message-ID:  <40157E24.3040600@pacbell.net>
In-Reply-To: <20040126172114.GA48421@happy-idiot-talk.infracaninophile.co.uk>
References:  <401542F2.8000309@pacbell.net> <20040126172114.GA48421@happy-idiot-talk.infracaninophile.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Seaman wrote:

> On Mon, Jan 26, 2004 at 08:40:18AM -0800, Mike wrote:
> 
>>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?
> 
> 
> It's all about routing of outgoing packets.  Unlike linux, you can't
> use the route(8) command to set up a route to a directly attached
> network.  All of the local routing is controlled through ifconfig(8)
> -- when you run:
> 
>     # ifconfig fxp0 inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255 up
> 
> amongst other things, that establishes that interface as the route to
> the 192.168.0.0/24 network.  It also says that the source address on
> packets sent out of that interface will be 192.168.0.1
> 
> Now suppose you add an alias address on the same subnet:
> 
>     # ifconfig fxp0 add 192.168.0.2 netmask 0xffffffff broadcast 192.168.0.255
> 
> Since the netmask is a /32 it says this interface is the route to the
> specific single address.  It also means that the 192.168.0.2 address
> is only used on outgoing packets from connections directly to the
> alias address.  That's a bit of a simplification, as one of the
> principle uses for alias addresses is to support jail(8)ed processes,
> but it holds in general.
> 
> Could FreeBSD use exactly the same semantics as Linux or Solaris --
> yes, sure.  But the FreeBSD way gives you a tad more control, and to
> be honest, it's the way it is mostly because the people who wrote the
> code thought that was the way it should be.  

Ah yes! What a great explanation.  Thanks Matthew.

	Best Regards,
	Michael

> 
> 	Cheers,
> 
> 	Matthew
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40157E24.3040600>