Ch-07 (IPv4) Part-1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

Chapter 7

Internet Protocol Version4


(IPv4)
OBJECTIVES:
‰ To explain the general idea behind the IP protocol and the position of IP in
TCP/IP protocol suite.
‰ To show the general format of an IPv4 datagram.
‰ To discuss fragmentation and reassembly of datagrams.
‰ To discuss several options that can be in an IPv4 datagram and their
applications.
‰ To show how a checksum is calculated for the header of an IPv4 datagram
at the sending site and how the checksum is checked at the receiver site.
‰ To discuss IP over ATM and compare it with IP over LANs and/or point-to-
point WANs.
‰ To show a simplified version of the IP package and give the pseudocode for
some modules.
7-1 INTRODUCTION

㼀㼔㼑 㻵㼚㼠㼑㼞㼚㼑㼠 㻼㼞㼛㼠㼛㼏㼛㼘 㻔㻵㻼㻕 㼕㼟 㼠㼔㼑 㼠㼞㼍㼚㼟㼙㼕㼟㼟㼕㼛㼚


㼙㼑㼏㼔㼍㼚㼕㼟㼙 㼡㼟㼑㼐 㼎㼥 㼠㼔㼑 㼀㻯㻼㻛㻵㻼 㼜㼞㼛㼠㼛㼏㼛㼘㼟 㼍㼠 㼠㼔㼑
㼚㼑㼠㼣㼛㼞㼗 㼘㼍㼥㼑㼞㻚
Figure 7.1 Position of IP in TCP/IP protocol suite
7-2 DATAGRAMS

• 㻼㼍㼏㼗㼑㼠㼟 㼕㼚 㼠㼔㼑 㼚㼑㼠㼣㼛㼞㼗 㻔㼕㼚㼠㼑㼞㼚㼑㼠㻕 㼘㼍㼥㼑㼞 㼍㼞㼑 㼏㼍㼘㼘㼑㼐 㼐㼍㼠㼍㼓㼞㼍㼙㼟㻚

• 㻭 㼐㼍㼠㼍㼓㼞㼍㼙 㼕㼟 㼍 㼢㼍㼞㼕㼍㼎㼘㼑㻙㼘㼑㼚㼓㼠㼔 㼜㼍㼏㼗㼑㼠 㼏㼛㼚㼟㼕㼟㼠㼕㼚㼓 㼛㼒 㼠㼣㼛


㼜㼍㼞㼠㼟㻦 㼔㼑㼍㼐㼑㼞 㼍㼚㼐 㼐㼍㼠㼍㻚 㼀㼔㼑 㼔㼑㼍㼐㼑㼞 㼕㼟 㻞㻜 㼠㼛 㻢㻜 㼎㼥㼠㼑㼟 㼕㼚 㼘㼑㼚㼓㼠㼔
㼍㼚㼐 㼏㼛㼚㼠㼍㼕㼚㼟 㼕㼚㼒㼛㼞㼙㼍㼠㼕㼛㼚 㼑㼟㼟㼑㼚㼠㼕㼍㼘 㼠㼛 㼞㼛㼡㼠㼕㼚㼓 㼍㼚㼐 㼐㼑㼘㼕㼢㼑㼞㼥㻚

• 㻵㼠 㼕㼟 㼏㼡㼟㼠㼛㼙㼍㼞㼥 㼕㼚 㼀㻯㻼㻛㻵㻼 㼠㼛 㼟㼔㼛㼣 㼠㼔㼑 㼔㼑㼍㼐㼑㼞 㼕㼚 㻠㻙㼎㼥㼠㼑


㼟㼑㼏㼠㼕㼛㼚㼟㻚
Figure 7.2 IP datagram
Figure 7.3 Service type

x x x 0 0 0 x x x x x 0
Precedence x x x x 1 1
interpretation
x x x x 0 1
Differential service
interpretation
Note

The total length field defines the total


length of the datagram including the
header.
Figure 7.4 Encapsulation of a small datagram in an Ethernet frame
Figure 7.5 Multiplexing
Example 7.1
㻭㼚㼚 㻵㻼 㼜㼍㼏㼗㼑㼠 㼔㼍㼟 㼍㼞㼞㼕㼢㼑㼐 㼣㼕㼠㼔 㼠㼔㼑 㼒㼕㼞㼟㼠 㻤 㼎㼕㼠㼟 㼍㼟 㼟㼔㼛㼣㼚㻦

㼀㼔㼑 㼞㼑㼏㼑㼕㼢㼑㼞 㼐㼕㼟㼏㼍㼞㼐㼟 㼠㼔㼑 㼜㼍㼏㼗㼑㼠㻚 㼃㼔㼥㻫

㻿㼛㼘㼡㼠㼕㼛㼚
㼀㼔㼑㼞㼑 㼕㼟 㼍㼚 㼑㼞㼞㼛㼞 㼕㼚 㼠㼔㼕㼟 㼜㼍㼏㼗㼑㼠㻚 㼀㼔㼑 㻠 㼘㼑㼒㼠㻙㼙㼛㼟㼠 㼎㼕㼠㼟 㻔㻜㻝㻜㻜㻕 㼟㼔㼛㼣
㼠㼔㼑 㼢㼑㼞㼟㼕㼛㼚㻘 㼣㼔㼕㼏㼔 㼕㼟 㼏㼛㼞㼞㼑㼏㼠㻚 㼀㼔㼑 㼚㼑㼤㼠 㻠 㼎㼕㼠㼟 㻔㻜㻜㻝㻜㻕 㼟㼔㼛㼣 㼠㼔㼑
㼣㼞㼛㼚㼓 㼔㼑㼍㼐㼑㼞 㼘㼑㼚㼓㼠㼔 㻔㻞 × 㻠 㻩 㻤㻕㻚 㼀㼔㼑 㼙㼕㼚㼕㼙㼡㼙 㼚㼡㼙㼎㼑㼞 㼛㼒 㼎㼥㼠㼑㼟 㼕㼚
㼠㼔㼑 㼔㼑㼍㼐㼑㼞 㼙㼡㼟㼠 㼎㼑 㻞㻜㻚 㼀㼔㼑 㼜㼍㼏㼗㼑㼠 㼔㼍㼟 㼎㼑㼑㼚 㼏㼛㼞㼞㼡㼜㼠㼑㼐 㼕㼚
㼠㼞㼍㼚㼟㼙㼕㼟㼟㼕㼛㼚㻚
7-3 FRAGMENTATION

• 㻭 㼐㼍㼠㼍㼓㼞㼍㼙 㼏㼍㼚 㼠㼞㼍㼢㼑㼘 㼠㼔㼞㼛㼡㼓㼔 㼐㼕㼒㼒㼑㼞㼑㼚㼠 㼚㼑㼠㼣㼛㼞㼗㼟㻚

• 㻱㼍㼏㼔 㼞㼛㼡㼠㼑㼞 㼐㼑㼏㼍㼜㼟㼡㼘㼍㼠㼑㼟 㼠㼔㼑 㻵㻼 㼐㼍㼠㼍㼓㼞㼍㼙 㼒㼞㼛㼙 㼠㼔㼑 㼒㼞㼍㼙㼑 㼕㼠


㼞㼑㼏㼑㼕㼢㼑㼟㻘 㼜㼞㼛㼏㼑㼟㼟㼑㼟 㼕㼠㻘 㼍㼚㼐 㼠㼔㼑㼚 㼑㼚㼏㼍㼜㼟㼡㼘㼍㼠㼑㼟 㼕㼠 㼕㼚 㼍㼚㼛㼠㼔㼑㼞 㼒㼞㼍㼙㼑㻚

• 㼀㼔㼑 㼒㼛㼞㼙㼍㼠 㼍㼚㼐 㼟㼕㼦㼑 㼛㼒 㼠㼔㼑 㼞㼑㼏㼑㼕㼢㼑㼐 㼒㼞㼍㼙㼑 㼐㼑㼜㼑㼚㼐 㼛㼚 㼠㼔㼑 㼜㼞㼛㼠㼛㼏㼛㼘
㼡㼟㼑㼐 㼎㼥 㼠㼔㼑 㼜㼔㼥㼟㼕㼏㼍㼘 㼚㼑㼠㼣㼛㼞㼗 㼠㼔㼞㼛㼡㼓㼔 㼣㼔㼕㼏㼔 㼠㼔㼑 㼒㼞㼍㼙㼑 㼔㼍㼟 㼖㼡㼟㼠
㼠㼞㼍㼢㼑㼘㼑㼐㻚

• 㼀㼔㼑 㼒㼛㼞㼙㼍㼠 㼍㼚㼐 㼟㼕㼦㼑 㼛㼒 㼠㼔㼑 㼟㼑㼚㼠 㼒㼞㼍㼙㼑 㼐㼑㼜㼑㼚㼐 㼛㼚 㼠㼔㼑 㼜㼞㼛㼠㼛㼏㼛㼘 㼡㼟㼑㼐
㼎㼥 㼠㼔㼑 㼜㼔㼥㼟㼕㼏㼍㼘 㼚㼑㼠㼣㼛㼞㼗 㼠㼔㼞㼛㼡㼓㼔 㼣㼔㼕㼏㼔 㼠㼔㼑 㼒㼞㼍㼙㼑 㼕㼟 㼓㼛㼕㼚㼓 㼠㼛 㼠㼞㼍㼢㼑㼘㻚
Figure 7.6 MTU

IP datagram

Header MTU Trailer


Maximum length of data that can be encapsulated in a frame
Frame
Note

Only data in a datagram is fragmented.


Figure 7.7 Flags field
Figure 7.8 Fragmentation example

Offset = 0000/8 = 0

0000 1399

Offset = 1400/8 = 175


1400 2799

Offset = 2800/8 = 350


2800 3999
Figure 7.9 Detailed fragmentation example

1420
14,567 1 000

Bytes 0000–1399 820


14,567 1 175
Fragment 1
4020
14,567 0 000
1420 Bytes 1400–2199
14,567 1 175
Fragment 2.1

Bytes 0000–3999
Bytes 1400–2799
Original datagram Fragment 2

1220
14,567 0 350

Bytes 2800–3999
Fragment 3
7-4 OPTIONS

• 㼀㼔㼑 㼔㼑㼍㼐㼑㼞 㼛㼒 㼠㼔㼑 㻵㻼 㼐㼍㼠㼍㼓㼞㼍㼙 㼕㼟 㼙㼍㼐㼑 㼛㼒 㼠㼣㼛 㼜㼍㼞㼠㼟㻦 㼍 㼒㼕㼤㼑㼐


㼜㼍㼞㼠 㼍㼚㼐 㼍 㼢㼍㼞㼕㼍㼎㼘㼑 㼜㼍㼞㼠㻚

• 㼀㼔㼑 㼒㼕㼤㼑㼐 㼜㼍㼞㼠 㼕㼟 㻞㻜 㼎㼥㼠㼑㼟 㼘㼛㼚㼓 㼍㼚㼐 㼣㼍㼟 㼐㼕㼟㼏㼡㼟㼟㼑㼐 㼕㼚 㼠㼔㼑


㼜㼞㼑㼢㼕㼛㼡㼟 㼟㼑㼏㼠㼕㼛㼚㻚 㼀㼔㼑 㼢㼍㼞㼕㼍㼎㼘㼑 㼜㼍㼞㼠 㼏㼛㼙㼜㼞㼕㼟㼑㼟 㼠㼔㼑 㼛㼜㼠㼕㼛㼚㼟㻘
㼣㼔㼕㼏㼔 㼏㼍㼚 㼎㼑 㼍 㼙㼍㼤㼕㼙㼡㼙 㼛㼒 㻠㻜 㼎㼥㼠㼑㼟㻚

• 㻻㼜㼠㼕㼛㼚㼟㻘 㼍㼟 㼠㼔㼑 㼚㼍㼙㼑 㼕㼙㼜㼘㼕㼑㼟㻘 㼍㼞㼑 㼚㼛㼠 㼞㼑㼝㼡㼕㼞㼑㼐 㼒㼛㼞 㼍 㼐㼍㼠㼍㼓㼞㼍㼙㻚


• 㼀㼔㼑㼥 㼏㼍㼚 㼎㼑 㼡㼟㼑㼐 㼒㼛㼞 㼚㼑㼠㼣㼛㼞㼗 㼠㼑㼟㼠㼕㼚㼓 㼍㼚㼐 㼐㼑㼎㼡㼓㼓㼕㼚㼓㻚
• 㻭㼘㼠㼔㼛㼡㼓㼔 㼛㼜㼠㼕㼛㼚㼟 㼍㼞㼑 㼚㼛㼠 㼍 㼞㼑㼝㼡㼕㼞㼑㼐 㼜㼍㼞㼠 㼛㼒 㼠㼔㼑 㻵㻼
㼔㼑㼍㼐㼑㼞㻘 㼛㼜㼠㼕㼛㼚 㼜㼞㼛㼏㼑㼟㼟㼕㼚㼓 㼕㼟 㼞㼑㼝㼡㼕㼞㼑㼐 㼛㼒 㼠㼔㼑 㻵㻼 㼟㼛㼒㼠㼣㼍㼞㼑㻚
Figure 7.10 Option format

8 bits 8 bits Variable length


Type Length Value

Number

Class 00000 End of option


00001 No operation
Copy 00 Datagram control 00011 Loose source route
01 Reserved 00100 Timestamp
0 Copy only in first fragment 10 Debugging and management 00111 Record route
1 Copy into all fragments 11 Reserved 01001 Strict source route
Figure 7.11 Categories of options
Figure 7.12 No operation option
Figure 7.13 Endo-of-option option
Figure 7.14 Record-route option
Figure 7.15 Record-route concept

7 15 4 7 15 8 7 15 12 7 15 16
140.10.6.3 140.10.6.3 140.10.6.3
200.14.7.9 200.14.7.9
138.6.22.26

67.34.30.6 138.6.25.40
67.14.10.22

138.6.22.26
200.14.7.14
140.10.6.3

140.10.5.4

67.0.0.0/24 140.10.0.0/16 200.14.7.9 200.14.7.0/24 138.6.0.0/16


Network Network Network Network
Figure 7.16 Strict-source-route option
Figure 7.17 Strict-source-route option

Source: 67.34.30.6 Source: 67.34.30.6 Source: 67.34.30.6 Source: 67.34.30.6


Destination: 67.14.10.22 Destination:140.10.5.4 Destination:200.14.7.14 Destination:138.6.25.40
137 15 4 137 15 8 137 15 12 137 15 16
140.10.5.4 67.14.10.22 67.14.10.22 67.14.10.22
200.14.7.14 200.14.7.14 140.10.5.4 140.10.5.4
138.6.25.40 138.6.25.40 138.6.25.40 200.14.7.14

67.34.30.6 138.6.25.40
67.14.10.22

138.6.22.26
200.14.7.14
140.10.6.3

140.10.5.4

200.14.7.9
67.0.0.0/24 140.10.0.0/16 200.14.7.0/24 138.6.0.0/16
Network Network Network Network
Figure 7.18 Loose-source-route option
Figure 7.19 Time-stamp option
Figure 7.20 Use of flags in timestamp
Figure 7.21 Timestamp concept

68 28 5 0 1 68 28 13 0 1 68 28 21 0 1 68 28 29 0 1
140.10.6.3 140.10.6.3 140.10.6.3
36000000 36000000 36000000
200.14.7.9 200.14.7.9
36000012 36000012
138.6.22.26
36000020

67.34.30.6
67.14.10.22

138.6.22.26
200.14.7.14
140.10.6.3

140.10.5.4

200.14.7.9
67.0.0.0/24 140.10.0.0/16 200.14.7.0/24 138.6.0.0/16
Network Network Network Network

You might also like