You are on page 1of 74

Chapter 18

Introduction to Network Layer


Communication at the network layer

18.2
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.

- Similar to the service of a carrier such as the


postal office

18.3
Routing and Forwarding

Other duties of the network layer are


- routing
- forwarding

18.4
Forwarding process

Forwarding Send the packet


value out of interface 2
B Data B Data

18.5
PACKET SWITCHING

A router is a switch that creates a connection between


an input port and an output port (or a set of output
ports

18.6
Datagram Approach
- 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.
- 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.

18.7
A connectionless packet-switched
network

18.8
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.9
A virtual-circuit packet-switched
network

18.10
Forwarding process in a router when used in a virtual
circuit network

18.11
Sending request packet in a virtual-circuit
network

A to B

A to B

A to B A to B

18.12
Sending acknowledgments in a virtual-circuit
network

18.13
Flow of one packet in an established virtual
circuit

18.14
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.

- 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.15
Three different notations in IPv4 addressing

18.18
Hierarchy in addressing

18.19
Classful Addressing

- The whole address space was divided into


five classes (class A, B, C, D, and E)

- This scheme is referred to as classful addressing.

18.22
What is Classless Addressing?

• The classless IPv4 addressing does not divide the


address space into classes like classful addressing.

• It provides a variable-length of blocks, which


have a range of addresses according to the need of
users.
Reasons for Adopting Classes Addressing

Reason 1:
• As classful addressing failed in providing the fair share of
addresses to each organization there was a need to bring
change in the distribution process of addresses.
• As we know the classful addressing assigns a block from
class A, B & C to an organization which has a fixed
number of addresses.
• In classful addressing sometimes the addresses in a block
were more than enough and sometimes the addresses in the
block were less than required.
• Subnetting and supernetting in classful addressing also
failed to solve the problem of address depletion.
Reasons for Adopting Classes Addressing
Reason 2:
• As we all know in 1990 ‘Internet Service Provider’ (ISP) an organization
that became famous for providing internet access to midsize organizations,
small commercial companies or even to an individual that require internet
services such as e-mail services, surfing to extract information about
something and many more.
• Internet Corporation for Assigned Names and Numbers (ICANN) a global
authority that assigns a large block of addresses to ISP which it further
subdivides to provide a required range of addresses to small commercial
organizations.
• So, in 1996 a new architecture was introduced for the distribution of
addresses namely ‘Classless Addressing’.
• The classless addressing provides the block of addresses of variable length.
One can request for a block having 1 address, 2 addresses, 4 addresses, 8
addresses and so on. It means that the number of addresses that a customer
can request should be the power of 2.
• The classless addressing prevents the wastage of addresses.
Example 19.9 (continued)

Solution
a. The first address can be found by ANDing the given
addresses with the mask. ANDing here is done bit by
bit. The result of ANDing 2 bits is 1 if both bits are 1s;
the result is 0 otherwise.

19.42
Example 19.9 (continued)

b. The last address can be found by ORing


thegiven addresses with the
complement of themask. ORing here is done bit by bit.
The result of ORing 2 bits is 0 if both bits
are 0s; the result is 1 otherwise.
The complement of a number is found by changing
each 1
to 0 and each 0 to 1.

19.43
Example 19.9 (continued)

c. The number of addresses can be found by


complementing the mask, interpreting it as a decimal
number, and adding 1 to it.

19.44
Block Allocation

• The ultimate responsibility of block allocation is given


to a global authority called the ICANN (Internet
Corporation for Assigned Names and Numbers).
• ICANN does not normally allocate addresses to
individual internet users .
• It assigns a large block to an ISP.
Restrictions applied to the allotted blocks
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.49
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.29
Example 18.5
(continued)
c. The number of addresses in the smallest subblock, which
requires 10 addresses, is not a power of 2. We allocate 16
addresses. The subnet mask for this subnet can be found as
n1 = 32 − log216= 28. The first address in this block is
14.24.74.192/28; the last address is 14.24.74.207/28.

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.

18.51
Solution to Example 4.5

18.52
Network address

18.53
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.54
Figure 18.24: Example of address aggregation

18.55
DHCP

After a block of addresses are assigned to an


organization, network administration can
the
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.56
Operation of DHCP

18.57
NA
T
- A technology that can provide the mapping
between the private and universal addresses, and
at the same time support virtual private networks

- allows a site to use a set of private addresses for


internal communication and a set global
Internet addresses (at of for
least
communication one)
with the rest of the world.

18.58
NA
T

18.59
Address translation

18.60
Translation

18.61
Five-column translation table

18.62
NETWORK-LAYER PROTOCOLS

- IPv4 is responsible for packetizing, forwarding,


and delivery of a packet.

- ICMPv4 helps IPv4 to handle some errors that


may occur in delivery.

- IGMP is used to help IPv4 in multicasting.

- ARP is used in address mapping.

19.63
Position of IP and other network-layer protocols
in TCP/IP protocol suite

19.64
Datagram Format

A datagram is a variable-length packet consisting of


two parts:

- Header
- payload (data)

The header is 20 to 60 bytes in length and


contains information essential to routing and
delivery.

19.65
IP datagram

19.66
Multiplexing and demultiplexing using the value of
the protocol field

19.67
Example
19.1

An IPv4 packet has arrived with the first 8 bits as


(01000010)2 The receiver discards the packet. Why?.

Solution
There is an error in this packet. The 4 leftmost bits (0100)2
show the version, which is correct. The next 4 bits (0010)2
show an invalid header length (2 × 4 = 8). The minimum
number of bytes in the header must be 20. The packet has
been corrupted in transmission.

19.68
Example
19.2

In an IPv4 packet, the value of HLEN is (1000)2. 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 base header, the next 12 bytes are the options.

19.69
19.70
Fragmentation

The format and size of the sent frame depend on the


protocol used by the physical network through
which the frame is going to travel. For example, if a
router connects a LAN to a WAN, it receives a frame
in the LAN format and sends a frame in the WAN
format.

19.71
Maximum transfer unit (MTU)

19.72
Fragmentation example

19.73
Detailed fragmentation example

19.74

You might also like