DATA

advertisement
Internet Protocol
--- Connectionless Datagram Delivery
Linda Wu
(CMPT 471 • 2003-3)
Content




TCP/IP internet services
Internet datagram format
Fragmentation & Reassembly
Datagram fields
Reference: chapter 7
Notes-5
CMPT 471  2003-3
2
TCP/IP Internet Services



Networking services are arranged in a hierarchy
Internet software is designed around three
conceptual networking services
Replacing one service will not disturb others
Application
layer
Transport
layer
Network
layer
Notes-5
Application services
(SMTP, FTP, DNS, … SNMP)
Reliable transport service
(TCP, UDP)
Connectionless packet delivery service
(IP, ICMP, IGMP, ARP, RARP)
CMPT 471  2003-3
3
TCP/IP Internet Services (cont.)

Connectionless delivery system
Data are split into several packets



Notes-5
Unreliable: delivery is not guaranteed;
packet may be lost, duplicated, delayed
Connectionless: each packet is treated
independently from all others
Best-effort: internet software makes an
earnest attempt to deliver packets;
unreliability arises only when resources
are exhausted or networks fail
CMPT 471  2003-3
4
TCP/IP Internet Services (cont.)

Internet protocol (IP)

IP protocol defines the unreliable,
connectionless delivery mechanism, and
provides 3 important definitions:
Format of data passed across the internet



Notes-5
internet transfer unit is called internet
datagram
Routing function
Rules of unreliable packet delivery:
packet processing, error handling, etc.
CMPT 471  2003-3
5
Internet Datagram Format

Internet datagram (IP datagram, datagram)
Datagram header

Datagram data area
Datagram vs. frame
Datagram
Frame
Divided into header and data
Transfer unit of
internet
Transfer unit of physical
network
Handled by software
Recognized by hardware
Header contains src. / Header contains src. /
dest. IP addresses
dest. physical addresses
Notes-5
CMPT 471  2003-3
6
Internet Datagram Format (cont.)

Datagram format
0
4
8
VERS HLEN
16
SVC TYPE
IDENTIFICATION
TIME TO
LIVE
19
24
31
TOTAL LENGTH
FLAGS
PROTOCOL
FRAGMENT
OFFSET
HEADER CHECKSUM
SOURCE IP ADDRESS
DESTINATION IP ADDRESS
IP OPTIONS (IF ANY)
PADDING
DATA
……
Notes-5
CMPT 471  2003-3
7
Fragmentation & Reassembly

IPv4 datagram length



Network MTU



Notes-5
 216 –1 = 65,535
Includes the length of header and data
Maximum transfer unit (MTU): each
hardware technology places a fixed
upper bound on the amount of data
transferred in one frame
Ethernet MTU: 1500 (bytes/frame)
FDDI MTU: 4470
CMPT 471  2003-3
8
Fragmentation & Reassembly (cont.)

Datagram encapsulation



Carrying one datagram in one frame
Hardware does not recognize datagram
format
Efficient transportation
Datagram
header
Frame
header
Datagram data area
Frame data area
Frame
trailer
 MTU
Notes-5
CMPT 471  2003-3
9
Fragmentation & Reassembly (cont.)

MTU vs. datagram length



Notes-5
Limiting datagram to fit the smallest
possible MTU makes transfer inefficient
Allowing datagrams to be larger than
the minimum MTU means a datagram
cannot always fit into a single frame
Solution in IP protocol: datagram
fragmentation
CMPT 471  2003-3
10
Fragmentation & Reassembly (cont.)

Datagram fragmentation






Notes-5
The source chooses a convenient datagram
size
Intermediate routers divide large datagram
into small fragments when needed
Fragments may not be of equal size; their
sizes must be multiple of 8
Each fragment can be shipped in a single
frame
Router must accept datagram up to the
maximal MTUs of the networks they attach to
Fragments travel to the destination as
separate datagrams
CMPT 471  2003-3
11
Fragmentation & Reassembly (cont.)
A
Net 1
MTU=1500
Header
20 bytes
Data1
600 bytes
B
R1
Net 2
MTU=620
R2
Net 3
MTU=1500
Original datagram: A  B
Data2
Data3
600 bytes 200 bytes (1400 bytes of data)
Fragmentation at R1:
Fragmt. 1
header
Data1
Fragment 1 (offset: 0/8)
Fragmt. 2
header
Data2
Fragment 2 (offset: 600/8)
Fragmt. 3
Data3
header
Notes-5
Fragment 3 (offset: 1200/8)
CMPT 471  2003-3
Fragment header
duplicates most
of the fields in
the datagram
header
12
Fragmentation & Reassembly (cont.)

Reassembly at ultimate destination



Notes-5
Reassembly timer
 Started when an initial fragment is received
 If the timer expires before all fragments arrive,
all the received fragments will be discarded
Advantages
 Fragments are routed independently
 Intermediate routers are not required to store or
reassemble fragments
Disadvantages
 Small fragments may traverse on networks with
large MTU capability
 If any fragment is lost, datagram cannot be
reassembled
CMPT 471  2003-3
13
Datagram Fields

VERS





Notes-5
4 bits
Specifies the version of IP protocol used
to create the datagram
To verify that sender, receiver and any
router in between them agree on the
datagram format
Machines reject datagram with protocol
version that differs from theirs
Current version: 4 (IPv4)
CMPT 471  2003-3
14
Datagram Fields (cont.)

HLEN



TOTAL LENGTH




Notes-5
4 bits
Specifies datagram header length (unit:
32-bit word / 4 bytes)
16 bits
Specifies # of bytes in header and data
(unit: byte)
TOTAL LENGTH  216 –1 = 65,535
Size of data = TOTAL LENGTH - HLEN
CMPT 471  2003-3
15
Datagram Fields (cont.)

SERVICE TYPE


8 bits
Original TOS interpretation
0 1 2
Precedence
3
D
4
T
5
R
6
7
Unused
Precedence: importance of datagram
D: low delay
T: high throughput
R: high reliability
Notes-5
CMPT 471  2003-3
16
Datagram Fields (cont.)

Revised differentiated services
interpretation


A codepoint value maps to an underlying service
definition
0 1 2
3
4 5 6 7
Codepoint (DSCP)
Unused
3 right-most bits of codepoint


All 0s: xxx000 (backward compatible with original
interpretation)
Not all 0s: 3 administrative groups
Pool Codepoint
1
xxxxx0
2
xxxx11
3
xxxx01
Notes-5
Interpretation assigned by
IETF (Internet Authority)
Local or experimental
Local or experimental for now
CMPT 471  2003-3
17
Datagram Fields (cont.)

Fragmentation control fields

IDENTIFICATION
Datagram sender generates a unique
IDENTIFICATION for each datagram
 It is copied to fragment header for
reassembly at a later time
 Source address + IDENTIFICATION: to
identify datagram


FRAGMENT OFFSET

Notes-5
The offset in the original datagram of the
data carried in the fragment (unit: 8 bytes)
CMPT 471  2003-3
18
Datagram Fields (cont.)

FLAGS: 3 bits

D: do not fragment


1
2
Reserved
D
M
When a router needs to fragment a datagram
with D bit set, it will discard the datagram
and send an error message to the source
M: more fragments



Notes-5
0
To indicate whether a fragment is the tail of
the datagram
Destination gets the TOTAL LENGTH of the
fragment instead of the original datagram
Upon receiving a fragment F with M bit off,
calculate total length of the datagram based
on F’s total length and F’s fragment offset
CMPT 471  2003-3
19
Datagram Fields (cont.)

TIME TO LIVE (TTL)




Notes-5
Defines hop limit of a datagram
Each router along the path from source to
destination decrements TTL by 1
If datagram’s TTL filed is 0, router discards
datagram and sends back an error
message to the source
Objective: to guarantees that datagrams
cannot travel around internet forever
CMPT 471  2003-3
20
Datagram Fields (cont.)

PROTOCOL


Notes-5
8 bits
Defines the higher-level protocol to
which datagram should be delivered
Value
Protocol
1
ICMP
2
IGMP
6
TCP
17
UDP
89
OSPF
CMPT 471  2003-3
21
Datagram Fields (cont.)

HEADER CHECKSUM

To ensure integrity of header
Calculated at the sender and the value
obtained is sent with datagram
 The receiver repeats the same calculation




Notes-5
If the result is satisfactory, accept the
datagram
Otherwise, reject it
Only applies to values in header, not to
data
CMPT 471  2003-3
22
Datagram Fields (cont.)

SOURCE / DESTINATION IP ADDRESS



DATA



Specifies the data sent in datagram
Variable length
PADDING



Notes-5
Specifies sender / intended recipient of datagram
Never changes when datagram is routed through
intermediate routers
Composed of all 0s
Its length depends on IP OPTIONS selected
To ensure the datagram header extends to an
exact multiple of 32 bits
CMPT 471  2003-3
23
Datagram Fields (cont.)

IP OPTIONS



CODE
(8 bits)
COPY
1 bit
Optional fields with variable length
Appear contiguously without separators
between them
Format
LENGTH
( 8 bits)
CLASS
2 bits
DATA
(variable length)
NUMBER
5 bits
LENGTH: total length of the option,
including code field and length field
DATA: data that specific options require
Notes-5
CMPT 471  2003-3
COPY
0 Copy only in the first fragment
1 Copy in all fragments
CLASS
00 Datagram control
01 Reserved
10 Debugging and management
11 Reserved
NUMBER
See examples on P109
24
Datagram Fields (cont.)

Record route option



To record the routers that handle the
datagram
POINTER: the offset within option of the
next available slot
When a machine handles a datagram with
record route option
If POINTER > LENGTH, forward datagram
without inserting its entry
 Otherwise, insert its entry, increase POINTER
by 4

Notes-5
0
8
16
24
CODE (7)
LENGTH POINTER
First IP Address (empty when started)
Second IP Address (empty when started)
CMPT 471  ……
2003-3
31
25
Datagram Fields (cont.)

Source route option


Used by the source to predetermine a route for
the datagram
At the router side
 If POINTER > LENGTH, do routing as usual
 Otherwise, follow POINTER to pickup IP address,
replace it with its outgoing IP address, increase
POINTER by 4, and forward the datagram
0
8
LENGTH
16
24
POINTER
31
CODE
(137 / 131)
IP Address of First Hop (filled when started)
IP Address of Second Hop (filled when started)
……
Notes-5
CMPT 471  2003-3
26
Datagram Fields (cont.)

Strict source route (CODE 137)
All the routers in the option must be visited
 A router not listed in the option must not be
visited
 If datagram visits a router not in the list, or,
if it arrives at destination with some listed
routers not visited, the datagram is
discarded and an error message is issued


Loose source route (CODE 131)
Each router in the list must be visited
 The datagram can visit other routers as well

Notes-5
CMPT 471  2003-3
27
Datagram Fields (cont.)

Timestamp option





To record the time at which router processes
datagram
To keep track of router behavior in the internet
OFLOW: # of routers that cannot supply a
timestamp because the option is full
FLAGS: specifies the visited router responsibilities
Timestamp: time and date at which router
processes datagram; expressed as milliseconds
since midnight, Universal Time
0
8
16
24
CODE (68) LENGTH POINTER OFLOW
First IP Address
First Timestamp
…
Notes-5
CMPT 471  2003-3
31
FLAGS
28
Datagram Fields (cont.)

Subfield: FLAGS
FLAGS value
Notes-5
Meaning
0
Record timestamp only; omit IP
address
1
Precede each timestamp by an IP
address
3
IP addresses are specified by
sender; a router only records a
timestamp if its IP address
matches the next IP address in
the list
CMPT 471  2003-3
29
Datagram Fields (cont.)

Processing IP OPTIONs during
fragmentation

The function of COPY bit in fragmentation
Some IP OPTIONs are replicated in all
fragments
 Some IP OPTIONs are placed in one
fragment



Notes-5
Record route option should only be
copied into one of the fragments
Source route option should be copied into
all fragments
CMPT 471  2003-3
30
Download