Date: Tue, 13 Feb 2007 10:09:10 -0800 From: Jeremy Chadwick <koitsu@FreeBSD.org> To: Pete French <petefrench@ticketswitch.com> Cc: freebsd-stable@freebsd.org Subject: Re: Desired behaviour of "ifconfig -alias" Message-ID: <20070213180910.GA69270@icarus.home.lan> In-Reply-To: <E1HH1Jv-0001Op-4p@dilbert.ticketswitch.com> References: <E1HH1Jv-0001Op-4p@dilbert.ticketswitch.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 13, 2007 at 05:19:59PM +0000, Pete French wrote: > > For a set of IPs in the same subnet on the same interface, wouldn't the > > primary IP be the one with the proper netmask, and all IPs with netmasks > > of /32 be secondary? In that situation, wouldn't deleting the primary IP > > cause connection issues for the rest of the IPs? > > Indeed. I too am not convinced by the 'there is no such thing as a > primary IP address' thing either - because it's trivial to observe > that if you add several addresses to an interface and make outgoing > connections then one of those (the one with the correct netmask) is > always the one used as the source address. Which looks suspiciously like > a primary IP address to me - or at least one which is being treated > slightly differently to all the others on that interface anyway. I agree. I consider the "primary IP" the first (non-aliased) IP bound to the interface. This is the same IP used by default if no particular IP address is explicitly populated sockaddr_in.sin_addr.s_addr during bind(2). I think most system administrators consider a "primary IP" the same thing I do. The underlying API probably does not differentiate any of them (although the routing table seems to differentiate aliases from the "primary IP"; look at netstat -rn), but underlying socket calls probably pick the first entry in the "address index table" per interface when one is not defined, probably based on the routing table too. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070213180910.GA69270>