Академический Документы
Профессиональный Документы
Культура Документы
Topic 3
Internet Protocol
(IP)
TCP/IP Protocol Suite 2
ICMP IGMP
• ICMP is an adjunct to IP. It is used by the IP • IGMP is the Internet Group Management
layer to exchange error messages and other Protocol. It is used with multicasting: sending
vital information with the IP layer in another a UDP datagram to multiple hosts.
host or router.
ARP & RARP Encapsulation
• ARP (Address Resolution Protocol) and RARP • When an application sends data using TCP,
(Reverse Address Resolution Protocol) are the data is sent down the protocol stack,
specialized protocols used only with certain through each layer, until it is sent as a stream
types of network interfaces (such as Ethernet of bits across the network.
and token ring) to convert between the • Each layer adds information to the data by
addresses used by the IP layer and the prepending headers (and sometimes adding
addresses used by the network interface. trailer information) to the data that it
receives.
Encapsulation of data as it goes down the protocol stack TCP/IP hierarchy - Encapsulation
- each layer adds header to the data unit. Trailer only
at Ethernet frame. -unit of data UDP
sends to IP = UDP
datagram
or
Structure of IP datagram
Version
Structure of IP datagram
Header Length (HLEN)
Defines the total length of the IP datagram
in bytes words.
When no option, the HLE) is 20 bytes. So, Service type
Structure of IP datagram
New format
X
bits Service type
Codepoint = 6 bits
Value
Unused
from 0 - = 2 bits
7
Structure of IP datagram
Total length
Defines the total length (header + data) of IP
datagram in bytes.
Service type
Header length = HLE value x 4
Length of data = Total length – Header length
It is 16 bits, so the maximum size of IP
datagram = 216 -1 = 65535 bytes.
Structure of IP datagram
Flags
Used in fragmentation.
Have 3 bits:
if 0 = may be fragment
Structure of IP datagram
Time to live
Structure of IP datagram
Header checksum
Service type
-will be discussed later-
Structure of IP datagram
Source IP Address
Service type
Service type
EXAMPLE 1 EXAMPLE 2
An IP packet has arrived with the first 8 bits as shown: In an IP packet, the value of HLE) is 1000 in binary. How many
bytes of options are being carried by this packet?
01000010
EXAMPLE 3 EXAMPLE 4
In an IP packet, the value of HLE) is 516 An IP packet has arrived with the first few hexadecimal digits as
and the value of the total length field is 002816 . How shown below:
many bytes of data are being carried by this packet?
45000028000100000102 . . .
Solution How many hops can this packet travel before being dropped?
The HLE) value is 5, which means the total number of bytes in The data belong to what upper layer protocol?
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 Solution
− 20). To find the time-to-live field, we 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.
TCP/IP Protocol Suite 41 TCP/IP Protocol Suite 42
3.2 FRAGMENTATION MTU
The format and size of a frame depend on the
Maximum Transmission Unit (MTU) is the
protocol used by the physical network. A
characteristic of the link layer protocols.
datagram may have to be fragmented to fit the
Each data link layer protocol has own frame
protocol regulations.
format.
The topics discussed in this section include: It is different according to different physical
Maximum Transfer Unit (MTU) network protocols.
Fields Related to Fragmentation The designers of TCP/IP decided to make the max
length of IP datagram = 65535 bytes.
TCP/IP Protocol Suite 43 TCP/IP Protocol Suite 44
MTU
Fragmentation Fragmentation
Flags field
Second fragmentation:
-Identification = 14,567.
-Flags = M = 1 = this is not the last
fragments.
TCP/IP Protocol Suite 53 TCP/IP Protocol Suite 54 M = 0 = this is the last fragment.
-Frag. Offset = 175, 275
Example 2
Example 2
Answer: Fragmentation in Network 1 -Total length
F 1.1 = 660 bytes
Question: Host 1 was communicating with Host 2 -Data = 640
bytes
sending 1400 bytes of data. Show all the -Identification
= 1956
fragmentation processes happen in Network 1 and MTU = 660 -M = 1 = this
is not the last
the fragmentation processes happen to the 0 1479
0 F 1.2 639
fragment.
-Total length = -Total length = 660 bytes
second fragments when entering Network 2 via 1500 bytes - Data = 640 bytes
-Frag. Offset =
0/8=0
router (R). -- Data = 1480
bytes
- Identification = 1956
- M = 1 = this is not the
- Identification last fragment.
= 1956 -Frag. Offset = 640/8 = 80 640 1279
F 1.3
- M = 1 = this is
not the last -Total length = 220 bytes
fragment -Data = 200 bytes
-Offset = 0/8=0 -Identification = 1956
- M = 0 = this is the last
fragment
-Frag. Offset = 1280/8 = 160 1280 1479
Example 2
Answer: Fragmentation in Network 2
(From Net. 1)
-Total length
= 300 bytes
How to reassemble?
F 1.2
-Data = 280
bytes
-Identification
= 1956
The reassemble processes happen based on
640 1279
-M = 1 = this
is not the last
fragment offset:
-Total length -Total length = 300 fragment.
640 919 -Frag. Offset =
= 660 bytes bytes
- Data = 640 - Data = 280 bytes 640/8 = 80 The first fragment has offset = 0
bytes - Identification = -Total length =
- 1956 100 bytes
Identification - M = 1 = this is not -Data = 80
The second fragment has offset = length of first fragment/8
= 1956 the last fragment.
920 1199 bytes
= 1400/8 = 175
- M = 1 = this -Frag. Offset = 920/8 -Identification
is not the = 115 = 1956
last - M = 0 = this The third fragment has offset = total length of first
fragment. is the last
-Frag. Offset fragment fragment and second fragment/8 = 350
= 640/8 = 80 -Frag. Offset =
1200 1279 1200/8 = 150 TCP/IP Protocol Suite 58
EXAMPLE 5 EXAMPLE 6
A packet has arrived with an M bit value of 0. Is this the first A packet has arrived with an M bit value of 1. Is this the first
fragment, the last fragment, or a middle fragment? fragment, the last fragment, or a middle fragment?
Do we know if the packet was fragmented? Do we know if the packet was fragmented?
Solution
Solution If the M bit is 1, it means that there is at least one more
If the M bit is 0, it means that there are no more fragments; the fragment. This fragment can be the first one or a middle one, but
fragment is the last one. 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
However, we cannot say if the original packet was fragmented or offset).
not. A nonfragmented packet is considered the last fragment.
A packet has arrived with an M bit value of 1 and a A packet has arrived in which the offset value is 100. What is the
fragmentation offset value of zero. Is this the first fragment, the number of the first byte? Do we know the number of the last
last fragment, or a middle fragment?. byte?
Solution Solution
Because the M bit is 1, it is either the first fragment or a middle To find the number of the first byte, we multiply the offset value
one. But, because the offset value is 0, it is the first fragment. 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
The first byte number is 100 × 8 = 800. The total length is 100 The topics discussed in this section include:
bytes and the header length is 20 bytes (5 × 4), which means that Format
Option Types
there are 80 bytes in this datagram. If the first byte number is
800, the last byte number must be 879.
Structure of IP datagram
OPTIONS
Service type
- Only 40 bytes long (max), left for Option.
Only 6
options
used
from 32
Length
-8 bits long.
-Defines the total length of the option including the type
field and the length field itself.
Value
-Is a variable-length long.
-Contains the data that specific option require.
-An optional field.
Only 6
options
used
from 32
EXAMPLE 10 EXAMPLE 11
Which of the six options must be copied to each fragment? Which of the six options are used for datagram control and
which are used for debugging and management?
Solution
We look at the first (left-most) bit of the code for each option. Solution
We look at the second and third (left-most) bits of the code.
a. )o operation: Code is 00000001; not copied.
b. End of option: Code is 00000000; not copied. a. )o operation: Code is 00000001; datagram control.
c. Record route: Code is 00000111; not copied. b. End of option: Code is 00000000; datagram control.
d. Strict source route: Code is 10001001; copied. c. Record route: Code is 00000111; datagram control.
e. Loose source route: Code is 10000011; copied. d. Strict source route: Code is 10001001; datagram control.
f. Timestamp: Code is 01000100; not copied. e. Loose source route: Code is 10000011; datagram control.
f. Time stamp: Code is 01000100; debugging and management
control.
EXAMPLE 12 EXAMPLE 13
One of the utilities available in U)IX to check the travelling of We can also use the ping utility with the -R option to implement
the IP packets is ping. In the next chapter, we talk about the ping the record route option.
program in more detail. In this example, we want to show how to
$ ping -R fhda.edu
use the program to see if a host is available. We ping a server at PI)G fhda.edu (153.18.8.1) 56(124) bytes of data.
De Anza College named fhda.edu. The result shows that the IP 64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=0 ttl=62 time=2.70 ms
address of the host is 153.18.8.1. RR: voyager.deanza.fhda.edu (153.18.17.11)
Dcore_G0_3-69.fhda.edu (153.18.251.3)
$ ping fhda.edu Dbackup_V13.fhda.edu (153.18.191.249) tiptoe.fhda.edu (153.18.8.1)
PI)G fhda.edu (153.18.8.1) 56(84) bytes of data. Dbackup_V62.fhda.edu (153.18.251.34)
64 bytes from tiptoe.fhda.edu (153.18.8.1): .... Dcore_G0_1-6.fhda.edu (153.18.31.254)
voyager.deanza.fhda.edu (153.18.17.11)
The result shows the IP address of the host and the number of The result shows the interfaces and IP addresses.
bytes used.
The traceroute program can also be used to implement strict The traceroute program can be used to implement loose source
source routing. The -G option forces the packet to visit the routing. The -g option allows us to define the routers to be
routers defined in the command line. The following shows how visited, from the source to destination. The following shows how
we can send a packet to the fhda.edu server and force the packet we can send a packet to the fhda.edu server with the requirement
to visit only the router 153.18.251.4, not any other one. that the packet visit the router 153.18.251.4.
3.4 CHECKSUM
Checksum
The error detection method used by most TCP/IP protocols is called
called the
checksum. The checksum protects against the corruption that may occur
during the transmission of a packet. It is redundant information added to The header checksum is calculated over the IP
the packet.
header only.
It does not cover any data that follows the header.
The topics discussed in this section include:
Checksum Calculation at the Sender
Checksum Calculation at the Receiver
ICMP, IGMP, UDP, and TCP all have a checksum in
Checksum in the IP Packet their own headers to cover their header and data.
Header Checksum
Checksum
Checksum concept
Other example on how checksum calculation using binary Example of checksum calculation can be done in
can be shown in a diagram format: hexadecimal - shown in a diagram format