From owner-freebsd-questions@FreeBSD.ORG Tue Apr 29 10:48:16 2003 Return-Path: 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 1F4A837B401 for ; Tue, 29 Apr 2003 10:48:16 -0700 (PDT) Received: from Gina.esfm.ipn.mx (esfm.ipn.mx [148.204.102.61]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E00643FAF for ; Tue, 29 Apr 2003 10:48:15 -0700 (PDT) (envelope-from mrspock@esfm.ipn.mx) Received: from Gina.esfm.ipn.mx (localhost [127.0.0.1]) by Gina.esfm.ipn.mx (8.12.6p2/8.12.6) with ESMTP id h3THl5NY002412; Tue, 29 Apr 2003 12:47:05 -0500 (CDT) (envelope-from mrspock@esfm.ipn.mx) Received: from localhost (mrspock@localhost)h3THl5cs002409; Tue, 29 Apr 2003 12:47:05 -0500 (CDT) X-Authentication-Warning: Gina.esfm.ipn.mx: mrspock owned process doing -bs Date: Tue, 29 Apr 2003 12:47:05 -0500 (CDT) From: Eduardo Viruena Silva To: Steve Warwick In-Reply-To: Message-ID: <20030429121519.O1228@Gina.esfm.ipn.mx> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-questions@freebsd.org Subject: Re: Netmasks: the truth is out there? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Apr 2003 17:48:16 -0000 On Tue, 29 Apr 2003, Steve Warwick wrote: > Hi All, > > I know someone out there knows the truth about netmasks. All the > documentation I can find on the net talks about "masking off" part of the IP > address and how you can tell network from subnet and host ids. > > However, I have knowledgeable friend who is telling me that the netmask is > also dependant on how the hosting company has set up their routing tables > and incorrect netmasking on my part can reduce or halt my connection. > > So the question is, who is right? Is it as simple as just masking off the > first three octets or does the netmask interact with the router? > > Please point me to an authoritative source or if you have the time, a brief > description of if or how the netmask has to match the router, as I am not > sure what questions to ask my hosting company. > suppose computer A and B with: IPA: a1.a2.a3.a4 MaskA: ma1.ma2.ma3.ma4 and IPB: b1.b2.b3.b4 MaskB: mb1.mb2.mb3.mb4 Of course, a1 ... a4 and b1...b4 are integer numbers in [0..255], that is, they are bytes. -----example------- ma1 ... ma4 are also bytes, but build with leading 1's till certain bit. If you have a mask of 24 bits you have: 11111111.11111111.11111111.00000000 written in binary, equivalent to: 255.255.255.0 in decimal. if you have a mask of 26 bytes you have: 11111111.11111111.11111111.11000000 written in binary, equivalent to: 255.255.255.192 in decimal. ---------------------- Surely you know how to make a bitwise AND between IPA and MaskA, I mean: IPA & MaskA = (a1 & ma1).(a2 & ma2).(a3 & ma3).(a4 & ma4) IPB & MaskB = (b1 & mb1).(b2 & mb2).(b3 & mb3).(a4 & mb4) Now, IPA and IPB are in the same subnet if: IPA & MaskA == IPB & MaskB if not, they need a router to communicate. Let show an example: Lets suppose you have: IPA= 192.168.123.244 MaskA= 255.255.255.0 IPB= 192.168.123.120 MaskB= 255.255.255.0 Now, IPA & MaskA = 192.168.123.0 IPB & MaskB = 192.168.123.0 They are in the same subnet, you do not require a router. But.... IPA= 192.168.123.218 MaskA= 255.255.255.128 IPB= 192.168.123.66 MaskB= 255.255.255.128 Makes: IPA & MaskA = 192.168.123.128 IPB & MaskB = 192.168.123.0 They do require a router to connect. > > --- > > My current rc.conf entry looks like this (these ips are bogus) - no > broadcast and FreeBSD seems happy with this. > > defaultrouter="123.456.789.1" ^ ^ these are not valid IP numbers. > ifconfig_rl0="inet 123.456.789.111 netmask 255.255.240.0" ^ ^ neither are these. > ifconfig_rl0_alias0="inet 123.456.789.112 netmask 255.255.255.0" > <+7 other aliases> remember: IP must be built out of BYTES, numbers in [0..255] but you cannot use 0 or 255 in the last byte, because they have special meanings. > > > Thoughts, suggestions, links ? > > > TIA > > > Steve > > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" >