[NTLUG:Discuss] network masks
Bug Hunter
bughuntr at one.ctelcom.net
Thu Jul 20 09:18:16 CDT 2000
the netmask is used to tell the computer that is on that nework which
addresses are on the same wire the computer is on. All other addresses
have to be sent to a gateway machine to get them to their destination.
If you have 192.168.1.0 as your network, netmask 255.255.255.0, then if
you send a message to 192.168.1.230, then the computer applies
255.255.255.0 as a bitwise OR against the address (192.168.1.230) and
comes up with 192.168.1.0. This matches the local address exactly, so the
computer sends the data out its own ethernet card.
If you send a message to 192.168.2.230, the computer comes up with
192.168.2.0, and this does not match 192.168.1.0, so it looks for a
gateway computer. If the route in the machine says that all IP addresses
go through device 192.168.1.254, then the computer forwards the data to
that machine out its own ethernet card. That device then forwards the
data upline and it eventually gets to its destination, assuming that other
machines upline know where to send the data.
The problem with 255.255.255.0 is that it hides the fact you are dealing
with a hexadecimal number of 0xFFFFFF00. When you convert each 8 bit byte
to a number, you come up with 255, 255, 255, and 0. When you take 192, it
converts to hex C0. 168 converts to hex A8. 1 converts to 01, and 0
converts to 00. 230 converts to E6. So, you have 0xC0A80100 as your
network (192.168.1.0), and when you bitwise OR 0xC0A801E6 against
0xFFFFFF00, you get 0xC0A80100, which matches your network exactly.
Using this information, if you convert the Hexadecimal number you just
converted from decimal, you convert it to binary, then you chop off a bit
or two, and convert it to hexadecimal, then back to the dotted decimal
notation. That gives you your "classless" network addressing scheme.
Generally, the bits are chopped off starting on the right side, one at a
time. A 255.255.255.0 network has 8 bits chopped off. If you take 32
bits (8 bits x 4 numbers) and chop off 8 bits, you have a 192.168.1.0/24
network notation (32 - 8 = 24).
Again, it is mainly used to tell the computer which addresses go
straight out its ethernet wire, and which addresses go to another machine
for routing out the internet.
bug
On Thu, 20 Jul 2000, Cameron wrote:
> Okay, after banging my head against the wall, I still don't have a firm
> grasp on network masks like the following:
>
> type address/mask netmask
> ---- ------------ -------
> Class B Private 172.16.0.0/12 255.15.0.0
> Class E Reserved 240.0.0.0/5 31.0.0.0
> IANA Reserved 96.0.0.0/4 15.0.0.0
> IANA Reserved 220.0.0.0/6 63.0.0.0
>
> Could someone provide me with some examples of how a half-backed netmask
> octet is handled (like 15.0.0.0 as opposed to the standard 255.0.0.0)?
>
> While we are on the subject, is there a good resource online that covers
> how netmasking (or networking in general i suppose) works? I read the
> relevant sections of the LDP NAG, but it didn't go very deep into
> netmasks nor routing depending on netmasks. TIA
More information about the Discuss
mailing list