From owner-freebsd-questions Sat Nov 16 8:21:50 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D8DBA37B401 for ; Sat, 16 Nov 2002 08:21:48 -0800 (PST) Received: from smtp.infracaninophile.co.uk (smtp.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7586A43E3B for ; Sat, 16 Nov 2002 08:21:47 -0800 (PST) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost.infracaninophile.co.uk [IPv6:::1]) by smtp.infracaninophile.co.uk (8.12.6/8.12.6) with ESMTP id gAGGLdx2012991 for ; Sat, 16 Nov 2002 16:21:39 GMT (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost) by happy-idiot-talk.infracaninophile.co.uk (8.12.6/8.12.6/Submit) id gAGGLYi8012990 for freebsd-questions@FreeBSD.ORG; Sat, 16 Nov 2002 16:21:34 GMT Date: Sat, 16 Nov 2002 16:21:34 +0000 From: Matthew Seaman To: freebsd-questions@FreeBSD.ORG Subject: Re: question on IP alias/broadcast Message-ID: <20021116162134.GB12726@happy-idiot-talk.infracaninophi> Mail-Followup-To: Matthew Seaman , freebsd-questions@FreeBSD.ORG References: <058f01c28d76$22296230$020aa8c0@morpheous> <5.2.0.9.2.20021116082511.00b26508@molson.wixb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5.2.0.9.2.20021116082511.00b26508@molson.wixb.com> User-Agent: Mutt/1.5.1i X-Spam-Status: No, hits=-3.0 required=5.0 tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01, USER_AGENT,USER_AGENT_MUTT version=2.43 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Nov 16, 2002 at 08:28:32AM -0600, J.D. Bronson wrote: > I setup an alias statment in rc.conf and it seems to work fine.. > but I have a question on the broadcast IP: > > > em0: flags=8843 mtu 1500 > options=3 > inet 192.168.100.1 netmask 0xffffff00 broadcast 192.168.100.255 > inet 192.168.100.4 netmask 0xffffffff broadcast 192.168.100.4 > ether 00:a0:9d:23:0b:f6 > media: Ethernet autoselect (100baseTX ) > status: active > > > Why isnt the alias broadcast set to .255 ? Because the broadcast address is actually completely determined by the combination of the inet address and netmask. It's redundant information really. Remember that an IP number or netmask expressed as a dotted quad is really just a 32bit unsigned integer, and can be equally well expressed as a hexadecimal or even decimal integer. thus: 192.168.100.1 is the same as 0xc0a86401 or 3232261121 and 0xffffff00 is the same as 255.255.255.0 or 4294967040 Thus you can take an inet address and a netmask and bitwize logic to generate the network address: $network = $inet & $netmask; and from the network address and the netmask, you can generate the broadcast address: $broadcast = $network | ~$netmask; So your question really boils down to "why is the netmask 0xffffff00 for the first address and 0xffffffff for the alias address?" That's pretty much simply so that the kernel knows which source address it should put into outgoing packets when it isn't already determined. Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message