IP Addressing

IP addressing is a hardware-independent convention which in principle allows every computer attached to the Internet to be given a unique logical address (though we will see later on that there are some important exceptions to this).

IP addresses are currently 32-bit binary strings which are normally seen by humans (e.g., network administrators, in dotted decimal as in the example:

The decimal numbers here have no meaning in isolation; this is simply a convenient way of encoding the numbers so that administrators and others find it easier to recognize them. What happens is that the 32-bit address is broken up into four 8-bit sequences each of which is converted to decimal. So the above address is in binary:

11011111 00111010 00000001 00001010

IP Address Formats

Originally IP addresses were divided into five classes as shown below. Classes A, B and C are the most important: the initial bits determine which class an address belongs to, and the classes differ in how much of the address is taken up with the network address and how much with the host address.

0 8 16 24
Class A
0  Network Host
Addresses to
Class B
10  Network Host
Addresses to
Class C
110  Network Host
Addresses to
Class D
1110  Multicast address
Addresses to
Class E
11110  Reserved for future use
Addresses to


Some address ranges are excluded from the above classes. All addresses of the form 127.xx.yy.xx are used for diagnostics. The following address ranges are designated as "private": meaning thay can only be used on networks which are not connected to the global Internet: - - -


Find the class, network and host addresses for:


Subnetting, Supernetting and Network Address Translation

The classfull addressing scheme has proved to be too inflexible to accommodate the demand for IP addresses; specifically, the convention that the part of the address which identifies a physical network must come on an 8-bit boundary meant that the address space could not be allocated efficiently and a significant proportion of addresses would be wasted. For instance, a Class A network can in theory have 16 million host IDs, which is way more than would be possible for a single physical network (subnet). Many enterprises have been allocated Class B addresses, giving them a theoretical maximum of 65,535 hosts, and may have no more than a few hundred hosts or less: under the classfull scheme the remaining host IDs for that network ID would be unused.

The lack of inflexibility in the addressing scheme is particulalrly undesirable because according to many authorities there is a real danger of the Internet running out of addresses, as a result of several factors which were not envisaged when the Internet protocols were originally designed, such as :


The basic idea behind subnetting is that we take away some bits from the host portion of the address and use them to identify the subnet. This will only be visible to hosts and routers on the local network; from the point of view of the Internet at large only the network ID portion will have any particular meaning. The way this works is that the network administrator defines a subnet mask, a string of 32 binary digits indicating the boundary between the subnet and host sections of the "local" portion of an IP address. Some examples should help make this clear:

  1. Take the Class A address, where 9 is the network address and 67.38.1 identifies a particular host on that network. Suppose the network administrator wants to use bits 8 to 25 to identify the subnet, leaving 26 to 31 for host addresses. This is done by means of a mask which is all 1's from bits 0 to 25 with the remainder set to 0's:

    11111111 11111111 11111111 11000000

    The subnet can then be indentified by ANDing the complete IP address with the mask giving the result shown below:

    00001001 01000011 00100110 00000001 = class A address

    00001001 01000011 00100110 00000000 = subnet base address

  2. Suppose a class C network has the subnet mask

    11111111 11111111 11111111 11100000

    This means that the first three bits from the host ID are used to identify the subnet, and the remaining 5 bits indicate the host itself. Take a host with the IP address

    11010100 01110010 00010000 01110001 =

    Applying the subnet mask gives us

    11010100 01110010 00010000 01100000 =

    The host ID proper comes out as 00010001 = 17.

For compatibility, routers include masks for unsubnetted addresses:

  4. N/A
  5. N/A

Supernetting and Classless Inter-Domain Routing (CIDR)

CIDR is in a sense the converse of subnetting, in that bits are taken from the network ID to identify a cluster of network addresses which are to be treated as a single entity. The main reasons for this are:

CIDR uses a supernet mask along with the lowest network address in the assigned block to identify the range of assigned network addresses.

Network Address Translation and IPv6

Network Address Translation is a technique which allows for the composition of a network to be completely hidden from the outside world, with the entire network identified by a single IP address. Within the network, hosts and routers have addresses which are unique to that network, typically taked from the ranges designated as "private" (see above). In order to make sure that responses get back to the right hosts when packets are sent out into the Internet, the router will construct a table associating outgoing packets with private IP addresses; the address of the relevant table entry will be stored in the packet itself. This technique is controversial however; for one thing the field in the packet where the index into the table is stored is part of the TCP header, which violates the principles of modularity and encapsulation on which the "protocol stack" models are based.

A longer term solution to the address exhaustion problem is offered by IP version 6 (IPv6) which among other innovations will support 128-bit addresses.