Sie sind auf Seite 1von 27

Computer Networks

CS F303

Internet Protocol (IP)

Ashutosh Bhatia
Department of Computer Science and Information Systems
BITS Pilani Birla Institute of Technology and Science
Pilani|Dubai|Goa|Hyderabad Pilani Campus, Pilani
BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Outline
• IP Packet Format
• Fragmentation and Reassembly
Recap

• IP Protocol: Needed functionality


 IP Protocol: Packet format, addressing
 Forwarding
 Routing
• Error reporting and host signaling
• Focus: Packet Format and Fragmentation
and re-assembly

3
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
IP datagram

Header Data

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Header

Source Address
Destination Address

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


How to avoid Looping
Dest addr: X Dest addr: X
Next Hop: B Next Hop: C

X X
A B

C
Dest addr: X
Next Hop: A

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Header

 Not really time but hop count


 Routers decrement the field by one before
forwarding; if zero discard
 Default value = 64

TTL
Source Address
Destination Address

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Header: Multiplexing

User

Entities Using services of IP


TCP UDP Other
Kernel
IP and lower Layers

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Header

TTL Protocol
Source Address
Destination Address

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Header

Demux key that identifies higher


layer protocol
 TCP: 6, UDP: 17

TTL Protocol
Source Address
Destination Address

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Header
With respect to fragmentation

Identification Flags Flags

TTL Protocol

Source Address

Destination Address

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Header
With respect to fragmentation

Hdr ToS
Ver. IP datagram length
length bits
Identification Flags Offset

TTL Protocol

Source Address

Destination Address

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Link layer encapsulation

Header Data

Hdr Header Data Trlr

Link layer frame

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Fragmentation and Reassembly

• Max size of IP packet is 65535 Bytes


• Problem: Each technology has different
Maximum Transmission Unit (MTU) size
 MTU: Largest IP datagram that can be
carried in a frame
 E.g. Ethernet: 1500, FDDI: 4352, PPP: 296
(Negotiable), WiFi: 7981

14
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Fragmentation

Header Data

Header Data
Frag 1

Header Data
Frag 2

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Fragmentation
• Fragmentation and reassembly are done by the IP layer

• Identification (16 bits)


– To identify fragments as pieces of the original (along with source
and destination addresses, and “protocol” field)

• Flags (3 bits)
– “More” bit
– “Don’t fragment” bit
– Unused

• Offset (13 bits)


– Offset in 8-byte units from the beginning of the payload of the
original

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Fragmentation

Header Data

Id = abcd,
More = 1,
Header Data Offset = 0
Frag 1

Id = abcd,
More = 0,
Header Data Offset = x
Frag 2

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Fragmentation
• At host: Select MTU of link it is connected to
– Each fragment becomes a packet on its own
– Routed independently of others

• At intermediate router: Forward datagram on a network with smaller


MTU
– Need to fragment the datagram
• Where to reassemble?
– Next hop router? Increases overhead and datagram may again be
fragmented
– Destination is the best place
• Reassembly timer at receiver
– If all fragments do not arrive by the reassembly time-out, original
packet cannot be obtained
– ICMP error generated

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Example: Fragmentation
ETH PPP ETH
(1500) (296) (1500)
H1 H2

ETH IP 1480B

Note: Above values not true in practice due to Offset field having to be a multiple of 8

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Example
Original Datagram
• Original datagram:
Len=1500 ID=x more=0 Offset=0
1500B
 Data within is Fragmented Datagram
1480B Len=292 ID=x more=1 Offset=0

• MTU: 296B
Len=292 ID=x more=1 Offset=34
 Max Data
Len=292 ID=x more=1 Offset=68
within is 276B
 Offset has to be Len=292 ID=x more=1 Offset=102
multiple of 8 ->
Len=292 ID=x more=1 Offset=135
Data within
272B
Len=140 ID=x more=0 Offset=170
20
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
IP Header: Error Checking

• Error detection only


• Note: does not cover the data
• Scheme: 1’s complement checksum
• Binary system
– To get the 1’s complement of a number, just invert
the bits

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Header

Hdr ToS
Ver. IP datagram length
length bits
Identification Flags Offset

TTL Protocol Header Checksum

Source Address

Destination Address

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Header: Error Checking

• Set the checksum field to zero


• Consider the header as a sequence of 16-bit
words
• Obtain the 1’s complement sum of these
words
• Store the 1’s complement of this sum in the
header field

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Header: Options
Hdr ToS
Ver. IP datagram length
length bits
Identification Flags Offset

TTL Protocol Header Checksum

Source Address

Destination Address

Options

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Header: Options
• Variable length field
– Zero or more options
• Option format
– Single octet, specifying “option type”
– “Option type” octet, “option length” octet and actual
“option data” octets

Type Length Data


• Ex:
– Loose/strict source and record route (RFC 791)
– Record route

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Summary
• Looked at IP packet format
• Looked at fragmentation and reassembly
• Next: Addressing and Forwarding

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Question
Suppose 1MByte of application data (including
application layer header) has to be sent out of a host
attached to Ethernet . Assume the application uses TCP
protocol and that the IP as well as TCP header is 20
bytes each. Further assume that Ethernet MTU size is
1500 and TCP uses segments of size 1480.

How many datagrams are sent out of the host?

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Das könnte Ihnen auch gefallen