Subnetting, netmasks and slash notation

Netmasks are used in ACLs (access control lists), firewalls, routing and
subnetting. It involves grouping IP addresses. Each range contains a power of two
(1, 2, 4, 8, 16, etc) number of addresses and starts on a multiple (0, 1, 2, 3,
etc) of that number of addresses.

127.0.0.1 is reserved for the loopback, with network address 127.0.0.0,
netmask 255.0.0.0 and 127.255.255.255 as its broadcast address.
0.0.0.0 is the entire Internet with netmask 0.0.0.0 and 255.255.255.255 as
its broadcast address.
0.0.0.0 with netmask 255.255.255.255 is an unconfigued interface.
224.0.0.0 ... 239.255.255.255 is used for multicast. 240.0.0.0 ...
255.255.255.255 is reserved.

CIDR does not link the number of hosts to the network address, at least not
in the strict way that 'classic' A, B and C networks do. Furthermore, it
doesn't limit the size to 16M, 64k or 256 IP nrs. Instead, any power of 2
can be used as a size of the network (number of hosts + network address +
broadcast address). In other words, CIDR sees an IP address as a 32 bit
rather than a 4 byte address.

Netmasks

The following table shows the netmasks in a binary form. The 'CIDR' column is
the number of '1's from left to right. This also known as 'slash notation'.

Bitwise operators are hardcoded in processors and therefore very efficient.

Networks

The bits in the 'host' part of a network address are all '0'. Bits left of
the 'hosts' bits can be either '0' or '1' (this is rather like sub netting
a classic A, B or C network).
The following table/graph shows a network being split in two smaller
networks, then in four, then in eight, then 16, etc.

':0000:' can be written as ':0:'. And the longest sequence of zeros as '::'.
Since the IPv6 internet is 2000::/3
(2000:0000:0000:0000:0000:0000:0000:0000 to
3fff:ffff:ffff:ffff:ffff:ffff:ffff:ffff), the number of available addresses
is 2¹²⁵ = 42,535,295,865,117,307,932,921,825,928,971,026,432.