Basic Concepts From Computer Networks
2.8 The internet protocol (IP)
2.8.2 IP addresses
As we saw above, IP addresses are 32-bit long. An IP address is divided into two parts, namely, a network and a suffix. The network identifies the physical network to which the host computer is attached, and the suffix identifies the host computer itself. The size of these two fields may vary according to the class of the IP address. Specifically, five different classes of addresses have been defined, referred to as class A, B, C, D, and E, as shown in figure 2.19.
Classes A, B and C are called the primary classes because they are used for host addresses. Class D is used for multicasting, and class E is reserved for future use. The first field determines the class of the IP address, and it ranges from 1 bit for a class A address to five bits for a class E addresses. The second field gives the network address, and the third field is the suffix which gives the host address.
In class A, there is a 7-bit network address and a 24-bit host address, resulting to 128 network addresses and 16,777,216 host addresses. In class B, there is a 14-bit network address and a 16-bit host address, resulting to 16,384 network addresses and
65,536 host addresses. In class C, there is a 21-bit network address and a 8-bit host address, resulting to 2,097,152 network addresses and 256 host addresses.
Network addresses are usually written in the dotted decimal notation. That is, each byte is written in decimal, ranging from 0 to 255. As an example, the IP address 00000111 00000010 00000000 00000010 will be written as 7.2.0.2. Using this notation, we have that the range of class A addresses is from 1.0.0.0 to 127.255.255.255, for class B we have a range of values from 128.0.0.0 to 191.255.255.255, and for class C we have a range of 192.0.0.0 to 233.255.255.255.
Class C is very common, whereas class A is rarely used since there are only few networks with that large number of hosts. IP reserves host address zero to denote the address of a network. For instance, in the class B address 128.32.0.0 the network field 128.32 and the suffix is 0.0. This indicates the address of the network 128.32. For broadcasting within the network, IP uses the address 128.32.255.255.
IP assigns multiple IP addresses to routers, since a router is attached to multiple networks. Specifically, a router has one IP address for each network that it is attached to. An individual host connected to multiple networks has also multiple IP addresses, one for each network connection. Such a host is referred to as multihomed.
Subnetting
The IP address structure described above introduces a two-level hierarchy. The first level is the network address and the second level is the host address carried in the suffix. In many cases, these two levels of addressing is not enough. For instance, if we consider an organization with a B class address, then all the hosts appear to be organized into a single group, described by the network address. However, hosts within an organization are typically grouped together to form a number of different LANs. In order to distinguish the LANs the suffix of the IP address is subdivided into a subnet part and a host part. Each LAN is assigned a subnet address carried in the subnet part, and a host in the LAN is assigned an address which is carried in the host part. The actual parsing of the suffix in these two sub-fields is dictated by a subnet mask. The subnet mask is only known to the routers within the network since the subnets are not visible outside the network. This technique is known as subnetting.
Classless inter-domain routing (CIDR)
In the early 90’s it became apparent that the rapid expansion of the Internet will cause a depletion of IP addresses and an explosion of the routing tables. The main cause for the address depletion was the wasteful usage of class B addresses. Typically, an organization may have a class B address but it may only have a small number of hosts, thus leaving the host address space largely unused. Also, the routing table explosion was due to the fact that a router is obliged to keep all the addresses of all the registered networks.
In order to alleviate these two problems the classless inter-domain routing
(CIDR) scheme was proposed. This scheme permits the assignment of contiguous class C addresses and at the same time it reduces the number of entries required in a routing table.
The basic idea in CIDR is to allocate blocks of class C network addresses to each ISP. Organizations using the ISP are sub-allocated a block of 2n
contiguous addresses. For instance, if an organization requires 2000 addresses, then it will be allocated a block of 2048 or 28
contiguous class C addresses.
Hierarchical sub-allocation of addresses in this manner implies that clients with addresses allocated out of a given ISP will be routed via the ISP’s network. This permits all these addresses to be advertised outside the ISP’s network in an aggregate manner. As an example, let us assume that an ISP was allocated 131,072 class C network addresses starting at 194.0.0.0. That means that the lowest network address is 194.0.0.0 or 11000010 00000000 00000000 00000000 and the highest network address is 195.255.255.255 or 11000011 11111111 11111111 11111111. We observe that any address whose first seven bits are 1100001 belongs to the group of addresses allocated to the ISP. This prefix can be calculated by performing a bit-wise AND operation between the lowest address and the mask 254.0.0.0 or 11111110 00000000 00000000 00000000. Routers outside the ISP’s network are provided, therefore, only with the base address 194.0.0.0 and the mask 254.0.0.0. This information suffices in order to identify whether an address of an IP packet has the same prefix as the ISP. The operation of calculating a prefix using a base network address and a mask can be seen as the opposite of subnetting and it is known as supernetting.
The above use of contiguous addresses gives rise to better usage of the address space. Also, by only advertising a base address and a mask, we minimize the amount of information that a router has to keep in its routing table. We note that there are network addresses that were allocated prior to the introduction of CIDR, and a router has to keep these addresses in its table as well.
In order to further simplify routing, blocks of addresses were also allocated according to geographic regions as shown in table 2.3.
Region Lower address Higher address
Europe 194.0.0.0 195.255.255.255
North America 198.0.0.0 199.255.255.255 Central/South America 200.0.0.0 201.255.255.255 Pacific Rim 202.0.0.0 203.255.255.255
Table 2.3: Allocation of addresses per region
Finally, we note that the class A, B, and C addresses are no longer used for routing. Instead CIDR is applied to all addresses, which explains why this scheme is called classless.