0% found this document useful (0 votes)
70 views27 pages

Chapter 20-21 PDF

1) The document discusses the network layer in internetworks and the Internet Protocol version 4 (IPv4) which is the delivery mechanism used in TCP/IP protocols. 2) It explains that switching in the Internet uses a datagram approach to packet switching and communication is connectionless. 3) The format of the IPv4 datagram is shown, which includes fields for version, header length, services, total length, identification, flags, fragment offset, TTL, protocol, header checksum, source/destination IP addresses, and options.

Uploaded by

chenna473
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)
70 views27 pages

Chapter 20-21 PDF

1) The document discusses the network layer in internetworks and the Internet Protocol version 4 (IPv4) which is the delivery mechanism used in TCP/IP protocols. 2) It explains that switching in the Internet uses a datagram approach to packet switching and communication is connectionless. 3) The format of the IPv4 datagram is shown, which includes fields for version, header length, services, total length, identification, flags, fragment offset, TTL, protocol, header checksum, source/destination IP addresses, and options.

Uploaded by

chenna473
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/ 27

1/11/2010

Chapter 20
N
NetworkkLLayer
IP and Address Mapping

Dr Mznah Al
Dr. Al-Rodhaan
Rodhaan

Network layer in an internetwork

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
20.2

1
1/11/2010

Taxonomy of switched networks

Connectionless Connection-oriented

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

A datagram network with four switches (routers)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

2
1/11/2010

Switching in the Internet

Switching at the network layer in the Internet uses


the datagram approach to packet switching.

Communication at the network layer in


the Internet is connectionless.

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

IPv4
The Internet Protocol version 4 (IPv
IPv44) is the delivery
mechanism used by the TCP/IP protocols
protocols..

Topics discussed in this section:


Datagram
Fragmentation
Checksum
Options

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
20.6

3
1/11/2010

Position of IPv4 in TCP/IP protocol suite

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
20.7

IPv4 datagram format

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
20.8

4
1/11/2010

IP Packet Format
0 4 8 16 19 31

Version HLEN Service Length

Identification Flags Fragment Offset

TTL Protocol IP Header Checksum

Source IP Address

Destination IP Address

Options (variable) Pad (variable)

Data

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Current IP Protocol Version is 4, called IPv4

0 4 8 16 19 31

Version HLEN Services Length

Identification Flags Fragment Offset

TTL Protocol IP Header Checksum

Source IP Address

Destination IP Address

Options (variable)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

5
1/11/2010

Length of IP Header in number of 4 bytes words including options.


Maximum header size is 60 bytes. Header length = HLEN*4

0 4 8 16 19 31

Version HLEN Services Length

Identification Flags Fragment Offset

TTL Protocol IP Header Checksum

Source IP Address

Destination IP Address

Options (variable)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

The service field is composed of a 3-bit precedence


field. (Which are largely ignored in current routers). 4
services bits and an unused bit that must be zero.

0 4 8 16 19 31

Version HLEN Services Length

Identification Flags Fragment Offset

TTL Protocol IP Header Checksum

Source IP Address

Destination IP Address

Options (variable)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

6
1/11/2010

Total length of IP datagram in bytes. It is a 16 bit field. Largest size of an IP datagram is 65635
bytes. Maximum header size is 60 bytes. Link layer MTU may restrict this size further.

0 4 8 16 19 31

Version HLEN Services Length

Identification Flags Fragment Offset

TTL Protocol IP Header Checksum

Source IP Address

Destination IP Address

Options (variable)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Identification field uniquely identifies each datagram sent by a host. It is normally incremented
by one each time a host sends a datagram. Very useful for fragmentation and reassembly.

0 4 8 16 19 31

Version HLen Services Length

Identification Flags Fragment Offset

TTL Protocol IP Header Checksum

Source IP Address

Destination IP Address

Options (variable)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

7
1/11/2010

flags field also used for fragmentation and reassembly.

0 4 8 16 19 31

Version HLen Services Length

Identification Flags Fragment Offset

TTL Protocol IP Header Checksum

Source IP Address

Destination IP Address

Options (variable)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Fragmentation offset used for fragmentation and reassembly. It


shows the position of this fragment with respect to the whole
datagram.

0 4 8 16 19 31

Version HLen Services Length

Identification Flags Fragment Offset

TTL Protocol IP Header Checksum

Source IP Address

Destination IP Address

Options (variable)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

8
1/11/2010

Time-to-live (TTL ) field sets an upper limit on how man routers a datagram can go through.
Every router decrements TTL by 1 before sending it forward. If TTL reaches 0 the datagram is
dropped and an ICMP message is sent to the host application.

0 4 8 16 19 31

Version HLen Services Length

Identification Flags Fragment Offset

TTL Protocol IP Header Checksum

Source IP Address

Destination IP Address

Options (variable)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Identifies the protocol that sent the datagram. The protocol (today) can be ICMP,
IGMP, TCP, UDP

0 4 8 16 19 31

Version HLen Services Length

Identification Flags Fragment Offset

TTL Protocol IP Header Checksum

Source IP Address

Destination IP Address

Options (variable)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

9
1/11/2010

The header checksum is calculated over the IP header only. TCP, UDP etc
protect their own data and header by a checksum.

0 4 8 16 19 31

Version HLEN Services Length

Identification Flags Fragment Offset

TTL Protocol IP Header Checksum

Source IP Address

Destination IP Address

Options (variable)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Example 20.1
An IPv4 packet has arrived with the first 8 bits as shown:
01000010
The receiver discards the packet.
packet Why?

Solution
(0100) show the version9.
The next 4 bits (0010) show header length (2 × 4 = 8bytes).
Th minimum
The i i number
b off bytes
b in
i the
h header
h d must be b 20.
20
The packet has been corrupted in transmission.

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

10
1/11/2010

Example 20.2
In an IPv4 packet, the value of HLEN is 1000 in binary.
How many bytes of options are being carried by this
packet?

Solution
The HLEN value is 8, which means the total number of
bytes in the header is 8 × 4, or 32 bytes. The first 20 bytes
are the
h base
b h d the
header, h next 12 bytes
b are the
h options.
i

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Example 20.3

In an IPv4 packet, the value of HLEN is 5, and the value


of the total length field is 0x0028. How many bytes of
data are being carried by this packet?

Solution
The HLEN value is 5, which means the total number of
bytes in the header is 5 × 4, or 20 bytes (no options). The
totall length
l h is
i 40 bytes,
b which
hi h means the h packet
k is i
carrying 20 bytes of data (40 − 20).

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
20.22

11
1/11/2010

Example 20.4

An IPv4 packet has arrived with the first few hexadecimal


digits as shown.
0x45000028000100000102 . . .
How many hops can this packet travel before being
dropped? The data belong to what upper-layer protocol?

Solution
To find the time-to-live field, we skip 8 bytes. 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).

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
20.23

Fragmentation

Maximum transfer unit (MTU)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
20.24

12
1/11/2010

Fragmentation example

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
20.25

Detailed fragmentation example

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
20.26

13
1/11/2010

Reading from the text book

‰ Ch t 20 from
Chapter f 4th edition
diti (section
( 20.1 until the end off
page 594 except service Type and differentiated services )

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Chapter 21
Network Layer
Address Mapping

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

14
1/11/2010

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
20.29

Address Mapping

„ The delivery of a packet to a host or a router


requires
i ttwo levels
l l off addressing:
dd i l i l and
logical d
physical. We need to be able to map a
physical
logical address to its corresponding physical
address and vice versa. This can be done by
using either static or dynamic mapping.

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

15
1/11/2010

ARP and RARP

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

ARP - The Address Resolution Protocol


„ An IP datagram must be encapsulated in a frame to
pass through the physical network. This requires the
physical address of the receiver
receiver.
„ ARP associates an IP address with its physical
address.
„ When the physical address of another host is
required an ARP query packet is sent which includes
‰ IP address of sender
‰ IP address of the receiver
„ The intended recipient recognises its IP address and
send back an ARP response which contains the
physical address.
Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

16
1/11/2010

ARP operation

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

ARP packet

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
21.34

17
1/11/2010

Encapsulation of ARP packet

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
21.35

Four cases using ARP

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
21.36

18
1/11/2010

ARP Request & Reply

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Proxy ARP

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

19
1/11/2010

ARP functions
„ Sender knows IP address
„ IP asks ARP to create an ARP request message
‰ sender physical address
‰ sender IP address
‰ target IP address
‰ target physical address filled with 0's
„ Message passed to data link layer; destination address =
broadcast address
„ All hosts receive frame; only target host accepts the packet
„ Target host replies (unicast) with an ARP reply message
containing the physical address
„ Sender receives reply; it now knows the physical address of the
target host
„ IP datagram's are now unicast to the destination host

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Cache Table
„ A sender usually has more than one IP
datagram to send to the same destination
„ It is inefficient to use ARP for each
datagram
„ A cache table is used
‰ limited size
‰ mappings retained only for a limited time

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

20
1/11/2010

RARP

„ Finds the logical address for a host that only


knows its physical address
„ RARP request packets are broadcast; RARP
reply packets are unicast
„ Used by diskless machines to obtain their IP
addresses
„ DHCP is used now.
Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Operation

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

21
1/11/2010

DHCP provides static and dynamic


address allocation that can be
manual or automatic.

A requestt iis b
broadcast;
d t
a reply is unicast.

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

21--2 ICMP
21

The IP protocol has no error error--reporting or error


error--
correctingg mechanism
mechanism.. The IP protocol
p also lacks a
mechanism for host and management queries. queries. The
Internet Control Message Protocol (ICMP) has been
designed to compensate for the above two deficiencies
deficiencies..
It is a companion to the IP protocol
protocol..
Topics discussed in this section:
Types of Messages
Message Format
Error Reporting

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
21.44

22
1/11/2010

ICMP protocol
„ IP protocol is a best-effort delivery service, however it has
two deficiencies
‰ Lack of error control

‰ Lack of assistance mechanisms

„ IP protocol has no error-reporting or error-correction


mechanism
‰ What happens when something goes wrong?

‰ What happens if a router must discard a datagram because it


cannot find a route to the final destination?
‰ What if the time-to-live field has a zero value?

‰ What if it has to discard all fragments because not all were


received in a predetermined time limit?
„ IP protocol also lacks a mechanism for host and
management queries.
„ ICMP was designed to compensate for these deficiencies.
Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Internet Control Message Protocol (ICMP)


„ Encapsulated in IP packet
„ Handles error and control messages
„ If router cannot deliver or forward a packet,
packet it sends an
ICMP “host unreachable” message to the source
„ If router receives packet that should have been sent to
another router, it sends an ICMP “redirect” message to
the sender; Sender modifies its routing table
„ ICMP “router discovery” messages allow host to learn
about routers in its network and to initialize and update
its routing tables

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

23
1/11/2010

ICMP always reports error messages to


the original source.

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Error-reporting messages

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
21.48

24
1/11/2010

Internet Control Message Protocol (ICMP)


ICMP is used by routers for exchanging error
information and for testing. The principal ICMP
message types are shown below
below.

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Important points about ICMP error messages:


❏ No ICMP error message will be generated in
response to a datagram carrying
carr ing an ICMP error
message.
❏ No ICMP error message will be generated for a
fragmented datagram that is not the first fragment.
❏ No ICMP error message will be generated for a
datagram having a multicast address.
❏ No ICMP error message will be generated for a
datagram having a special address such as
127.0.0.0 or 0.0.0.0.

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
21.50

25
1/11/2010

Contents of data field for the error messages

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
21.51

Redirection concept

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
21.52

26
1/11/2010

Reading from the text book

‰ Ch t 21 from
Chapter f 4th edition
diti (section
( 21.1 until the first
f
paragraph of page 625 except BOOTP page 619)

Based on
th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

27

You might also like