Groups of IP Addresses: Network Masks

There is one last detail: there is a standard notation for groups of
IP addresses, sometimes called a `network address'. Just like a phone
number can be broken up into an area prex and the rest, we can divide
an IP address into a network prex and the rest.

It used to be that people would talk about `the 1.2.3 network',
meaning all 256 addresses from 1.2.3.0 to 1.2.3.255. Or if that wasn't
a big enough network, they might talk about the `1.2 network' which
meant all addresses from 1.2.0.0 to 1.2.255.255.

We usually don't write `1.2.0.0 - 1.2.255.255'. Instead, we shorten it
to `1.2.0.0/16'. This weird `/16' notation (it's called a `netmask')
requires a little explanation.
Each number between the dots in an IP address is actually 8 binary
digits (00000000 to 11111111): we write them in decimal form to make
it more readable for humans. The `/16' means that the rst 16 binary
digits is the network address, in other words, the `1.2.' part is the
the network (remember: each digit represents 8 binary digits). This
means any IP address beginning with `1.2.' is part of the network:
`1.2.3.4' and `1.2.3.50' are, and `1.3.1.1' is not.

To make life easier, we usually use networks ending in `/8', `/16' and
`/24'. For example, `10.0.0.0/8' is a big network containing any
address from 10.0.0.0 to 10.255.255.255 (over 16 million addresses!).
10.0.0.0/16 is smaller, containing only IP addresses from 10.0.0.0 to
10.0.255.255. 10.0.0.0/24 is smaller still, containing addresses
10.0.0.0 to 10.0.0.255.

To make things confusing, there is another way of writing netmasks. We
can write them like IP addresses: 10.0.0.0/255.0.0.0

Finally, it's worth noting that the very highest IP address in any
network is reserved as the `broadcast address', which can be used to
send a message to everyone on the network at once.

Here is a table of network masks:
Short Full Maximum Comment
Form Form #Machines
/8 /255.0.0.0 16,777,215 Used to be called an `A-class'
/16 /255.255.0.0 65,535 Used to be called an `B-class'
/17 /255.255.128.0 32,767
/18 /255.255.192.0 16,383
/19 /255.255.224.0 8,191
/20 /255.255.240.0 4,095
/21 /255.255.248.0 2,047
/22 /255.255.252.0 1,023
/23 /255.255.254.0 511
/24 /255.255.255.0 255 Used to be called a `C-class'
/25 /255.255.255.128 127
/26 /255.255.255.192 63
/27 /255.255.255.224 31
/28 /255.255.255.240 15
/29 /255.255.255.248 7
/30 /255.255.255.252 3

No comments:

Post a Comment