Network Layer - IP

You might also like

You are on page 1of 19

Internet Protocol (IP)

IP protocol
● IP Protocol: Needed functionality
– IP Protocol: Packet format, addressing
– Forwarding
– Routing
– Error reporting and host signaling
● Focus: Packet Format and Fragmentation and
re-assembly
Packet Format
32 Bits
• Version: Specifies the 0 4 8 16 19 31
Type of
version of the protocol Ver HL
Service
Total Length
Fla Fragment
Identification Offset
gs
– IPv4, IPv6 Time to Upper
Live Header Checksum
Layer
• Header Length: Source IP Address
Specifies the header in Destination IP Address
32-bit words Options

– 5 words (without options) Data (Variable Length)


Packet Format
32 Bits
• Type of Service: 0 4 8 16 19 31
Type of
Permits packets to be Ver HL
Service
Total Length

treated differently Identification


Fla
gs
Fragment
Offset

– Research Focus Upper


Time to
Live Header Checksum
Layer
Source IP Address

• Total Length: Specifies Destination IP Address


the length of the
Options
datagram (in bytes)
including header Data (Variable Length)
Packet Format
32 Bits
0 4 8 16 19 31
Type of
Ver HL Total Length
Service
• Identification/Flags/ Identification
Fla Fragment
gs Offset
Fragment Offset: Time to Upper
Live Header Checksum
Layer
Source IP Address

Destination IP Address

Options

Data (Variable Length)


Packet Format
32 Bits
• Identification/Flags/ 0 4 8 16 19 31
Type of
Fragment Offset: Ver HL
Service
Total Length
Fla Fragment
Identification
– Max size of IP packet is gs Offset
Time to Upper
65535 Bytes Live Layer
Header Checksum

Source IP Address
– Physical Networks may
not support large packets Destination IP Address

Options
– Need Fragmentation and
reassembly (more on it Data (Variable Length)
soon)
Packet Format
• Time to Live: Helps catch 0 4 8
32 Bits
16 19 31
packets doing rounds Ver HL
Type of
Total Length
Service
Fla Fragment
Identification Offset
gs
Time to Upper
Live Header Checksum
Layer
Source IP Address

Destination IP Address

Options

Data (Variable Length)


Packet Format
• Time to Live: Helps catch 0 4 8
32 Bits
16 19 31
packets doing rounds Ver HL
Type of
Total Length
Service
Fla Fragment
Identification
– Not really time but hop gs Offset
Time to Upper
count Live Layer
Header Checksum

Source IP Address
– Routers decrement the
field by one before Destination IP Address

forwarding; if zero discard Options

– Default value = 64 Data (Variable Length)


Packet Format
32 Bits
0 4 8 16 19 31
• Protocol: Demux key Ver HL
Type of
Service
Total Length

that identifies higher Identification


Fla
gs
Fragment
Offset
layer protocol Time to
Live Protocol Header Checksum

Source IP Address
– TCP: 6, UDP: 17
Destination IP Address
• Checksum (Internet): Options
Detects errors in header
Data (Variable Length)
Packet Format
32 Bits
16 19 31
• Source/Destination IP 0
Ver
4
HL
8
Type of
Total Length
Service
address: 32-bit Fla Fragment
Identification Offset
gs
– Destination key to Time to
Live Protocol Header Checksum
forwarding Source IP Address

– Source for replying back Destination IP Address

– Global address space, Options

independent of physical
Data (Variable Length)
network address (MAC)
Packet Format
32 Bits
0 4 8 16 19 31
• Options: Rarely used Ver HL
Type of
Service
Total Length
Fla Fragment
– Record Time stamp Identification
gs Offset
Time to
Protocol Header Checksum
– Record route taken Live

Source IP Address
– Specify source route
Destination IP Address
• Data/Payload: Higher Options
Layer Data (TCP or UDP
segment) Data (Variable Length)
Fragmentation and Reassembly
Fragmentation and Reassembly
• Goal: Interconnect heterogeneous networks
• 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
• At host: Select MTU of link it is connected to

• At intermediate router: Forward datagram on a


network with smaller MTU
– Need to fragment the datagram
• Where to reassemble?
• At host: Select MTU of link it is connected to
• 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
Fragmentation and Reassembly
R1 R2
Ethernet PPP Ethernet H2
H1

ETH IP 1480 B PPP IP 276 B ETH IP 276 B

PPP IP 276 B ETH IP 276 B

PPP IP 276 B ETH IP 276 B

PPP IP 276 B ETH IP 276 B

PPP IP 276 B ETH IP 276 B

PPP IP 100 B ETH IP 100 B

Note: Above values not true in practice due to Offset field having
to be a multiple of 8
Fragmentation Fields
• Identification: Helps identify a datagram
– All fragments carry same identification
• Flags: 3 bits Identification Flags
Fragment
Offset

– bit 0: Reserved, set to zero


– bit 1: Don't Fragment (DF); Useful for path MTU
discovery

– bit 2: More Fragments (MF); Set to one to indicate


more fragments to follow
Fields
• Fragmentation Offset: 13 bits long
– Measures data/payload in units of eight-byte blocks
– For a particular fragment, offset specifies start of
data relative to the beginning of the original un-
fragmented IP datagram.
● E.g first fragment would have an offset of zero

Fragment
Identification Flags Offset
Example
Original Datagram
• Original datagram:
Length=1500 ID=x Fragflag=0 Offset=0
1500B

– Data within is 1480B Fragmented Datagrams

Length=292 ID=x Fragflag=1 Offset=0


• MTU: 296B
Length=292 ID=x Fragflag=1 Offset=34
– Max Data within is
Length=292 ID=x Fragflag=1 Offset=68
276B
Length=292 ID=x Fragflag=1 Offset=102
– Offset has to be multiple
Length=292 ID=x Fragflag=1 Offset=136
of 8 Data within 272B
Length=140 ID=x Fragflag=0 Offset=170

You might also like