0% found this document useful (0 votes)
10 views

Lecture03 Network Layer Internet Protocol

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Lecture03 Network Layer Internet Protocol

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

CENG 530

Network Layer:
Internet Protocol
Shawqi Kharbash

1
Outline
• Introduction
• IPv4 Datagram Format
• IP Datagram Fragmentation
• IP Datagram Processing

2
Introduction
• Internet Protocol (IP) – host-to-host network-layer
delivery protocol for the Internet with following properties
– connectionless service – each packet is handled independently
(possibly along different path)
– best-effort delivery service
1) does its best to deliver packet to its destination, but with no
guarantees
2) limited error control – only error detection, corrupted
packets are discarded
3) no flow control
– must be paired with a reliable transport- (TCP) and/or
application- layer protocol to ensure reliability

3
Introduction
• IP Protocol Versions
– IPv4 – version currently in wide use (1981)
– IPv6 – new version of IP protocol created to correct some of
significant problems of IPv4 such as exhaustion of address
space (1996)
– Mobile IP – enhanced version of IPv4 – supports IP in mobile
environments (1996)

4
IPv4 Datagram Format
Datagram-IP packet: variable length packet consisting of
header & data
– Header – 20 to 60 bytes in length, contains information essential
to routing and delivery
– Data – length determined by Maximum Transmission Unit (MTU)
oflink layer protocol (theoretically between 20 to 65536 bytes)

5
IPv4 Datagram Format
• Version Number (4-bit field) specifies IP protocol
version of the datagram (IPv4 or IPv6)
– different version of IP use different datagram formats
– by looking at version number router can determine howvto
interpret remainder of datagram
• Header Length (4-bit field) defines total length of
datagram header in 4-byte words
– when there are no options header length is 20 ⇒ HLEN = 5
• Differentiated Service (8-bit field) allows different
types of datagrams to be distinguished from each
other based on their associated / requested QoS
– • e.g. datagrams particularly requiring low delay,high throughput,
or reliability

6
IPv4 Datagram Format

Precedence defines the priority of


datagram in case of congestion. If
a router is congested and needs to
discard some datagrams, those
datagrams with lowest precedence
are discarded first.
Network management datagrams
have the highest precedence

7
IPv4 Datagram Format
• Total Length (16-bit field) – defines total datagram
length in bytes, including header
– 16 bits ⇒ maximum size = 65,535 bytes
– some physical networks are not able to encapsulate a datagram
of 65,535 bytes, so datagram must be fragmented to be able to
pass through those networks
– some physical networks have restriction on minimum size of
data that can be encapsulated in a frame, so datagram must be
padded (e.g. Ethernet min size of data – 46 bytes)

8
IPv4 Datagram Format
• Identifier(16bits), Flags(3bits), Fragmentation Offset (13
bits): These three fields are related to the fragmentation of
the IP datagram when the size of the datagram is larger
than the underlying network can carry.
• Time-To-Live (TTL) (8-bit field): controls max number of
hops visited by datagram and/or time spend in the network
– field is decremented by one each time datagram is processed by a
router – when TTL reaches 0, datagram must be dropped.
– ensures that
1. datagram does not circulate/loop forever, or
2. to limit its journey (e.g. LAN only: TTL = 1)

9
IPv4 Datagram Format
• Protocol (8-bit field) indicates specific transport-layer
protocol to which data portion of this IP datagram should
be passed
– used only at final destination to facilitate demultiplexing process
– protocol number is glue that binds network & transport layer,
while port number is glue that binds transport & application layer
– values: 1 – ICMP, 2 – IGMP, 6 – TCP, 17 – UDP, 89 – OSPF

10
IPv4 Datagram Format
• Header Checksum: (16-bit field) – aids in detecting
errors in header only!
– checksum must be recomputed & stored again at each router as
TTL and some options fields may change
– routers discard datagrams for which an error is detected
– checksum calculation:
1) divide header into 16-bit (2-byte) sections – checksum field
itself is set to 0
2) sum all sections using 1s complement arithmetic

11
IPv4 Datagram Format
Example of checksum calculation in IPv4

12
IPv4 Datagram Format
• Source and Destination IP Addresses (32-bit fields): must
remain unchanged until IP datagram reaches its final
destination
• Options (32-bit field(s)) not required for every datagram!
allows expansion of IP header for special purposes
– (a) Record Route option – used to trace route that datagram takes
source creates empty fields for IP addresses – up to 9 (40 bytes
options – 4 bytes option header) / 4 bytes for IP address
– each router that processes datagram inserts its outgoing IP address

13
IPv4 Datagram Format: Examples
An IP packet has arrived with the first 8 bits as shown: 01000010
The receiver discards the packet. Why?
Solution:
There is an error in this packet. The 4 left-most bits (0100)
show the version, which is correct. The next 4 bits (0010) show
the header length, which means (2 × 4 = 8), which is wrong.
The minimum number of bytes in the header must be 20. The
packet has been corrupted in transmission.

In an IP packet, the value of HLEN is 1000 in binary. How many


bytes of options are being carried by this packet?
Solution:
The HLEN value is 8, which means the total number of bytes in
the header is 8x4 or 32 bytes. The first 20 bytes are the main
header, the next 12 bytes are the options.

14
IP Datagram Fragmentation
• A datagram can travel through different networks. Each
router decapsulates the IP datagram from the frame it
receives, processes it, and then encapsulates it in
another frame.
• The format and size of the received frame depend on the
protocol used by the physical network through which the
frame has just traveled. The format and size of the sent
frame depend on the protocol used by the physical
network through which the frame isgoing to travel.

15
IP Datagram Fragmentation
• Maximum Transfer Unit (MTU):maximum amount of
data that link-layer frame can carry = hard limit on IP
datagram length.
• MTU differs from one data-link layer protocol to another
A. Token Ring (4 Mbps): MTU = 4,464 bytes
B. Ethernet: MTU = 1,500 bytes
C. PPP: MTU = 296 bytes

Hard limit on IP datagram size is not a problem. What is a problem is that each
of the links along the route between sender and receiver can use different link-
layer protocols, and each of these protocols can have different MTUs.

16
IP Datagram Fragmentation
• IP Datagram Fragmentation – process of dividing
datagram into smaller fragments that meet MTU
requirements of underlying data-link layer protocol.
 Datagram can be fragmented by source host or any other router in
the path; however reassembly of datagram is done only by
destination host! – parts of a fragmented datagram may take
different routes !!!
 Once fragmented datagram may be further fragmented if it
encounters network with even smaller MTU
 When a datagram is fragmented, each fragment gets its own
header with most fields repeated, but some changed
 Host or router that fragments datagram must change values of
three fields: flags, fragmentation offset and total length

17
IP Datagram Fragmentation
• Identification: (16-bit field) uniquely identifies datagram
originating from source host
– to guarantee uniqueness, IP uses counter to label each datagram
– when IP sends a datagram, it copies current counter value to
identification field, and increments counter by one
– when datagram is fragmented, identification field is copied into all
fragments
– identification number helps destination in reassembling datagram
• all fragments with same identification value should be assembled into
one datagram

18
IP Datagram Fragmentation
• Flags: (3-bit field)
– 1st bit is reserved
– 2nd bit is called “do not fragment” bit
• if its value is 1, machine must NOT fragment datagram
• if fragment cannot pass through physical network router
discards packet and sends ICMP error message back to
source host
– 3rd bit is called “more fragment” bit
• if its value is 1, datagram is not last fragment – there are
more fragments after this one
• if its value is 0, this is last or only fragment

19
IP Datagram Fragmentation
• Fragmentation Offset (13-bit field) shows relative
position of fragment’s data with respect to whole
datagram
– The offset is measured in units of 8 bytes – this is done because
offset field is only 13 bits long and otherwise could not represent
sequences greater than 8191
– this forces hosts and routers to choose fragment sizes divisible
by 8

20
IP Datagram Fragmentation

21
IP Datagram Fragmentation

22
IP Datagram Processing

23
Summary
We discussed:
– Introduction
– IPv4 Datagram Format
– IP Datagram Fragmentation
– IP Datagram Processing

24

You might also like