0% found this document useful (0 votes)
10 views56 pages

ITC3303 - Lecture 10 - Introduction To Network Layer

Uploaded by

ilearndevtech
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)
10 views56 pages

ITC3303 - Lecture 10 - Introduction To Network Layer

Uploaded by

ilearndevtech
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/ 56

ITC3303

Data Communications And


Networking

The Network Layer


Introduction
• The network layer is responsible for the host-to-host delivery of
datagrams.
• It provides services to the transport layer and receives services from
the data-link layer.
TCP/IP Suit
Packetizing
• The first duty of the network layer is packetizing, encapsulating the
payload (data received from upper layer) 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.
Packetizing
• The source host receives the payload from an upper-layer protocol,
adds a header that contains the source and destination addresses and
some other information that is required by the network-layer
protocol and delivers the packet to the data-link layer.
• The source is not allowed to change the content of the payload unless
it is too large for delivery and needs to be fragmented.
Packetizing
• The destination host receives the network-layer packet from its data-
link layer, decapsulates the packet, and delivers the payload to the
corresponding upper-layer protocol.
• If the packet is fragmented at the source or at routers along the path,
the network layer is responsible for waiting until all fragments arrive,
reassembling them, and delivering them to the upper-layer protocol.
• The routers in the path are not allowed to decapsulate the packets
they received unless the packets need to be fragmented.
Packetizing
• The routers are not allowed to change source and destination
addresses either.
• They just inspect the addresses for the purpose of forwarding the
packet to the next network on the path.
• However, if a packet is fragmented, the header needs to be copied to
all fragments and some changes are needed.
Routing and Forwarding
Routing:
• The network layer is responsible for routing the packet from its
source to the destination.
• A physical network is a combination of networks (LANs and WANs)
and routers that connect them.
• This means that there is more than one route from the source to the
destination.
Routing and Forwarding
• The network layer is responsible for finding the best one among these
possible routes.
• The network layer needs to have some specific strategies for defining
the best route.
• In the Internet today, this is done by running some routing protocols
to help the routers coordinate their knowledge about the
neighbourhood and to come up with consistent tables to be used
when a packet arrives.
Routing and Forwarding
Forwarding:
• If routing is applying strategies and running some routing protocols to
create the decision-making tables for each router, forwarding can be
defined as the action applied by each router when a packet arrives at
one of its interfaces.
• The decision-making table a router normally uses for applying this
action is sometimes called the forwarding table and sometimes the
routing table.
Routing and Forwarding
• When a router receives a packet from one of its attached networks, it
needs to forward the packet to another attached network (in unicast
routing) or to some attached networks (in multicast routing).
• To make this decision, the router uses a piece of information in the
packet header, which can be the destination address or a label, to find
the corresponding output interface number in the forwarding table
Other Services

• Error Control
• Flow Control
• Congestion Control
• Security
Error Control

• Although error control also can be implemented in the network layer,


the designers of the network layer in the Internet ignored this issue
for the data being carried by the network layer.
• One reason for this decision is the fact that the packet in the network
layer may be fragmented at each router, which makes error checking
at this layer inefficient.
Error Control
• The designers of the network layer, however, have added a checksum
field to the datagram to control any corruption in the header, but not
in the whole datagram.
• This checksum may prevent any changes or corruptions in the header
of the datagram.
• We need to mention that although the network layer in the Internet
does not directly provide error control, the Internet uses an auxiliary
protocol(ICMP), that provides some kind of error control if the
datagram is discarded or has some unknown information in the
header.
Flow Control
• Flow control regulates the amount of data a source can send without
overwhelming the receiver.
• If the upper layer at the source computer produces data faster than
the upper layer at the destination computer can consume it, the
receiver will be overwhelmed with data.
• To control the flow of data, the receiver needs to send some feedback
to the sender to inform the latter that it is overwhelmed with data.
Flow Control
• The network layer in the Internet, however, does not directly provide
any flow control. The datagrams are sent by the sender when they are
ready, without any attention to the readiness of the receiver.
• A few reasons for the lack of flow control in the design of the network
layer can be mentioned.
• First, since there is no error control in this layer, the job of the
network layer at the receiver is so simple that it may rarely be
overwhelmed.
Flow Control
• Second, the upper layers that use the service of the network layer can
implement buffers to receive data from the network layer as they are
ready and do not have to consume the data as fast as it is received.
• Third, flow control is provided for most of the upper-layer protocols
that use the services of the network layer, so another level of flow
control makes the network layer more complicated and the whole
system less efficient.
Congestion Control

• Another issue in a network-layer protocol is congestion control.


Congestion in the network layer is a situation in which too many
datagrams are present in an area of the Internet.
• Congestion may occur if the number of datagrams sent by source
computers is beyond the capacity of the network or routers.
• In this situation, some routers may drop some of the datagrams.
Congestion Control

• However, as more datagrams are dropped, the situation may become


worse because, due to the error control mechanism at the upper
layers, the sender may send duplicates of the lost packets.
• If the congestion continues, sometimes a situation may reach a point
where the system collapses and no datagrams are delivered.
Security

• Another issue related to communication at the network layer is


security.
• Security was not a concern when the Internet was originally designed
because it was used by a small number of users at universities for
research activities; other people had no access to the Internet.
• The network layer was designed with no security provision.
Security
• Today, however, security is a big concern.
• To provide security for a connectionless network layer, we need to
have another virtual level that changes the connectionless service to
a connection-oriented service.
• This virtual layer, called IPSec.
IP Addressing

• Binary Conversion
• IPv4 Addresses
• Address Space
• Notation
• Subnetting
IP Addressing
• Binary Conversion
128 64 32 16 8 4 2 1
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, because if the device is moved to another network, the IP
address may be changed.
IPv4 Addresses
• IPv4 addresses are unique in the sense that each address defines one,
and only one, connection to the Internet.
• If a device has two connections to the Internet, via two networks, it
has two IPv4 addresses.
• IPv4 addresses are universal in the sense that the addressing system
must be accepted by any host that wants to be connected to the
Internet.
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 2^b
because each bit can have two different values (0 or 1).
• IPv4 uses 32-bit addresses, which means that the address space is
2^32 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.
Notation

• There are three common notations of an IPv4 address:


1. Binary notation (base 2)
2. Dotted-decimal notation (base 256), and
3. Hexadecimal notation (base 16).
Notation

Binary
• In binary notation, an IPv4 address is displayed as 32 bits.
• To make the address more readable, one or more spaces are usually
inserted between each octet (8 bits).
• Each octet is often referred to as a byte.
• For example: 11000001.10100000.00000001.00000000
Notation
Dotted-Decimal:
• To make the IPv4 address more compact and easier to read, it is
usually written in decimal form with a decimal point (dot) separating
the bytes.
• This format is referred to as dotted-decimal notation.
• Note that because each byte (octet) is only 8 bits, each number in the
dotted-decimal notation is between 0 and 255
• For example: 192.168.16.0
Notation
Hexadecimal:
• Sometimes an IPv4 address can be represented in hexadecimal
notation.
• Each hexadecimal digit is equivalent to four bits.
• This means that a 32-bit address has 8 hexadecimal digits.
• For example: 80:0B:03:1F
Hierarchy in Addressing
• In any communication network that involves delivery, such as a
telephone network or a postal network, the addressing system is
hierarchical.
• In a postal network, the postal address (mailing address) includes the
country, state, city, street, house number, and the name of the mail
recipient.
• Similarly, a telephone number is divided into the country code, area
code, local exchange, and the connection.
Hierarchy in Addressing

• A 32-bit IPv4 address is also hierarchical, but divided only into two
parts.
• The first part of the address, called the prefix, defines the network;
• The second part of the address, called the suffix, defines the node
(connection of a device to the Internet).
Hierarchy in Addressing
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).
• This scheme is referred to as classful addressing.
Classful Addressing
Classful Addressing
Subnet Mask/Default Subnet Mask:
• Subnet mask shows which part is for the network and host portion
• Class A: 255.0.0.0
• Class B: 255.255.0.0
• Class C: 255.255.255.0
Classful Addressing

Slash Notation:
• Class A: /8
• Class B: /16
• Class C: /24
Classful Addressing
• In class A, the network length is 8 bits, but since the first bit, which is
0, defines the class, we can have only seven bits as the network
identifier.
• This means there are only 2^7 = 128 networks in the world that can
have a class A address.
• In class B, the network length is 16 bits, but since the first two bits,
which are (10)2, define the class, we can have only 14 bits as the
network identifier.
• This means there are only 2^14 = 16,384 networks in the world that
can have a class B address.
Classful Addressing

• All addresses that start with (110)2 belong to class C.


• In class C, the network length is 24 bits, but since three bits define the
class, we can have only 21 bits as the network identifier.
• This means there are 2^21 = 2,097,152 networks in the world that
can have a class C address.
Classful Addressing

• All addresses that start with (110)2 belong to class C.


• In class C, the network length is 24 bits, but since three bits define the
class, we can have only 21 bits as the network identifier.
• This means there are 2^21 = 2,097,152 networks in the world that
can have a class C address.
Classful Addressing

• Class D is not divided into prefix and suffix.


• It is used for multicast addresses.
• All addresses that start with 1111 in binary belong to class E.
• As in Class D, Class E is not divided into prefix and suffix and is used as
reserve.
Address Depletion
• The reason that classful addressing has become obsolete is address
depletion.
• Since the addresses were not distributed properly, the Internet was
faced with the problem of the addresses being rapidly used up,
resulting in no more addresses available for organizations and
individuals that needed to be connected to the Internet.
Address Depletion
• To understand the problem, let us think about class A.
• This class can be assigned to only 128 organizations in the world, but
each organization needs to have a single network (seen by the rest of
the world) with 16,777,216 nodes (computers in this single network).
• Since there may be only a few organizations that are this large, most
of the addresses in this class were wasted (unused).
• Class B addresses were designed for midsize organizations, but many
of the addresses in this class also remained unused.
Address Depletion

• Class C addresses have a completely different flaw in design.


• The number of addresses that can be used in each network (256) was
too small that most companies were not comfortable using a block in
this address class.
• Class E addresses were almost never used, wasting the whole class.
Classless Addressing

• In 1996, the Internet authorities announced a new architecture called


classless addressing.
• In classless addressing, variable-length blocks are used that belong to
no classes.
• For example; 10.10.10.0/25
• The notation is formally known as classless interdomain routing or
CIDR
Classless Addressing
• Unlike classful addressing, the prefix length in classless addressing is
variable.
• We can have a prefix length that ranges from 0 to 32.
• The size of the network is inversely proportional to the length of the
prefix.
• A small prefix means a larger network; a large prefix means a smaller
network.
Private Addresses

• Four blocks are assigned as private addresses:


1. 10.0.0.0/8
2. 172.16.0.0/12
3. 192.168.0.0/16
4. 169.254.0.0/16 - (APIPA)
Subnetting

• Subnetting is a process of borrowing/stealing bit/s from host portion


in order to create more networks.
• Bit/s moved from host the portion to the network portion
Subnetting
• Two considerations:
1. Networks
2. Number of host
Subnetting
• Examples:
Problems
1. Rewrite the following IP addresses using binary notation:
a. 200.130.17.45 b. 110.230.46.1 c. 198.19.20.17
d. 192.178.29.0 e. 172.16.10.18 f. 192.16.0.0
2. Rewrite the following IP addresses using dotted-decimal notation:
a. 01011110.10110000.01110101.00010101
b. 10001001.10001110.11010000.00110001
c. 01010111.10000100.00110111.00001111
d. 11001100.11111110.00000001.10001001
Problems
3. Find the class of the following classful IP addresses:
a. 01110111.11110011.10000111.11011101
b. 11101111.11000000.11110000.01011101
c. 11011111.10110000.00011111.01011001
d. 11101011.11000000.11110000.00011101
e. 00001011.11000001.11010000.00010101
f. 00010110.11001100.11011100.00010001
Problems
4. An ISP is granted the block 16.12.64.0/20. The ISP needs to allocate
addresses for 8 organizations, with the following requirement:
Organization A with 30 hosts
Organization B with 25 hosts
Organization C with 12 hosts
Organization D with 25 hosts
Organization E with 2 hosts
Organization A with 30 hosts
Problems
Convert the following IPv4 addresses from dotted decimal to binary:
• i. 172.16.10.1
• ii. 129.14.6.8
Problems
• An organisation is granted the block 192.168.16.0/24. The
organisation needs to allocate addresses for its 8 branches.
a. Find the number and range of addresses in the block.
b. Find the range of addresses for each organization and the
range of unallocated addresses
Problems
• An organization is granted the block 192.168.10.0/24. The
administrator wants to create 9 subnets.
a. Find the number of addresses in each subnet.
b. Find the new subnet mask.
c. Find the first and the last address in the first subnet.
d. Find the first and the last address in the last subnet

You might also like