Home > Articles > Networking

  • Print
  • + Share This
This chapter is from the book

1.5 Addressing Scheme in the Internet

An addressing scheme is clearly a requirement for communications in a computer network. With an addressing scheme, packets are forwarded from one location to another. Each of the three layers, 2, 3, and 4, of the TCP/IP protocol stack model produces a header, as indicated in Figure 1.12. In this figure, host 1 communicates with host 2 through a network of seven nodes, R1 through R7, and a payload of data encapsulated in a frame by the link layer header, the network layer header, and the transport layer header is carried over a link. Within any of these three headers, each source or destination is assigned an address as identification for the corresponding protocol layer. The three types of addresses are summarized as follows.

Figure 1.12

Figure 1.12 A typical frame structure that is forwarded over a link

  • Link layer (layer 2) address. A 6-byte (48-bit) field called Media Access Control (MAC) address that is represented by a 6-field hexadecimal number, such as 89-A1-33-2B-C3-84, in which each field is two bytes long. Every input or output of a networking device has an interface to its connected link, and every interface has a unique MAC address. A MAC address is known only locally at the link level. Normally, it is safe to assume that no two interfaces share the same MAC address. A link layer header contains both MAC addresses of a source interface and a destination interface, as seen in the figure.
  • Network layer (layer 3) address. A 4-byte (32-bit) field called Internet Protocol (IP) address that is represented by a 4-field dot-separated number, such as, in which each field is one byte long. Every entity in a network must have an IP address in order to be identified in a communication. An IP address can be known globally at the network level. A network layer header contains both IP addresses of a source node and a destination node, as seen in the figure.
  • Transport layer (layer 4) address. A 2-byte (16-bit) field called port number that is represented by a 16-bit number, such as 4,892. The port numbers identify the two end hosts’ ports in a communication. Any host can be running several network applications at a time and thus each application needs to be identified by another host communicating to a targeted application. For example, source host 1 in Figure 1.12 requires a port number for communication to uniquely identify an application process running on the destination host 2. A transport layer header contains the port numbers of a source host and a destination host, as seen in the figure. Note that a transport-layer “port” is a logical port and not an actual or a physical one, and it serves as the end-point application identification in a host.

The details of the link layer header, including the MAC addresses and all other of the header’s fields are described in Chapter 4. The details of the network layer header fields, including the IP addresses and all other of the header’s fields are presented in Chapter 5. Finally, the details of the transport layer header, including the port numbers and all other of the header’s fields are explained in Chapter 8. In the meanwhile, some of the basic IP addressing schemes are presented in the next section, as understanding IP addressing will help us better understand the upcoming networking concepts.

1.5.1 IP Addressing Scheme

The IP header has 32 bits assigned for addressing a desired device on the network. An IP address is a unique identifier used to locate a device on the IP network. To make the system scalable, the address structure is subdivided into the network ID and the host ID. The network ID identifies the network the device belongs to; the host ID identifies the device. This implies that all devices belonging to the same network have a single network ID. Based on the bit positioning assigned to the network ID and the host ID, the IP address is further subdivided into classes A, B, C, D (multicast), and E (reserved), as shown in Figure 1.13.

Figure 1.13

Figure 1.13 Classes of IP addresses

Consider the lengths of corresponding fields for each class shown in this figure:

  • Class A starts with 0 followed by 7 bits of network ID and 24 bits of host ID.
  • Class B starts with 10 followed by 14 bits of network ID and 16 bits of host ID.
  • Class C starts with 110 followed by 21 bits of network ID and 8 bits of host ID.
  • Class D starts with 1110 followed by 28 bits. Class D is used only for multicast addressing by which a group of hosts form a multicast group and each group requires a multicast address. Chapter 6 is entirely dedicated to multicast techniques and routing.
  • Class E starts with 1111 followed by 28 bits. Class E is reserved for network experiments only.

For ease of use, the IP address is represented in dot-decimal notation. The address is grouped into four dot-separated bytes. For example, an IP address with 32 bits of all 0s can be shown by a dot-decimal form of where each 0 is the representation of 00000000 in a logic bit format.

A detailed comparison of IP addressing is shown in the Table 1.1. Note that in this table, each of the “number of available network addresses” and the “number of available host addresses per network” has already been decreased by 2. For example, in class A, the size of the network ID field is indicated in the table to be N = 7; however, the number of available network addresses is presented as 2N – 2 = 128 – 2 = 126. The subtraction of 2 adjusts for the use of the all-bits-zero network ID (0 in decimal) and the all-bits-one network ID (127 in decimal). These two network IDs, 0 and 127, are reserved for management and cannot be available for any other use. The same argument is true for the number of available host addresses, where with the size of the host ID field indicated as N = 24, we can have 2N – 2 = 16,777, 216 – 2 = 16,777, 214 host addresses per network available for use. The last two columns of the table show the start address and the end address of each class, including the reserved addresses explained earlier.

Table 1.1 Comparison of IP addressing schemes


Bits to Start

Size of Network ID Field

Size of Host ID Field

Number of Available Network Addresses

Number of Available Host Addresses per Network

Start Address

End Address































Example. A host has an IP address of 10001000 11100101 11001001 00010000. Find the class and decimal equivalence of the IP address.

Solution. The host’s IP address belongs to class B, since it starts with 10. Its decimal equivalent is

1.5.2 Subnet Addressing and Masking

The concept of subnetting was introduced to overcome the shortcomings of IP addressing. Managing a large number of hosts is an enormous task. For example, a company that uses a class B addressing scheme can support up to 65,535 hosts on one network. If the company has more than one network, a multiple-network address scheme, or subnet scheme, is used. In this scheme, the host ID of the original IP address is subdivided into subnet ID and host ID, as shown in Figure 1.14.

Figure 1.14

Figure 1.14 A subnet ID and host ID in class B addressing

Depending on the network size, different values of subnet ID and host ID can be chosen. Doing so would prevent the outside world from being burdened by a shortage of new network addresses. To determine the subnetting number, a subnet mask—logic AND function—is used. The subnet mask has a field of all 0s for the host ID and a field of all 1s for the remaining field.

Example. Given an IP address of and a subnet mask of, determine the maximum number of hosts per subnet.

Solution. Figure 1.15 shows the details of the solution. Masking on the IP address results in Clearly, the IP address is a class B address. In a class B address, the lower 16 bits are assigned to the subnet and host fields. Applying the mask, we see that the maximum number of hosts is 27 = 128.

Figure 1.15

Figure 1.15 An example of subnet and masking

Example. A router attached to a network receives a packet with the destination IP address The network is assigned an address of Assume that the network has two subnets with addresses and and that both subnet ID fields have 8 bits. Demonstrate the details of routing the packet.

Solution. When it receives the packet, the router determines to which subnet the packet needs to be routed, as follows: The destination IP address is, the subnet mask used in the router is, and the result is The router looks up its routing table for the next subnet corresponding to the subnet, which is subnet 2. When the packet arrives at subnet 2, the router determines that the destination is on its own subnet and routes the packet to its destination.

1.5.3 Classless Interdomain Routing (CIDR)

The preceding section described an addressing scheme requiring that the address space be subdivided into five classes. However, giving a certain class C address space to a certain university campus does not guarantee that all addresses within the space can be used and therefore might waste some addresses. This kind of situation is inflexible and would exhaust the IP address space. Thus, the classful addressing scheme consisting of classes A, B, C, D, and E results in an inefficient use of the address space.

A new scheme, with no restriction on the classes, emerged. Classless interdomain routing (CIDR) is extremely flexible, allowing a variable-length prefix to represent the network ID and the remaining bits of the 32-field address to represent the hosts within the network. For example, one organization may choose a 20-bit network ID, whereas another organization may choose a 21-bit network ID, with the first 20 bits of these two network IDs being identical. This means that the address space of one organization contains that of another one.

CIDR results in a significant increase in the speed of routers and has greatly reduced the size of routing tables. A routing table of a router using the CIDR address space has entries that include a pair of network IP addresses and the mask. Supernetting is a CIDR technique whereby a single routing entry is sufficient to represent a group of adjacent addresses. Because of the use of a variable-length prefix, the routing table may have two entries with the same prefix. To route a packet that matches both of these entries, the router chooses between the two entries, using the longest-prefix-match technique.

Example. Assume that a packet with destination IP address is received by router R1, as shown in Figure 1.16. Find the final destination of the packet.

Figure 1.16

Figure 1.16 CIDR routing

Solution. In the table entries of router R1, two routes, L1 and L2, belonging to and, respectively, are initially matched with the packet’s IP address. CIDR protocol then dictates that the longer prefix must be the eligible match. As indicated at the bottom of this figure, link L1, with its 21-bit prefix, is selected, owing to a longer match. This link eventually routes the packet to the destination network, N3.

CIDR allows us to reduce the number of entries in a router’s table by using an aggregate technique, whereby all entries that have some common partial prefix can be combined into one entry. For example, in Figure 1.16, the two entries and can be combined into, saving one entry in the table. Combining entries in routing tables not only saves space but also enhances the speed of the routers, as each time, routers need to search among fewer addresses.

  • + Share This
  • 🔖 Save To Your Account