0% found this document useful (0 votes)
12 views13 pages

Internet Protocol

Chapter 8 of CSC465 covers the Internet Protocol (IP) within the TCP/IP protocol suite, detailing its characteristics such as being unreliable and connectionless, and explaining the structure of IP datagrams. It discusses fragmentation, options, and checksum, emphasizing the importance of the Time to Live (TTL) field and how datagrams can be fragmented for transmission across networks with varying Maximum Transfer Units (MTUs). The chapter also includes examples and explanations of how to interpret IP packet headers and the implications of different fields within the datagram.

Uploaded by

Hendra_aj
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)
12 views13 pages

Internet Protocol

Chapter 8 of CSC465 covers the Internet Protocol (IP) within the TCP/IP protocol suite, detailing its characteristics such as being unreliable and connectionless, and explaining the structure of IP datagrams. It discusses fragmentation, options, and checksum, emphasizing the importance of the Time to Live (TTL) field and how datagrams can be fragmented for transmission across networks with varying Maximum Transfer Units (MTUs). The chapter also includes examples and explanations of how to interpret IP packet headers and the implications of different fields within the datagram.

Uploaded by

Hendra_aj
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/ 13

Chapter 8

CSC465 – Computer Networks


Spring 2004

Dr. J. Harrison Internet Protocol


These slides were produced almost entirely from material by Behrouz
Forouzan for the text “TCP/IP Protocol Suite (2nd Edition)”, McGraw
(IP)
Hill Publisher

Position of IP in TCP/IP protocol suite

CONTENTS
• DATAGRAM
• FRAGMENTATION
• OPTIONS
• CHECKSUM
• IP PACKAGE

IP
• Unreliable
• Connectionless
• Datagrams can follow different paths 8.1
• Can arrive out of order or be lost
DATAGRAM

1
IP
IP datagram • Version (VER): defines IP version 4-bits = 4
• Header length (HLEN): datagram header
– In 4-byte words; range is 5 to 15 (5 if no options)
• Differentiated Services (8-bit field)
– Old interpretation is “Service Type”
– First 3-bits Precedence: not used
– Bit 4: D - Minimize delays
– Bit 5: T – Maximize throughput
– Bit 6: R – Maximize reliability
– Bit 7: C – Minimize cost
– Bit 8: Not used

Service Type or Differentiated Services Some Default Types of Service


Protocol TOS Bits Description
ICMP 0000 Normal
SNMP 0010 Maximize Reliability
FTP (Data) 0100 Maximize Throughput
FTP (Command) 1000 Minimize delay
DNS (UDP query) 1000 Minimize delay
DNS (TCP query) 0000 Normal
Telnet 1000 Minimize delay
Interior Gateway 0010 Maximize reliability

Codepoint Values Total Length


• 16-bit value with length of header plus data
Category Codepoint Assigning Authority • IP Datagram limited to 64K bytes
1 XXXXX0 Internet – Some networks can’t encapsulate a 64K datagram
into their frames
2 XXXX11 Local
– Datagram must be fragmented
3 XXXX01 Temp/Experimental • Length field not normally needed
– Ethernet frame holds data sizes 46 to 1500 bytes
– If IP datagram is < 46 bytes padding will be added to
meet minimum requirement of DL layer
– Receiving IP layer needs to know breakdown

2
Encapsulation of a small datagram
in an Ethernet frame Time to Live
• Constrains “lifetime” of packet
• Stops “run-a-way” packets due to corrupt router
tables
– Protects network resources
– Avoids confusing TCP
• Field decremented by routers
• Can limit packet journey
– Set to one to keep traffic on LAN

Protocol Higher-level Protocol Field Values


• 8-bits Value Protocol
• Defines higher-level protocol using IP layer 1 ICMP
• Field specifies final destination protocol for 2 IGMP
delivery 6 TCP
• Helps in the IP demultiplexing process 17 UDP
89 Open Shortest-Path First (OSPF) Routing

Example 1
An IP packet has arrived with the first 8 bits
as shown:
An IP packet has arrived with the first 8 bits Í 01000010
as: 01000010.
The receiver discards the packet. Why?
The receiver discards the packet. Why?
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 byte words = 8 bytes), which
is wrong. The minimum number of bytes in the
header must be 20. The packet has been corrupted
in transmission.

3
Example 2 Solution

In an IP packet, the value of HLEN is 1000 In an IP packet, the value of HLEN is


in binary. How many bytes of options are 1000 in binary. How many bytes of
being carried by this packet? options are being carried by this packet?
The HLEN value is 8, which means the total
number of bytes in the header is 8 × 4 byte words
or 32 bytes.
The first 20 bytes are the main header, the next 12
bytes are the options.

Example 3 Solution
In an IP packet, the value of HLEN is 516
and the value of the total length field is In an IP packet, the value of HLEN is 516
002816. How many bytes of data are being and the value of the total length field is
carried by this packet? 002816. How many bytes of data are being
carried by this packet?

The HLEN value is 5, which means the total


number of bytes in the header is 5 × 4 or 20 bytes
(no options). The total length is 40 bytes, which
means the packet is carrying 20 bytes of data (40−
20).

Example 4: An IP packet arrives with the An IP packet has arrived with the first few
first few hexadecimal digits as shown below: hexadecimal digits as shown below:
Í 45000028000100000102...................
Í 45000028000100000102...................
How many hops can this packet travel before
How many hops can this packet travel before being dropped? The data belong to what
being dropped? The data belongs to what
upper layer protocol? upper layer protocol?
To find the time-to-live field, we should skip 8
bytes (16 hexadecimal digits). The time-to-live
field is the ninth byte, which is 01. This means the
packet can travel only one hop. The protocol field
is the next byte (02), which means that the upper
layer protocol is IGMP.

4
Fragmentation
• Datagram travels through different networks
• Router decapsulates frame, and encapsulates
8.2 • Format & Size of frame depends on network
• Each DL layer specifies maximum frame size
FRAGMENTATION (Maximum Transfer Unit)

IP Fragmentation
MTUs for Different Networks
• IP Should be independent of physical network
• IP Maximum Transfer Unit (MTU) = 64K bytes
Protocols MTU
• Transmission most efficient with DLs with 64K
HyperChannel 65,536
MTUs
Token Ring (16 Mbps) 17,914
Token Ring (4 Mbps) 4,464
• For networks with smaller MTUs, IP packet must
be fragmented
Fiber Distributed Data Interface 4,352
Ethernet 1,500 • Each fragment has own header (with most fields)
X.25 576 • Fragmented packet may again be fragmented if it
PPP 296 encounters a network with a still smaller MTU

IP Fragmentation (con’t) Fragmentation Fields


• IP packet can be fragmented by any host or any • Identification
router encountered along the path of travel – IP Addresses, ID → Datagram
• Reassembly of the datagram is performed at the – All datagram fragments retain datagram ID
destination (each datagram is independent) – Counter maintained to ensure uniqueness
– Only place we can expect that all IP packets will
eventually arrive – ID used to reassemble datagram from fragments
• Each fragment need most of header fields
– Option field may be copied also
• Host or router that fragments must change flags,
fragmentation offset and total length (&
checksum); rest of fields copied

5
Flag Field Fragmentation Offset
• 13-bit field shows relative position of fragment
w.r.t. entire datagram
• If “Do Not Fragment” bit set, machines are • Offset of data in original datagram measured in
instructed to drop packet if MTU too large: units of 8-bytes
• ICMP error message sent to host • 13-bits → 8192 * 8 = 65,536 (Max MTU size)
• Forces routers and hosts that fragment to choose
• More Fragments: the size of each fragment so that the first byte
• Indicates that the fragment is not the last number is divisible by 8

Size = 4020
Fragmentation Example (includes header)
1400/8 = 175
ID → 14,567

More Fragments 2200/8 = 275


Flag set to 0

Reassembly Strategy Example 5


1. The 1st fragment has an offset field value of 0
A packet has arrived with an M bit value of
2. Divide the length of this fragment by 8. The 0. Is this the first fragment, the last fragment,
2nd fragment has an offset value equal to that
or a middle fragment? Do we know if the
result.
packet was fragmented?
3. Divide the total length of the 1st & 2nd
fragments by 8. The 3rd fragment has an offset
value equal to that result.
4. Continue the process; last fragment has a more
bit value of zero

6
Solution Example 6

A packet has arrived with an M bit value of A packet has arrived with an M bit value of
0. Is this the first fragment, the last fragment, 1. Is this the first fragment, the last fragment,
or a middle fragment? Do we know if the or a middle fragment? Do we know if the
packet was fragmented? packet was fragmented?

If the M bit is 0, it means that there are no more


fragments; the fragment is the last one. However,
we cannot say if the original packet was
fragmented or not. A non-fragmented packet is
considered the last fragment.

A packet has arrived with an M bit value of Example 7


1. Is this the first fragment, the last fragment,
or a middle fragment? Do we know if the A packet has arrived with an M bit value of
packet was fragmented? 1 and a fragmentation offset value of zero. Is
this the first fragment, the last fragment, or a
If the M bit is 1, it means that there is at least one
middle fragment?
more fragment. This fragment can be the first one
or a middle one, but not the last one. We don’t
know if it is the first one or a middle one; we need
more information (the value of the fragmentation
offset). However, we can definitely say the
original packet has been fragmented because the M
bit value is 1.

Solution Example 8

A packet has arrived with an M bit value of A packet has arrived in which the offset
1 and a fragmentation offset value of zero. Is value is 100. What is the number of the first
this the first fragment, the last fragment, or a byte? Do we know the number of the last
middle fragment? byte?

Because the M bit is 1, it is either the first


fragment or a middle one. Because the offset value
is 0, it is the first fragment.

7
Solution Example 9

A packet has arrived in which the offset A packet has arrived in which the offset
value is 100. What is the number of the first value is 100, the value of HLEN is 5 and the
byte? Do we know the number of the last value of the total length field is 100. What is
byte? the number of the first byte and the last
To find the number of the first byte, we multiply byte?
the offset value by 8. This means that the first byte
number is 800. We cannot determine the number
of the last byte unless we know the length of the
data.

Solution

A packet has arrived in which the offset


value is 100, the value of HLEN is 5 and the
8.3
value of the total length field is 100. What is
the number of the first byte and the last
byte?
OPTIONS
The first byte number is 100 × 8 = 800. The total
length is 100 bytes and the header length is 20
bytes (5 × 4), which means that there are 80 bytes
in this datagram. If the first byte number is 800,
the last byte number must be 879.

Options Option Format


• IP Datagram Header comprised of two parts:
• Fixed: 20 bytes (previously discussed) Data and length fields optional
• Variable: comprises “options” (max 40 bytes)
• Options used for network testing and debugging g
• Options not required to appear in IP packet but
option processing mandatory in all IP
implementations Only 6 option
types are being
used

8
Categories of options
No operation option

• Multi-byte options require length and data fields

End of option option Record Route Option


• Records the internet routers that handle the
datagram
• Can store at most 9 router’s IP addresses
– 40 byte options – (9 * 4-bytes) – Code (1 byte) –
Length (1 byte) – Pointer (1 byte) = 1
• If (Pointer > Length) then Options area is full &
no further changes are made
• Only one End-of-Option (EoO) can be used • Otherwise, router inserts its outgoing IP address
• EoO must be used as last field of IP Option field • Each routers increments pointer field by 4 (bytes)
• After EoO, packet receiver expects payload data to point to next free entry for IP address (to
prepare for next router’s address)

Record route option Record route concept


3 bytes → Length field includes code, length and data
(init at 4)
Code is 7; Ptr increments

9 IP addr maximum (9 * 4-byte addr = 36 bytes) + 3 = 39


40 byte maximum for Options field

9
Strict Source Route Strict source route option

• Used to specify a predetermined route through


the Internet
• Useful to specify a preferred route based on type
of service, e.g., min delay, max throughput
• All routers specified must be visited
• If packet received by router not in list, packet
dropped and error generated
• If packet reaches destination without visiting all
routers, packet dropped and error generated

Strict source route concept Loose Source Route


Incoming router IP addressed used in datagram • Similar to Strict Source Routing
• Datagram can visit routers not in option list

Timestamp option
Timestamp
• Used to record the time that the datagram was
processed by the router
• Helps users and managers track the behavior of
Internet routers
• Determine time required for datagram to travel
from one router to the next
• Amount is estimate since no router’s clocks
cannot be guaranteed to be in sync

10
Use of flag in timestamp Timestamp concept

Example 10 Solution
Which of the six options must be copied to
Which of the six options must be copied to each fragment?
each fragment?
We look at the first (left-most) bit of the code for
• No operation each option.
• End of option No operation: Code is 00000001; no copy.
• Record route End of option: Code is 00000000; no copy.
• Strict source route Record route: Code is 00000111; no copy.
• Loose source route Strict source route: Code is 10001001; copied.
• Timestamp Loose source route: Code is 10000011; copied.
Timestamp: Code is 01000100; no copy.

Example 11 Solution

We look at the second and third (left-most) bits of


Which of the six options are used for the code.
datagram control and which are used for No operation: Code is 00000001; control.
debugging and management? End of option: Code is 00000000; control.
Record route: Code is 00000111; control.
Strict source route: Code is 10001001; control.
Loose source route: Code is 10000011; control.
Timestamp: Code is 01000100; debugging

11
Checksum
• Error detection mechanism
• Protects against packet corruption during
8.4 transmission
• Used by most TCP/IP Protocols
CHECKSUM • Checksum calculated at sender; sent with packet
• Receiver repeats the same calculation

Checksum concept

To create the checksum the sender does


the following:
1. The packet is divided into k sections,
each of n bits.
2. All sections are added together using
one’s complement arithmetic.
3. The final result is complemented
to make the checksum.

Example of
Checksum in one’s complement arithmetic checksum
calculation
in binary

12
Example of
checksum Checksum on Header
calculation • Only applied to IP header
in • Higher-level protocols have own error detection
hexadecimal
• Checksum recomputed at each router
• Faster to only compute checksum on the
(smaller) header data

8.5
Check Appendix C for a detailed
description of checksum calculation
IP PACKAGE
and the handling of carries.

IP Reassembly table
components

13

You might also like