0% found this document useful (0 votes)
5 views32 pages

04 Tcpip2 Slides

The document explains the concepts of encapsulation and decapsulation in data transmission, particularly focusing on the Trivial File Transfer Protocol (TFTP) and the Internet Protocol (IP). It details how data is packaged with headers and trailers as it moves through the protocol layers and discusses the structure of IP datagrams, including fragmentation and reassembly processes. Additionally, it covers the implications of overhead and the differences between transparent and non-transparent fragmentation in network communication.

Uploaded by

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

04 Tcpip2 Slides

The document explains the concepts of encapsulation and decapsulation in data transmission, particularly focusing on the Trivial File Transfer Protocol (TFTP) and the Internet Protocol (IP). It details how data is packaged with headers and trailers as it moves through the protocol layers and discusses the structure of IP datagrams, including fragmentation and reassembly processes. Additionally, it covers the implications of overhead and the differences between transparent and non-transparent fragmentation in network communication.

Uploaded by

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

Encapsulation

Basic concept of encapsulation / decapsulation


⋅ As data flows down the protocol hierarchy, headers
(and trailers) get appended to it
⋅ As data moves up the hierarchy, headers (and trailers)
get stripped off.

An example to illustrate encapsulation / decapsulation


⋅ Trivial file transfer protocol (TFTP).
⋅ Simpler than FTP in that it uses UDP instead of TCP.
TFTP over Ethernet

TFTP App TFTP App

UDP UDP

IP IP

Ethernet Ethernet
Encapsulation in TFTP

Data

TFTP
Data TFTP Message
Header

UDP TFTP
Data UDP Packet
Header Header

IP UDP TFTP
Data IP Packet
Header Header Header

Ethernet IP UDP TFTP Ethernet


Data Ethernet Frame
Header Header Header Header Trailer
⋅ TFTP client transfers 200 bytes of data.
⋅ 4 bytes of TFTP header gets added.
⋅ 8 bytes of UDP header gets added.
⋅ 20 bytesof IP header (minimum).
⋅ 14 bytes of Ethernet header, 4 bytes of Ethernet trailer.
⋅ 200+4+8+20+14+4=250 bytes
⋅ 50 additional bytes are needed
⋅ Additional data is called overhead
⋅ Digital transmission always has some overhead
⋅ In our TFTP example, 50/200=1/4=25% overhead on
the original message size of 200 bytes
IP PROTOCOL

IP DATAGRAMS (PACKETS)
The IP Layer

IP layer provides a connectionless, unreliable delivery system


for packets.

Each packet is independent of the other packets.


⋅ The IP layer need not maintain any transmission history.
⋅ Each IP packet must contain the source and destination
addresses.
The IP Layer

⋅ The IP layer does not guarantee delivery of packets.

IP layer encapsulation
⋅ Receives a data chunk from the higher layer (TCP or UDP).
⋅ Prepends a header of minimum 20 bytes.
⋅ The header containing relevant information for
handling routing and flow control.
Illustration of IP Layer Encapsulation

Data

20-byte
Data
IP Header
Datagram (Packet) = Header + Data (Payload)
Format of IP v4 Datagram

0 4 8 15 16 31
Ver HLEN Service Type Total Length
Identification Flags Fragment Offset
Time to Live Protocol Header Checksum Header of
Source IP Address IP Datagram
Destination IP Address
Options
Data of
Data IP Datagram
(Payload)
IP Header Fields

VER (4 bits)
⋅ Version of the IP protocol in use (here version 4)

HLEN (4 bits)
⋅ Length of the header, expressed as the number of 32-bit
words.
⋅ Minimum size of HLEN is 5 (20 bytes)
⋅ Maximum is 15 (60 bytes)
Service Type (8 bits)
⋅ Allows packet to be assigned a priority.
⋅ Router can use this field to route packets.
⋅ Not universally used.

Total Length (16 bits)


⋅ Length in bytes of the datagram, including the header.
⋅ Minimum is 20 bytes (packet with header, but without
data)
⋅ Maximum datagram size: 2^16-1=65535 bytes.
Identification field is used to identify groups of fragments of a
single IP packet.

Flags is a field consisting of three one-bit flags: the first is


reserved and is always zero, the second is the Don't Fragment
(DF) flag and third is the More Fragments (MF) flag.

Fragment Offset - to be discussed later.


Those flags, as well as the fragment offset field are used in
fragmentation, which will be discussed in more details later.

Time to Live (8 bits)


⋅ Prevents a packet from traveling in a loop.
⋅ Senders sets a value, that is decremented at each hop. If it
reaches zero, packet is discarded.
Protocol (8 bits)
⋅ Identifies the higher layer protocol used.
⋅ The checksum (16 bits) is computed only for the data of
the IP header - covers only header
⋅ the payload is not being checked for errors
⋅ The checksum is stored in the IP packet. It is recalculated
at each router. If a mismatch is found between the stored
and the calculated checksum at any forwarding node, the
packet is discarded as being corrupt. No attempt to
correct the error is made.
⋅ On the other hand, a checksum for the payload is
calculated by the encapsulated protocol. Both UDP and
TCP have checksum fields.
Source IP address (32 bits)
⋅ Internet (IP) address of the sender.
Destination IP address (32 bits)
⋅ Internet (IP) address of the destination.

Options (variable size)


⋅ Can be used if the routers support them.
⋅ Example: Source routing
Fragmentation / Reassembly

⋅ We now discuss the fields used for fragmentation and


reassembly of packets.
⋅ If the packet size exceeds a certain maximum value, it
is split into two or more fragment packets.
⋅ The fragments are reassembled at some later stage.
Why/when is fragmentation needed?

⋅ Each layer imposes some maximum size of packets, due to


various reasons.
⋅ Called Maximum Transfer Unit (MTU)
⋅ Suppose a large packet travels through a network whose
MTU is too small. => Fragmentation is required.
Fragmentation (contd.)

⋅ Different networks are connected among themselves


through routers.
⋅ Allow the routers to break the packets into fragments, if
necessary.
⋅ Each fragment is transmitted as a separate IP packet
⋅ The fragments need to be reassembled back.
Fragmentation (contd.)

When/where is reassembly of fragments carried out?


⋅ Two alternatives:
⋅ Transparent fragmentation
⋅ Non-transparent fragmentation
Interconnection of Networks
N2
R R

R H2
N4
N1 R R
H1

R R
N3
Transparent Fragmentation
Fragmentation is made transparent to subsequent networks
through which the packet pass.
Basic concept:
⋅ An oversized packet reaches a router.
⋅ Router breaks it up into fragments.
⋅ All fragments sent to the same exit router.
⋅ The exit router reassembles the fragments before
forwarding to the next network.
⋅ Transparent Fragmentation (contd.)

⋅ Why is it called transparent?


⋅ Subsequent networks are not aware that fragmentation
had occurred - it is transparent to subsequent networks.

⋅ A packet may get fragmented several times on its way to


the final destination.
Transparent Fragmentation (contd.)

R1 fragments R2 reassembles R3 fragments R4 reassembles


packet packet packet packet
Packet
R1 R2 R3 R4
Network 1 Network 2
Transparent Fragmentation (contd.)
Drawbacks:
⋅ All packets must be routed via the same exit router.
⋅ Exit router must know when all the pieces have been
received.
⋅ Either a “count” field or “end-of-packet” field must be
stored in each packet
⋅ Lots of overhead - a large packet may be fragmented
and reassembled repeatedly.
Non-transparent Fragmentation

Fragmentation is not transparent to subsequent networks.


Basic concept:
⋅ Packet fragments are not reassembled at any
intermediate router.
⋅ Each fragment is treated as an independent packet by
the routers.
⋅ The fragments are reassembled at the final destination
host
Non-transparent Fragmentation (contd.)

R1 fragments Fragments are not Fragments may be R4 reassembles


packet reassembled further fragmented packet
Packet
R1 R2 R3 R4
Network 1 Network 2
Non-transparent Fragmentation, (contd.)
Advantage:
⋅ Multiple exit routers may be used.
⋅ Higher throughput
Drawback:
⋅ When a large packet is fragmented, overhead increases.
⋅ Each fragment must have a header (minimum 20 bytes).

The IP protocol uses non-transparent fragmentation.


IP Datagram
0 4 8 15 16 31
Ver HLEN Service Type Total Length
Identification Flags Fragment Offset
Time to Live Protocol Header Checksum Header of
Source IP Address IP Datagram
Destination IP Address
Options
Data of
Data IP Datagram
(Payload)
IP Fragmentation
To allow fragment reassembly at the final destination, IP uses
the following fields in the header:
Identification (16 bits)
⋅ A datagram id set by the source. A unique identifier of
the group of fragments set by a source. When that
packet is fragmented into fragments, each of the
fragments will carry the same ID. The receiver will
identify the fragments carrying the same ID as part of
the same packet.
Flags (3 bits)
Two flags are defined:
⋅ DF flag (bit): don’t fragment; prevents fragmentation
⋅ MF flag (bit): more fragments; specifies if this fragment
is the last one in the original packet
Fragment offset (13 bits)
⋅ Indicates where in the original datagram this fragment
belongs to. Relative to the beginning of the original
unfragmented datagram. First fragment has offset 0.
⋅ Specified in multiples of 8 bytes (8-byte blocks)
Example: IP Fragmentation

N1 N2

MTU=620 bytes MTU=400 bytes

⋅ sending 1000 bytes of data


ID=5
FO=0
M=0
20 1000
To N1
ID=5 ID=5
FO=0 20 600 20 400 FO=75
M=1 M=0
To N2

20 376 20 224 20 376 20 24


ID=5 ID=5 ID=5 ID=5
FO=0 FO=47 FO=75 FO=122
M=1 M=1 M=1 M=0
1020 sent (2% overhead), 1080 bytes received (8% overhead)

You might also like