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

Module 3

Uploaded by

Shilpa Kv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views127 pages

Module 3

Uploaded by

Shilpa Kv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 127

Chapter 18

Introduction
to
Network
Layer
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 18: Outline

18.1 NETWORK-LAYER SERVICES

18.2 PACKET SWITCHING

18.4 IPv4 ADDRESSES


Chapter 18: Objective
 The first section introduces the network layer by defining the
services provided by this layer. It first discusses packetizing. It
then describes forwarding and routing and compares the two.
The section then briefly explains the other services such as
flow, error, and congestion control.

 The second section discusses packet switching, which occurs at


the network layer. The datagram approach and the virtual-
circuit approach of packet switching are described in some
detail in this section.
 The third section discusses network-layer performance. It
describes different delays that occur in network-layer
communication. It also mentions the issue of packet loss.
Finally, it discusses the issue of congestion control at the
network layer.
Chapter 18: Objective (continued)
 The fourth section discusses IPv4 addressing, probably the
most important issue in the network layer. It first describes the
address space. It then briefly discusses classful addressing,
which belongs to the past but is useful in understanding
classless addressing. The section then moves to classless
addressing and explains several issues related to this topic. It
then discusses DHCP, which can be used to dynamically assign
addresses in an organization. Finally, the section discusses
NAT, which can be used to relieve the shortage of addresses to
some extent.
 The fifth section discusses forwarding of network-layer
packets. It first shows how forwarding can be done based on
the destination address in a packet. It then discusses how
forwarding can be done using a label.
18-1 NETWORK-LAYER SERVICES

Before discussing the network layer in the


Internet today, let’s briefly discuss the network-
layer services that, in general, are expected from
a network-layer protocol. Figure 18.1 shows the
communication between Alice and Bob at the
network layer. This is the same scenario we used
in Chapters 3 and 9 to show the communication
at the physical and the data-link layers,
respectively.
18.6
Figure 18.1: Communication at the network layer

18.7
18.18.1 Packetizing

The first duty of the network layer is definitely packetizing: encapsulating


the payload in a network-layer packet at the source and decapsulating the
payload from the network-layer packet at the destination. In other words,
one duty of the network layer is to carry a payload from the source to the
destination without changing it or using it. The network layer is doing the
service of a carrier such as the postal office, which is responsible for
delivery of packages from a sender to a receiver without changing or
using the contents.

18.8
18.18.2 Routing and Forwarding

• Routing the packet from source to the destination.


• Network Layer chose the Best route among the available
routes.

• Other duties of the network layer, which are as important


as the first, are routing and forwarding, which are
directly related to each other.
18.9
Figure 18.2: Forwarding process

Forwarding Send the packet


value out of interface 2
B Data B Data

18.10
18.18.3 Other Services

Let us briefly discuss other services expected from the


network layer.

18.11
18-2 PACKET SWITCHING

From the discussion of routing and forwarding


in the previous section, we infer that a kind of
switching occurs at the network layer. A router,
in fact, is a switch that creates a connection
between an input port and an output port (or a
set of output ports), just as an electrical switch
connects the input to the output to let
electricity flow.
18.12
18.2.1 Datagram Approach

When the Internet started, to make it simple, the network layer was
designed to provide a connectionless service in which the network-layer
protocol treats each packet independently, with each packet having no
relationship to any other packet(Independent). The idea was that the
network layer is only responsible for delivery of packets from the source
to the destination. In this approach, the packets in a message may or may
not travel the same path to their destination. Figure 18.3 shows the idea..

18.13
Figure 18.3: A connectionless packet-switched network

18.14
Figure 18.4: Forwarding process in a router when used in a

connectionless network

SA DA Data SA DA Data

18.15
18.2.2 Virtual-Circuit Approach

In a connection-oriented service (also called virtual-circuit approach), there is


a relationship between all packets belonging to a message. Before all
datagrams in a message can be sent, a virtual connection should be set up to
define the path for the datagrams. After connection setup, the datagrams can
all follow the same path. In this type of service, not only must the packet
contain the source and destination addresses, it must also contain a flow label,
a virtual circuit identifier that defines the virtual path the packet should
follow.

18.16
Figure 18.5: A virtual-circuit packet-switched network
Virtual Circuit identifier

18.17
Figure 18.6: Forwarding process in a router when used in a
virtual
circuit network

Incoming Outgoing
label label

18.18
Figure 18.7: Sending request packet in a virtual-
circuit network

A to B

A to B

A to B A to B

18.19
Figure 18.8: Sending acknowledgments in a virtual-circuit
network

18.20
Figure 18.9: Flow of one packet in an established virtual
circuit

18.21
18-4 IPv4 ADDRESSES

The identifier used in the IP layer of the


TCP/IP protocol suite to identify the
connection of each device to the Internet is
called the Internet address or IP address.
An IPv4 address is a 32-bit address that
uniquely and universally defines the
connection of a host or a router to the
Internet. The IP address is the address of
the connection, not the host or the router.
18.22
18.4.1 Address Space

A protocol like IPv4 that defines addresses has an address space. An address
space is the total number of addresses used by the protocol. If a protocol uses
b bits to define an address, the address space is 2b because each bit can have
two different values (0 or 1). IPv4 uses 32-bit addresses, which means that the
address space is 232 or 4,294,967,296 (more than four billion). If there were
no restrictions, more than 4 billion devices could be connected to the Internet.

18.23
Figure 18.16: Three different notations in IPv4
addressing

18.24
Figure 18.17: Hierarchy in addressing

18.25
18.4.2 Classful Addressing

• When the Internet started, an IPv4 address was designed with a


fixed-length prefix, but to accommodate both small and large
networks, three fixed-length prefixes were designed instead of one
(n = 8, n = 16, and n = 24).
• The whole address space was divided into five classes (class A, B,
C, D, and E), as shown in Figure 18.18.
• This scheme is referred to as classful addressing.
• Although classful addressing belongs to the past, it helps us to
understand classless addressing, discussed later.
18.26
Figure 18.18: Occupation of the address space in classful
addressing

18.27
Address Depletion
Subnetting and Supernetting

Subnetting :Large IP address is divided into small blocks each block is given
to small organization.

Supernetting :
Unused IP address from each organization will be acquired and combined
into a one single block and that will be given to other organization.
Advantage of Classful Addressing

Although classful addressing had several problems,

it had one advantage:


• Given an address, we can easily find the class of the address
and, since the prefix length for each class is fixed, we can find
the prefix length immediately.
• no extra information is needed to extract the prefix and the
suffix.
18.4.3 Classless Addressing

With the growth of the Internet, it was clear that a larger address
space was needed as a long-term solution. The larger address
space, however, requires that the length of IP addresses also be
increased, which means the format of the IP packets needs to be
changed. Although the long-range solution has already been
devised and is called IPv6, a short-term solution was also planned
to use the same address space but to change the distribution of
addresses to provide a fair share to each organization. The short-
term solution still uses IPv4 addresses, but it is called classless
addressing. 18.31
Figure 18.19: Variable-length blocks in classless
addressing

18.32
Figure 18.20: Slash notation or Classless InterDomain
Routing (CIDR)

18.33
Figure 18.21: Information extraction in classless
addressing

Set all
suffix bits
to 0s

Set all
suffix bits
to 1s

18.34
Example 18.1

A classless address is given as 167.199.170.82/27. We can


find the above three pieces of information as follows. The
number of addresses in the network is 2 32− n = 25 = 32
addresses. The first address can be found by keeping the
first 27 bits and changing the rest of the bits to 0s.

The last address can be found by keeping the first 27 bits


and changing the rest of the bits to 1s.

18.35
Example 18.2

We repeat Example 18.1 using the mask. The mask in


dotted-decimal notation is 256.256.256.224 The AND, OR,
and NOT operations can be applied to individual bytes using
calculators and applets at the book website.

18.37
Example 18.3

In classless addressing, an address cannot per se define the


block the address belongs to. For example, the address
230.8.24.56 can belong to many blocks. Some of them are
shown below with the value of the prefix associated with
that block.

18.38
Figure 18.22: Network address

18.39
Example 18.4

An ISP has requested a block of 1000 addresses. Since 1000


is not a power of 2, 1024 addresses are granted. The prefix
length is calculated as n = 32 − log21024 = 22. An available
block, 18.14.12.0/22, is granted to the ISP. It can be seen
that the first address in decimal is 302,910,464, which is
divisible by 1024.

18.40
Example 18.5

An organization is granted a block of addresses with the


beginning address 14.24.74.0/24. The organization needs to
have 3 subblocks of addresses to use in its three subnets:
one subblock of 10 addresses, one subblock of 60 addresses,
and one subblock of 120 addresses. Design the subblocks.

Solution
There are 232– 24 = 256 addresses in this block. The first
address is 14.24.74.0/24; the last address is 14.24.74.255/24.
To satisfy the third requirement, we assign addresses to
subblocks, starting with the largest and ending with the
smallest one.

18.41
Example 18.5 (continued)

a. The number of addresses in the largest subblock, which


requires 120 addresses, is not a power of 2. We allocate 128
addresses. The subnet mask for this subnet can be found as
n1 = 32 − log2 128 = 25. The first address in this block is
14.24.74.0/25; the last address is 14.24.74.127/25.

b. The number of addresses in the second largest subblock,


which requires 60 addresses, is not a power of 2 either. We
allocate 64 addresses. The subnet mask for this subnet can
be found as n2 = 32 − log2 64 = 26. The first address in this
block is 14.24.74.128/26; the last address is
14.24.74.191/26.

18.42
Example 18.5 (continued)

c. The number of addresses in the largest subblock, which


requires 120 addresses, is not a power of 2. We allocate 128
addresses. The subnet mask for this subnet can be found as
n1 = 32 − log2 128 = 25. The first address in this block is
14.24.74.0/25; the last address is 14.24.74.127/25.

If we add all addresses in the previous subblocks, the result


is 208 addresses, which means 48 addresses are left in
reserve. The first address in this range is 14.24.74.208. The
last address is 14.24.74.255. We don’t know about the prefix
length yet. Figure 18.23 shows the configuration of blocks.
We have shown the first address in each block.

18.43
Figure 18.23: Solution to Example 4.5

18.44
Example 18.6

Figure 18.24 shows how four small blocks of addresses are


assigned to four organizations by an ISP. The ISP combines
these four blocks into one single block and advertises the
larger block to the rest of the world. Any packet destined for
this larger block should be sent to this ISP. It is the
responsibility of the ISP to forward the packet to the
appropriate organization. This is similar to routing we can
find in a postal network. All packages coming from outside
a country are sent first to the capital and then distributed to
the corresponding destination.

18.45
Figure 18.24: Example of address aggregation

18.46
18.4.4 DHCP

After a block of addresses are assigned to an


organization, the network administration can
manually assign addresses to the individual hosts or
routers. However, address assignment in an
organization can be done automatically using the
Dynamic Host Configuration Protocol (DHCP).
DHCP is an application-layer program, using the
client-server paradigm, that actually helps TCP/IP at
the network layer.

18.47
Figure 18.25: DHCP message format

18.48
Figure 18.26: Option format

18.49
Figure 18.27: Operation of DHCP

18.50
Figure 18.28: FSM for the DHCP client

18.51
18.4.5 NAT

In most situations, only a portion of computers in a


small network need access to the Internet
simultaneously. A technology that can provide the
mapping between the private and universal
addresses, and at the same time support virtual
private networks, which we discuss in Chapter 32, is
Network Address Translation (NAT). The technology
allows a site to use a set of private addresses for
internal communication and a set of global Internet
addresses (at least one) for communication with the
rest of the world.
18.52
Figure 18.29: NAT

18.53
Figure 18.30: Address translation

18.54
Figure 18.31: Translation

18.55
Table 18.1: Five-column translation table

18.56
Chapter 22

Next
Generation
IP

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 22: Outline

22.2 THE IPv6 PROTOCOL


Chapter 22: Objective

 The first section discusses the addressing mechanism in the


new generation of the Internet. The section first describes the
representation and address space. It then shows the allocation
in the address space. The section finally explains auto-
configuration and renumbering, which makes it easy for a host
to move from one network to another.

 The second section discusses IPv6 protocol. First the new


packet format is described. The section then shows how use of
extension headers can replace the options.
Chapter 22: Objective (continued)

 The third section discusses ICMPv6. The section describes how


the new protocol replaces several auxiliary protocols in version
4. The section also divides the messages in this protocol into
four categories and describes them.

 The fourth section briefly shows how transition can be made


from the current version to the new one smoothly. The section
explains three strategies that need to be followed for this
smooth transition.
22.22.5 Renumbering

To allow sites to change the service provider,


renumbering of the address prefix (n) was built into
IPv6 addressing. As we discussed before, each site is
given a prefix by the service provider to which it is
connected. If the site changes the provider, the
address prefix needs to be changed. A router to
which the site is connected can advertise a new
prefix and let the site use the old prefix for a short
time before disabling it. In other words, during the
transition period, a site has two prefixes.

22.61
22-2 THE IPv6 PROTOCOL

The change of the IPv6 address


size requires the change in the
IPv4 packet format. The designer
of IPv6 decided to implement
remedies for other shortcomings
now that a change is inevitable.
The following shows other changes
implemented in the protocol in
addition to changing address size
and format.
22.62
22.2.1 Packet Format

The IPv6 packet is shown in Figure 22.6. Each


packet is composed of a base header followed by the
payload. The base header occupies 40 bytes, whereas
payload can be up to 65,535 bytes of information.
The description of fields follows.

22.63
Figure 22.6: IPv6 datagram

22.64
Figure 22.7: Payload in an IPv6 datagram

22.65
22.2.2 Extension Header

An IPv6 packet is made of a base header and some


extension headers. The length of the base header is
fixed at 40 bytes. However, to give more
functionality to the IP datagram, the base header
can be followed by up to six extension headers.
Many of these headers are options in IPv4. Six types
of extension headers have been defined. These are
hop-by-hop option, source routing, fragmentation,
authentication, encrypted security payload, and
destination option (see Figure 22.8).

22.66
Figure 22.8: Extension Header Types

22.67

You might also like