Networks / Subnets

IP address

An IP (v4) address is a 32 bit number (4 bytes). It is usually represented in a “dotted decimal notation” format. In this format, each one of the four bytes is represented by a decimal number ranging from 0 to 255. Each byte is separated by a “dot”. Valid IP addresses range from 0.0.0.0 to 255.255.255.255, like 131.44.8.2 or 1.0.0.45.

Bear in mind that there are several reserved address, like 0.0.0.0, 1.1.1.1, 255.255.255.255, and some others (more later)

IP network

To ease the administration of network, IP addresses are “logically” divided in 2 parts: the network part and the host part. The network part identifies the network number while the host part identifies a specific host or device.

Think of it as the parts of telethon numbers where, by convention, (34) 93 999-99-99 can be logically decomposed in country part (“34” for Spain), area part (“93” for Barcelona), and the final number (99999999) of the physical phone.

Since the beginning of the use of TCP/IP, there has been several methods for the “logical” division of IPs in blocks to help network adminsitrators. The very first TCP/IP network administrators toke the convention to reserve the significant octet to number the network. With this schemme, IP address 48.23.128.67 belonged to network 48 (network address 48.X.X.X) while 23.128.67 was the host address. Check the sentence just before section 7.1 in RFC919

As you have already foreseen, this division lead to have very few networks (256 - 2^8) with millions of hosts (16.777.216 - 2^24). This scheme proved impractical very soon, so a new schema was devised (named “Classful network design”). This schema defined network classes using the 3 most significant bits in the most significant byte to create the network classes:

Class Leading bits Size of network number bit field Size of rest bit field Number of networks Addresses per network Total addresses in class Start address End address
A 0 8 24 128 (2^7) 16,777,216 (2^24) 2,147,483,648 (2^31) 0.0.0.0 127.255.255.255
B 10 16 16 16,384 (2^14) 65,536 (2^16) 1,073,741,824 (2^30) 128.0.0.0 191.255.255.255
C 110 24 8 2,097,152 (2^21) 256 (2^8) 536,870,912 (2^29) 192.0.0.0 223.255.255.255
D (multicast) 1110 not defined not defined not defined not defined 268,435,456 (2^28) 224.0.0.0 239.255.255.255
E (reserved) 1111 not defined not defined not defined not defined 268,435,456 (2^28) 240.0.0.0 255.255.255.255

But again, this method was superseded by a new method, which is the one currently in place

Network Mask and subnets

Before diving into the new classification method for IP networks and hosts, the Network Mask concept has to be (further) explained.

Inadvertibly, we have already been talking about masks. In the telephone example, everybody knows that the number in brackets is the country. So we can say that a mask defining each part of a telephone number can be (DD)DD-DDDDDDD, where ’D’ are numbers from 0 to 9. (As the telephone example is just a help for a concept, Mico Maco will not enter into details on other possibe formats, mobile numbers, etc.)

So, for our bits and bites in IP addresses, there is a bit and bytes mask that defines which part is the network part and which is the host part.

The mask is created by setting all the network part bits to “1”. Following the Classful schema, the network mask for the each one of the addresses in A, B and C clases would be respectively:

Class Size of network number bit field Size of rest bit field Network Mask Network Mask (bit representation)
A 8 24 255.0.0.0 11111111.00000000.00000000.00000000
B 16 16 255.255.0.0 11111111.11111111.00000000.00000000
C 24 8 255.255.255.0 11111111.11111111.11111111.00000000

By following the same principle, any of the 3 well known Network classes can be furtheer divided in smaller networks within the class. These networks are called subnetworks.

Taking the class “C”, the host part (last byte) can be “masked” with “11110000”, giving the net mask “11111111.11111111.11111111.11110000” and allowing only 8 hosts per network. (** EPPP !! - Should be 16 - Review **)

CIDR and variable length masks

The “Classful Network” schema allowed for smaller networks but in 1993 a the IETF Internet Engineering Task Force proposed a new schema with the goal to slow the growth of routing tables on routers across the Internet, and to help slow the rapid exhaustion of IPv4 addresses. This method was named Classless Inter-Domain Routing (CIDR).

This method is based on variable-length subnet masking (VLSM), that allows a very fine grained divisions of networks. Its representation consists on the IP address (in decinal format) and a number representing the number of bit of the network mask (also known as the routing mask).

Taking a (deprecated) class “C” address, its representation old repsentation and the new CIDR schema representation would be

 198.4.94.57/24   (netmask with 24 most significant bits to '1' - 255.255.255.0)

Related info showing all 32 bits:

Address 198.4.94.57 11000110.00000100.01011110 .00111001
Netmask 255.255.255.0 = 24 11111111.11111111.11111111 .00000000
Wildcard 0.0.0.255 00000000.00000000.00000000 .11111111 (for host numbering)
Network 198.4.94.0/24 11000110.00000100.01011110 .00000000 (Class C)

(calculations done via IP Calculator)

Find here the original papers for Classful and Classless IP classification schemes:

RFC 791 for Classful networks

RFC 1517 for the implementation of CIDR

Private addresses

During the initial growth of the Internet, its designers noted that only few devices needed direct acces to the Internet as the internal (intranet) devices accessed Internet services mostly via application layer gateways (like proxy servers for web access). This implied that the intranet devices should have a separated and not overlaping group a address to manager internal networks and subnetworks.

RFC 1918 defined the following three private address blocks:

10.0.0.0        -   10.255.255.255  (10/8 prefix)
172.16.0.0      -   172.31.255.255  (172.16/12 prefix)
192.168.0.0     -   192.168.255.255 (192.168/16 prefix)

These address will never exists in the public Internet, and can be used freely by any network administrator inside his/her organization.

As internal networks use the defined addresses, the network part is limited to these fixed nets (10., 172.16. and 192.168.). The first one matches the old class A network and the former the old class B network. This one provides up to 254 hosts per network, and 256 networks, so it can hold up to 65024 hosts.

Find here a cheat sheet for knowing the number of networks and hosts when netmasking a class B network (normally used for 192.168.0.0 private address).

OzNetNerd has a very easy but detailed guide to subneting