Internet Protocol

Another important part of the TCP/IP suite and probably the most well known protocol in Internetworking world today is the Internet Protocol or IP. Its job is to deliver packets from end to end solely based on the IP address. IP is connectionless, unreliable and packets are delivered in best effort basis. This means packets sent by IP maybe lost somewhere, packets maybe duplicated at the receiving end, and may arrived not in order. No flow control, sequencing and error checking mechanism. All the needed checks are provided by the upper layers.

Figure 3-2 shows the structure of an IP packet. Note that we’re talking IP version 4 here, I’ll discuss the IPv6 formerly known as the Next-Generation IP in the later chapters.

Like the TCP, understanding the IP structure will give us better understanding on how it works.

IP Header Structure

  • Version (4 bits) — indicates IP protocol version
  • Internet Header Length (IHL – 4 bits) —indicates the header length in 32-bit words.
  • Type-of-Service (8 bits) — Indication of the quality of service
  • Total Length (16 bits)—indicates the length in bytes of the datagram, including the data and header.
  • Identification (16 bits) — contains a value assigned by the sender to aid in assembling together datagram fragments.
  • Flags (3 bits) — a 3 bit field of various control flags
  • Fragment Offset — is measured in units of 8 octets (64 bits). The first fragment has offset zero.
  • Time-to-Live (8 bits) — indicates a counter that gradually decrements during its travel down to zero where datagram is discarded.
  • Protocol (8 bits) — Indicates the higher level protocol used in the data portion of the internet datagram
  • Header Checksum (16 bits) — specifies the integrity of the IP header.
  • Source Address (32 bits) — specifies the source address
  • Destination Address (32 bits) — specifies the destination address
  • Options + Padding (variable) — indicate various options such as security. Datagram is padded if Options were used.
  • Data — the data in the datagram being passed to the higher level protocol.

The complete specification of IP is described in RFC 791. You can view this at IETF website at

IP Addressing

For our network device to communicate with each other in a TCP/IP network, an IP address must be assigned. So what is an IP address? For this topic, I will be discussing the IPv4. An IP address is represented in 32 bit value divided into four octets. An octet is an 8 bits value. is an example of IP address expressed in decimal format. You will notice that there are four number value separated by “dots” or “.”. To read the address, you would say “192 dot 168 dot 100 dot 1”. This “dot” format is called “dotted decimal notation”. Let’s format it again:

192. 168. 100. 1 – Dotted decimal format
11000000. 10101000. 1100100. 00000001 – dotted binary format

We have now represented our IP address to binary format where you can see that there are four octets again separated by “dot”. Each octet consists of eight binary digits. Counting all the digits will give you 32 bits in total. Not to worry if you don’t know how to convert decimal to binary, I will discuss this on the next chapter. For now, just remember that IP address version 4 or IPv4 is a 32 bit value represented in dotted notation.

IP Address Classes

Some of the bits in the IP address represent the network and some bits represent the host. We could simple say that IP address = Network bits + Host bits. So how do we identify this?

In general, IP addresses are divided into five classes namely A, B, C, D, and E but the most common are the A, B and C. The Class D are reserved for Multicasting while the Class E are use for future experimental purposes.

ip address

Class A

In this class, 7 bits are assigned as the network and 24 bits are assigned as the hosts. The first bit is reserved. Using the following formula, we should be able to get the total number of host.

Possible Host = 2x – 2

Where: x is the number of bits

Therefore, for class A, we have 27 = 128 networks and 224-2 = 16,777,214 hosts. Class A is best use when extremely large number of host is needed and network number are only limited.

By looking at the first octet, Class A has a network range of 0 to 127. In binary, that is:


0 = 00000000

127 = 01111111


However, 127 is not a real network number. I’ll discuss this to you later.

Class B

This class uses 14 bits for the network address and 16 bits for the host address. The first two bits are reserved.

Network = 214 = 16,384

Hosts = 216 – 2 = 65, 534

Obviously, this class is best use when more network addresses are required yet the number of host required still in mid range. Class B has a network range of 128 to 191 in the first octet.

Class C

The first 3 bits are reserved. A total of 221= 2,097,152 networks and 28 – 2 = 254 hosts. This class is best used when extremely number of networks is required.

Class C is in the range of 192 to 223.

There are some IP addresses which are not usable or reserved. Most of these have all bits set to 0 or 1. These addresses have been allocated with different meaning/purpose.


All 0’s in network address – meaning “this network”.

All 1’s in network address – meaning “all network”

All 0’s in host address – meaning “any host in the network”

All 1’s in host address – meaning “all host” in the network

All 0’s in entire IP address – meaning any network

All 1’s in entire IP address – meaning broadcast – reserved for loop back testing.


Private IP Address

When the IP address has been released initially, its team of creator somehow forgot to consider the number of IP addresses to be distributed worldwide. They seem to believe that there are enough IP addresses for every network devices in the world. There are more than 2 billion host addresses for Class A network but in the end, they found out that it’s not nearly enough for everybody. Every single company in the world may have 10’s or hundred’s or even thousands of network devices including computers. Not to mention the schools, universities and households have computers as well. There are no IP addresses left for these computers if they need connecting to the internet.

The good news is, they found a magical solution – the creation of private IP addresses.

These IP creators or designers realized that not all computers in the world need to be routed or connected to the internet. In a single company, the computers are networked together but some are only used internally and need not have connectivity to the outside world. Because of this, private IP addresses we’re introduced. Private IP’s are not routable and cannot be seen in the internet. These IP’s is for internal use only. And because it’s not routable, all the company can allocate them for their own internal use. This private IP addresses can then be translated to use a single public IP if they needed internetwork connectivity. (I’ll explain further when we talk about NAT). This saves a lot of public IP addresses.


Private IP’s are as follows:


  • Ø For Class A: networks
  • Ø For Class B: to networks
  • Ø For Class A: to networks


Any type of these private addresses can be used by any organization. Because they are not routable, it saves the organization from spending costly globally unique IP address and helped in saving worldwide scarcity of IP addresses.