You are on page 1of 37

IPv4 Overview

IP Protocol
This is host to host network layer connection less datagram protocol with no guarantee of reliability. It is a unreliable protocol bz it does not provide any error and flow control. It can only detect the error and discard the corrupted packet. IP Datagram Packet in IP layer are called datagram.it is a variable length packet with two parts Header and Data .The header is 20-60 bytes in length and contains information required for routing and delivery. data field is of variable length.

Structure of IP frame header

Version (VER). This 4-bit field defines the version of the IP protocol. Currently the version is 4. However, version 6 may totally replace version 4 in the future. This field tells the IPv4 software running in the processing machine that the datagram has the format of version 4. All fields must be interpreted as specified in the fourth version of the protocol. If the machine is using some other version of IPv4, the datagram is discarded rather than interpreted incorrectly. Header length (HLEN). This 4-bit field defines the total length of the datagram header in 4-byte words. This field is needed because the length of the header is variable (between 20 and 60 bytes). When there are no options, the header length is 20 bytes, and the value of this field is 5 (5 x 4 = 20). When the option field is at its maximum size, the value of this field is 15 (15 x 4 = 60). Services. This is 8-bit field. This field, previously called service type, is now called differentiated services.it defines the class of datagram for quality of service purpose.

Total length field defines the total length of the datagram including the header.
Length of data =total length - header length Since the field length is 16 bits, the total length of the IPv4 datagram is limited to 65,535 (216 - 1) bytes, of which 20 to 60 bytes are the header and the rest is data.

Fields Related to Fragmentation

Identification:--This 16-bit field identifies a datagram originating from the source host. When a datagram is fragmented, the value in the identification field is copied to all fragments . The identification number helps the destination in reassembling the datagram. It knows that all fragments having the same identification value must be assembled into one datagram. Flags:- This is a 3-bit field. The first bit is reserved and it should be zero. The second bit is called the do not fragment bit. If its value is 1, the machine must not fragment the datagram . If its value is 0, the datagram can be fragmented if required. The third bit is called the more fragment bit. If its value is 1, it means the datagram is not the last fragment; there are more fragments after this one. If its value is 0, it means this is the last or only fragment.

More fragmentation bit

Do not fragment bit

Reserved bit

Fragmentation offset
This 13-bit field shows the relative position of this fragment with respect to the whole datagram. It is the offset of the data in the original datagram measured in units of 8 bytes.

The bytes in the original datagram are numbered 0 to 3999. The first fragment carries bytes 0 to 1399. The offset for this datagram is 0/8 =O. The second fragment carries bytes 1400 to 2799; the offset value for this fragment is 1400/8 = 175. Finally, the third fragment carries bytes 2800 to 3999. The offset value for this fragment is 2800/8 =350. Remember that the value of the offset is measured in units of 8 bytes. This forces hosts that fragment datagrams to choose a fragment size so that the first byte number is divisible by 8. Time to live. A datagram has a limited lifetime in its travel through an internet. This field was designed to hold a timestamp, which was decremented by each visited router. The datagram was discarded when the value became zero. all the machines must have synchronized clocks and must know how long it takes for a datagram to go from one machine to another. this field is used mostly to control the maximum number of routers visited by the datagram. When a source host sends the datagram, it stores a number in this field. This value is 2 times the maximum number of routes between any two hosts. Each router that processes the datagram decrements this number by 1.If this value is zero, the router discards the datagram .

This field is needed because routing tables in the Internet can become corrupted . A datagram may travel between two or more routers for a long time without ever getting delivered to the destination host. This field limits the lifetime of a datagram . this field is also used to intentionally limit the journey of the packet. if the source wants to confine the packet to the local network, it can store 1 in this field. When the packet arrives at the first router, this value is decremented to 0, and the datagram is discarded

A no-operation option is a I-byte option used as a filler between options. An end-of-option option is a I-byte option used for padding at the end of the option field. It, however, can only be used as the last option. A record route option is used to record the Internet routers that handle the datagram. It can list up to nine router addresses. It can be used for debugging and management purposes. A strict source route option is used by the source to predetermine a route for the datagram as it travels through the Internet. The sender can choose a route with a specific type of service, such as minimum delay or maximum throughput. Alternatively, it may choose a route that is safer or more reliable for the sender's purpose A loose source route option is similar to the strict source route, but it is less rigid. Each router in the list must be visited, but the datagram can visit other routers as well. A timestamp option is used to record the time of datagram processing by a router. Knowing the time a datagram is processed can help users and managers track the behavior of the routers in the Internet. We can estimate the time it takes for a datagram to go from one router to another.

Checksum
First the value of the checksum field is set to O. Then the entire header is divided into 16-bit sections and added together. The result (sum) is complemented and inserted into the checksum field . The checksum in the IP packet covers only the header, not the data. There are two good reasons for this. First, all higher-level protocols that encapsulate data in the IP datagram have a checksum field that covers the whole packet. Therefore, the checksum for the IP datagram does not have to check the encapsulated data. Second, the header of the IP packet changes with each visited router, but the data do not. So the checksum includes only the part that has changed. If the data were included, each router must recalculate the checksum for the whole packet, which means an increase in processing time.

Services provided by IP
Addressing 32 bit address used by intermediate router to select a path through the network for the packet. Fragmentation IP packet may be split in to smaller packets. This permit a large packet to travel through a n/w that can handle the smaller packets. Packet time out time to live Address Space . IP uses 32-bit addresses . An address space is the total number of addresses used by the protocol. IP uses 32-bit addresses, which means that the address space is 232 or 4,294,967,296 (more than 4 billion).

Protocol

This 8-bit field defines the higher-level protocol that uses the services of the IP layer. An IP datagram can encapsulate data from several higher-level protocols such as TCP, UDP, ICMP, and IGMP. This field specifies the final destination protocol to which the IP datagram is delivered. since the IP protocol carries data from different other protocols, the value of this field helps the receiving network layer know to which protocol the data belong

Source address. This 32-bit field defines the IP address of the source. This field
must remain unchanged during the time the IP datagram travels from the source host to the destination host.

Destination address. This 32-bit field defines the IP address of the destination .
This field must remain unchanged during the time the IP datagram travels from the source host to the destination host.

Options
Options, as the name implies, are not required for every datagram. They can be used for network testing and debugging.

IP Address

IP Addresses: Classful Addressing

An IP address is a 32-bit address.

The IP addresses are unique.

RULE:
.. addr1protocol uses N bits to If a addr15 define an.. addr2 address, .. the address space is 2N .. addr41 addr226 because each bit can have two addr31 different .. .. values (0 and 1)
..

and N bits can have 2N values.

The address space of IPv4 is 232 or 4,294,967,296.


An address space is the total number of addresses used by the protocol.

Binary Notation
01110101 10010101 00011101 11101010

Dotted-decimal notation

Every router and host on internet has a unique IP address .all IP address are of 32 bit and they use source and destination field of the IP header. The first part of address is called network ID which identify the network on the internet and second called the host ID used to identify the individual host on that network. Classes of IP address :-

Netid and hostid

In classful addressing, the address space is divided into five classes: A, B, C, D, and E.

Class Ranges of Internet Addresses

Class A address
0 7 bit / network ID 24 bit host ID

32 bit

The n/w field is of 7 bit and the host field is of 24 bits . One bit is used for the class type. So the n/w field can have numbers b/w 0 to 127. but the host number ranges from 0.0.0.0 to 127.255.255.255. hence in class A there can be 127 types of n/ws. bit 0 in fist field indicates that it is class A n/w address.

27 2 6 25 24 23 22 21 20

000 0 0 0 0 0 000 0 0 0 0 1 . 0111 1 1 1 1

127

Same way total number of host will be ranges from 0. 0.0.0 to 127. 255.255.255

Millions of class A addresses are wasted.

Class B address
10 14 bit / network id 16 bit / host id

32 bit

The first field defines the class type and second field defines the networks. And last field defines the hosts. The n/w field values lies b/w 128 to 191.the first block covers the address from 128.0.0.0 to 128.255.255.255 and last block covers from 191.0.0.0 to 191.255.255.255.
14 bits (6 + 8) 10 (6 bit) 000000 8 bit( 00000000) Host id (8 + 8 )

Range from 0 to 255

Range from 0 to 255


Ranges from 128 to 191 Range from 0 to 255

Many class B addresses are wasted.

Class C address
32 bit 110 Network ID ( 21 bit) 21 bits(5+8+8) Host ID (8 bit)

110

0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0000

Host ID(8 bit)

272625 24 23 22 21 20 27 26 25 24 23 22 21 20

27 26 25 24 23 22 21 20 Host ID(8 bit)

110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
192

192.0.0.0

0 1 1 1 11111
255

110 1 1 1 1 1 1 1 1 1 1 1 1 1
255 223

Host ID(8 bit) 255

223.255.255.255

Class C address
32 bit 110 Network ID ( 21 bit) 21 bits(5+8+8) Host ID (8 bit)

110

0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0000

Host ID(8 bit)

272625 24 23 22 21 20 27 26 25 24 23 22 21 20

27 26 25 24 23 22 21 20 Host ID(8 bit)

110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
192

192.0.0.0

0 1 1 1 11111
255

110 1 1 1 1 1 1 1 1 1 1 1 1 1
255 223

Host ID(8 bit) 255

223.255.255.255

Class D address
32 bit 1110 Multicast ID

1 1 1 0

4 bit

8 bit

8 bit

8 bit

27 26 25 24 23 22
1 1 1 0
224

21 20
0 0 00000000 0000000 0000000
0 0 0

224.0.0.0

27 26 25 24 23 22 21 20 1 1 1 0 1 1 1 1 11111111
255

11111111
255

11111111
255

239

239.255.255.255

Class D addresses are used for multicasting; there is only one block in this class.

Class E address
32 bit 1111 Reserved for future use

1 1 1 1

4 bit

8 bit

8 bit

8 bit

27 26 25 24 23 22
1 1 1 1
240

21 20
0 0 00000000 0000000 0000000
0 0 0

240.0.0.0

27 26 25 24 23 22 21 20 1 1 1 1 1 1 1 1 11111111
255

11111111
255

11111111
255

255

255.255.255.255

Class E addresses are reserved for special purposes; most of the block is wasted.

Finding the address class

Finding the class in decimal notation

You might also like