The Internet Protocol (IP)

Network

The network layer of OSI reference model takes care of routing, relaying, moving information from the source to the destination. The popular protocol of the network layer is the Internet Protocol (IP).

IP has two functions: 

1. Addressing
2. Fragmentation

Addressing is about how each node in a network is identified. We make use of IP addresses here. There are two versions of IP addresses. We call them as IPv4 and IPv6 based on the version.


Fragmentation is necessary when the datagram (the information from the upper layer - transport layer) has to traverse through a number of networks where the allowed packet size is smaller than the source network. The IP takes care of this fragmentation at the source and reassembly at the destination. There are some fields in the IP header to allow the fragmentation and reassembly. Different fields and the IP header are explained in below paragraphs. 

IP Header Structure

Version (4 bits): IP header format (IP version)
Header Length (4 bits): Size of IP header in multiples of 4 bytes. Minimum value is 5 (20 bytes)
Type of Service (1 byte): Specifies what treatment the datagram should undergo as it traverses the network.

Total Length (2 bytes):  Datagram length in bytes – includes both header and data. Maximum size 65535 bytes.
Identification (2 bytes): A value assigned to the datagram by the sender. It is used in assembling the fragments of a datagram, if required.

Flags (3 bits):

Fragmentation Offset (13 bits):  Indicates where in the datagram this fragment belongs. The offset is measured in units of 64 bits.
Time to Live (1 byte): Maximum lifetime allowed for datagram. TTL is decremented by one each time the datagram crosses a router; and the datagram is discarded once the TTL reaches zero. The purpose is to avoid the possibility of undeliverable datagrams indefinitely keep circulating over the Internet.
Protocol (1 byte):  Indicates the protocol used by the sender.
Header Checksum (2 bytes):  This field protects only the header fields. Computation: Sum all 16-bit words, then get 1’s complement of it. While a packet is passed from one network to the other, routers decrement the TTL field. At that time, they have to re-compute header checksum and fill this field.
Source and destination addresses: 4 bytes each for source and destination IPv4 addresses.
Options (variable length): This field has some optional tools to monitor the proper functioning of several network functionalities, namely: loose source routing option forces the datagram to cross a given list of IP devices to reach its destination; the strict source routing forces the datagram to cross exclusively the given list of IP devices; the record route option is used to trace the route the datagram takes; the timestamp option requires each traversed router to record (append) its IP address and time to the datagram.
Padding:  All zero field used to guarantee that the header ends on a 32-bit boundary.

Reference: Hands-On Networking: From Theory to Practice

Stumble
Delicious
Technorati
Twitter
Facebook

Bookmark and Share
Your Ad Here

0 comments

Post a Comment