0% found this document useful (0 votes)
18 views

Unit-3Network Layer-2 Computer Networks

The document summarizes key aspects of the network layer, including its functions, services, and addressing schemes. Specifically: - The network layer handles data packet routing between source and destination hosts, translating logical addresses, determining routes, and managing traffic issues like switching and congestion. - Its main services are packetizing, routing, and forwarding. Routing determines the best path between devices, while forwarding moves packets through routers. - Network addressing schemes have transitioned from classful (A, B, C) to classless inter-domain routing (CIDR) for more efficient use of IP addresses. CIDR allows flexible allocation and routing based on network prefixes.

Uploaded by

Khush
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)
18 views

Unit-3Network Layer-2 Computer Networks

The document summarizes key aspects of the network layer, including its functions, services, and addressing schemes. Specifically: - The network layer handles data packet routing between source and destination hosts, translating logical addresses, determining routes, and managing traffic issues like switching and congestion. - Its main services are packetizing, routing, and forwarding. Routing determines the best path between devices, while forwarding moves packets through routers. - Network addressing schemes have transitioned from classful (A, B, C) to classless inter-domain routing (CIDR) for more efficient use of IP addresses. CIDR allows flexible allocation and routing based on network prefixes.

Uploaded by

Khush
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/ 20

Network Layer

o The Network Layer is the third layer of the OSI model.


o It handles the service requests from the transport layer and further forwards the service request
to the data link layer.
o The network layer translates the logical addresses into physical addresses
o It determines the route from the source to the destination and also manages the traffic
problems such as switching, routing and controls the congestion of data packets.
o The main role of the network layer is to move the packets from sending host to the receiving
host.

Features of Network Layer

1. The main responsibility of the Network layer is to carry the data packets from the
source to the destination without changing or using them.

2. If the packets are too large for delivery, they are fragmented i.e., broken down
into smaller packets.

3. It decides the route to be taken by the packets to travel from the source to the
destination among the multiple routes available in a network (also called
routing).

4. The source and destination addresses are added to the data packets inside the
network layer.

Services Offered by Network Layer

The services which are offered by the network layer protocol are as follows:

1. Packetizing

2. Routing

3. Forwarding

Packetizing
The process of encapsulating the data received from the upper layers of the network
(also called payload) in a network layer packet at the source and decapsulating the
payload from the network layer packet at the destination is known as packetizing.
The source host adds a header that contains the source and destination address and
some other relevant information required by the network layer protocol to the payload
received from the upper layer protocol and delivers the packet to the data link layer.
Routing
Routing is the process of moving data from one device to another device. These are
two other services offered by the network layer. In a network, there are a number of
routes available from the source to the destination. The network layer specifies some
strategies which find out the best possible route. This process is referred to as
routing. There are a number of routing protocols that are used in this process and
they should be run to help the routers coordinate with each other and help in
establishing communication throughout the network.

Forwarding

Forwarding is simply defined as the action applied by each router when a packet
arrives at one of its interfaces. When a router receives a packet from one of its
attached networks, it needs to forward the packet to another attached network
(unicast routing) or to some attached networks (in the case of multicast routing).
Routers are used on the network for forwarding a packet from the local network to
the remote network. So, the process of routing involves packet forwarding from an
entry interface out to an exit interface.

Difference between Routing and Forwarding


Routing Forwarding

Forwarding is simply defined as the action


Routing is the process of moving data from one
applied by each router when a packet arrives at
device to another device.
one of its interfaces.

Operates on the Network Layer. Operates on the Network Layer.

Checks the forwarding table and work


Work is based on Forwarding Table.
according to that.

Works on protocols like Routing Information Works on protocols like UDP Encapsulating
Protocol (RIP) for Routing. Security Payloads
Network Addressing
o Network Addressing is one of the major responsibilities of the network layer.
o Network addresses are always logical, i.e., software-based addresses.
o A host is also known as end system that has one link to the network. The boundary between
the host and link is known as an interface. Therefore, the host can have only one interface.
o A router is different from the host in that it has two or more links that connect to it. When a
router forwards the datagram, then it forwards the packet to one of the links. The boundary
between the router and link is known as an interface, and the router can have multiple
interfaces, one for each of its links. Each interface is capable of sending and receiving the IP
packets, so IP requires each interface to have an address.
o Each IP address is 32 bits long, and they are represented in the form of "dot-decimal notation"
where each byte is written in the decimal form, and they are separated by the period. An IP
address would look like 193.32.216.9 where 193 represents the decimal notation of first 8 bits
of an address, 32 represents the decimal notation of second 8 bits of an address.

Classful Addressing
An IP address is 32-bit long. An IP address is divided into sub-classes:

o Class A
o Class B
o Class C
o Class D
o Class E

An ip address is divided into two parts:

o Network ID: It represents the number of networks.


o Host ID: It represents the number of hosts.
Class A
In Class A, an IP address is assigned to those networks that contain a large number of hosts.

Backward Skip 10sPlay VideoForward Skip 10s

o The network ID is 8 bits long.


o The host ID is 24 bits long.

In Class A, the first bit in higher order bits of the first octet is always set to 0 and the remaining 7 bits
determine the network ID. The 24 bits determine the host ID in any network.

The total number of networks in Class A = 27 = 128 network address

The total number of hosts in Class A = 224 - 2 = 16,777,214 host address

Class B
In Class B, an IP address is assigned to those networks that range from small-sized to large-sized
networks.
o The Network ID is 16 bits long.
o The Host ID is 16 bits long.

In Class B, the higher order bits of the first octet is always set to 10, and the remaining14 bits determine
the network ID. The other 16 bits determine the Host ID.

The total number of networks in Class B = 214 = 16384 network address

The total number of hosts in Class B = 216 - 2 = 65534 host address

Class C
In Class C, an IP address is assigned to only small-sized networks.

o The Network ID is 24 bits long.


o The host ID is 8 bits long.

In Class C, the higher order bits of the first octet is always set to 110, and the remaining 21 bits
determine the network ID. The 8 bits of the host ID determine the host in a network.

The total number of networks = 221 = 2097152 network address

The total number of hosts = 28 - 2 = 254 host address

Class D
In Class D, an IP address is reserved for multicast addresses. It does not possess subnetting. The higher
order bits of the first octet is always set to 1110, and the remaining bits determines the host ID in any
network.
Class E
In Class E, an IP address is used for the future use or for the research and development
purposes. It does not possess any subnetting. The higher order bits of the first octet is always
set to 1111, and the remaining bits determines the host ID in any network.

Classful Network Architecture

Cl Hig NET ID HOST ID No.of No.of Range


as her bits bits networks hosts
s bits per
networ
k

A 0 8 24 27 224 0.0.0.0 to 127.255.255.255

B 10 16 16 214 216 128.0.0.0 to 191.255.255.255

C 110 24 8 221 28 192.0.0.0 to 223.255.255.255

D 1110 Not Defined Not Defined Not Defined Not 224.0.0.0 to 239.255.255.255
Defined

E 1111 Not Defined Not Defined Not Defined Not 240.0.0.0 to 255.255.255.255
Defined

Classless Inter-Domain Routing (CIDR)


Classless Inter-Domain Routing (CIDR) is a method of IP address allocation and IP
routing that allows for more efficient use of IP addresses. CIDR is based on the idea
that IP addresses can be allocated and routed based on their network prefix rather
than their class, which was the traditional way of IP address allocation.
CIDR addresses are represented using a slash notation, which specifies the number
of bits in the network prefix. For example, an IP address of 192.168.1.0 with a prefix
length of 24 would be represented as 192.168.1.0/24. This notation indicates that the
first 24 bits of the IP address are the network prefix and the remaining 8 bits are the
host identifier.

Advantages:

1. Efficient use of IP addresses: CIDR allows for more efficient use of IP


addresses, which is important as the pool of available IPv4 addresses continues
to shrink.
2. Flexibility: CIDR allows for more flexible allocation of IP addresses, which can
be important for organizations with complex network requirements.
3. Better routing: CIDR allows for more efficient routing of IP traffic, which can
lead to better network performance.
Reduced administrative overhead: CIDR reduces administrative overhead by
allowing for easier management of IP addresses and routing.

Disadvantages:

1. Complexity: CIDR can be more complex to implement and manage than


traditional class-based addressing, which can require additional training and
expertise.
2. Compatibility issues: Some older network devices may not be compatible with
CIDR, which can make it difficult to transition to a CIDR-based network.
3. Security concerns: CIDR can make it more difficult to implement security
measures such as firewall rules and access control lists, which can increase
security risks.
Representation: It is as also a 32-bit address, which includes a special number that
represents the number of bits that are present in the Block Id.
a . b . c . d / n
Where n is the number of bits that are present in Block Id / Network Id. Example:
20.10.50.100/20

Address Resolution Protocol (ARP)


The acronym ARP stands for Address Resolution Protocol which is one of the
most important protocols of the Network layer in the OSI model. It is responsible to
find the hardware address of a host from a known IP address. There are three basic
ARP terms.
Note: ARP finds the hardware address, also known as the Media Access Control
(MAC) address, of a host from its known IP address

RARP

Reverse Address Resolution Protocol is a protocol that is used in local area


networks (LAN) by client machines for requesting IP Adress (IPv4) from Router’s
ARP Table. Whenever a new machine comes, which requires an IP Address for its
use. In that case, the machine sends a RARP broadcast packet containing MAC
Address in the sender and receiver hardware field.
Dynamic Host Configuration Protocol
Dynamic Host Configuration Protocol (DHCP) is a network management protocol used to
dynamically assign an IP address to nay device, or node, on a network so they can
communicate using IP (Internet Protocol). DHCP automates and centrally manages these
configurations. There is no need to manually assign IP addresses to new devices. Therefore,
there is no requirement for any user configuration to connect to a DHCP based network.

DHCP can be implemented on local networks as well as large enterprise networks. DHCP is the
default protocol used by the most routers and networking equipment. DHCP is also called RFC
(Request for comments) 2131.

DHCP does the following:


o DHCP manages the provision of all the nodes or devices added or dropped from the network.
o DHCP maintains the unique IP address of the host using a DHCP server.
o It sends a request to the DHCP server whenever a client/node/device, which is configured to
work with DHCP, connects to a network. The server acknowledges by providing an IP address to
the client/node/device.

ICMP Protocol
The ICMP stands for Internet Control Message Protocol. It is a network layer protocol. It is
used for error handling in the network layer, and it is primarily used on network devices such
as routers. As different types of errors can exist in the network layer, so ICMP can be used to
report these errors and to debug those errors.

For example, some sender wants to send the message to some destination, but the router
couldn't send the message to the destination. In this case, the router sends the message to
the sender that I could not send the message to that destination.

The IP protocol does not have any error-reporting or error-correcting mechanism, so it uses a
message to convey the information. For example, if someone sends the message to the
destination, the message is somehow stolen between the sender and the destination. If no
one reports the error, then the sender might think that the message has reached the
destination. If someone in-between reports the error, then the sender will resend the message
very quickly.
Routing
o A Router is a process of selecting path along which the data can be transferred from source to
the destination. Routing is performed by a special device known as a router.
o A Router works at the network layer in the OSI model and internet layer in TCP/IP model
o A router is a networking device that forwards the packet based on the information available in
the packet header and forwarding table.
o The routing algorithms are used for routing the packets. The routing algorithm is nothing but a
software responsible for deciding the optimal path through which packet can be transmitted.
o The routing protocols use the metric to determine the best path for the packet delivery. The
metric is the standard of measurement such as hop count, bandwidth, delay, current load on
the path, etc. used by the routing algorithm to determine the optimal path to the destination.
o The routing algorithm initializes and maintains the routing table for the process of path
determination.

Static Routing

o Static Routing is also known as Nonadaptive Routing.


o It is a technique in which the administrator manually adds the routes in a routing table.
o A Router can send the packets for the destination along the route defined by the administrator.
o In this technique, routing decisions are not made based on the condition or topology of the
networks
Advantages Of Static Routing
Following are the advantages of Static Routing:

o No Overhead: It has ho overhead on the CPU usage of the router. Therefore, the cheaper
router can be used to obtain static routing.
o Bandwidth: It has not bandwidth usage between the routers.
o Security: It provides security as the system administrator is allowed only to have control over
the routing to a particular network.

Disadvantages of Static Routing:


Following are the disadvantages of Static Routing:

o For a large network, it becomes a very difficult task to add each route manually to the routing
table.
o The system administrator should have a good knowledge of a topology as he has to add each
route manually.

Dynamic Routing

o It is also known as Adaptive Routing.


o It is a technique in which a router adds a new route in the routing table for each packet in
response to the changes in the condition or topology of the network.
o Dynamic protocols are used to discover the new routes to reach the destination.
o In Dynamic Routing, RIP and OSPF are the protocols used to discover the new routes.
o If any route goes down, then the automatic adjustment will be made to reach the destination.

The Dynamic protocol should have the following features:

o All the routers must have the same dynamic routing protocol in order to exchange the routes.
o If the router discovers any change in the condition or topology, then router broadcast this
information to all other routers.

Advantages of Dynamic Routing:


o It is easier to configure.
o It is more effective in selecting the best route in response to the changes in the condition or
topology.

Disadvantages of Dynamic Routing:


o It is more expensive in terms of CPU and bandwidth usage.
o It is less secure as compared to default and static routing.

Dijkstra Algorithm-

 Dijkstra Algorithm is a very famous greedy algorithm.


 It is used for solving the single source shortest path problem.
 It computes the shortest path from one particular source node to all other remaining nodes of the
graph.
Shortest Path Routing (Dijkstra’s)

The idea is to build a graph of the subnet, with each node of the graph
representing a routerand each arc of the graph representing a communication
line or link.

To choose a route between a given pair of routers, the algorithm just finds the
shortest pathbetween them on the graph

1. Start with the local node (router) as the root of the tree. Assign a cost of
0 to this node andmake it the first permanent node.
2. Examine each neighbor of the node that was the last permanent node.
3. Assign a cumulative cost to each node and make it tentative
4. Among the list of tentative nodes
a. Find the node with the smallest cost and make it Permanent
b. If a node can be reached from more than one route then select the
route with theshortest cumulative cost.
5. Repeat steps 2 to 4 until every node becomes permanent
Flooding
• Another static algorithm is flooding, in which every incoming packet is
sent out on every outgoing line except the one it arrived on.
• Flooding obviously generates vast numbers of duplicate packets, in fact,
an infinite number unless some measures are taken to damp the process.
Calculation of a routing table

routing table for node A

CONGESTION CONTROL ALGORITHMS

Too many packets present in (a part of) the network causes packet delay and
loss that degrades performance. This situation is called congestion.

The network and transport layers share the responsibility for handling
congestion. Since congestion occurs within the network, it is the network
layer that directly experiences it and must ultimately determine what to do
with the excess packets.
However, the most effective way to control congestion is to reduce the load
that the transport layer is placing on the network. This requires the network
and transport layers to work together. In this chapter we will look at the
network aspects of congestion.

difference between congestion control and flow control.

Congestion control has to do with making sure the network is able to carry
the offered traffic. It is a global issue, involving the behavior of all the hosts
and routers.

Flow control, in contrast, relates to the traffic between a particular sender


and a particular receiver. Its job is to make sure that a fast sender cannot
continually transmit data faster than the receiver is able to absorb it.

The Leaky Bucket Algorithm used to control rate in a network. It is


implemented as a single- server queue with constant service time. If the
bucket (buffer) overflows then packets are discarded.
(a) A leaky bucket with water. (b) a leaky bucket with packets.
1. The leaky bucket enforces a constant output rate (average rate)
regardless of the burstiness of the input. Does nothing when input is idle.
2. The host injects one packet per clock tick onto the network. This results
in a uniform flow of packets, smoothing out bursts and reducing
congestion.
3. When packets are the same size (as in ATM cells), the one packet per tick
is okay. For variable length packets though, it is better to allow a fixed
number of bytes per tick. E.g. 1024 bytes per tick will allow one 1024-byte
packet or two 512-byte packets or four 256- byte packets on 1 tick

Token Bucket Algorithm

1. In contrast to the LB, the Token Bucket Algorithm, allows the


output rate to vary,depending on the size of the burst.
2. In the TB algorithm, the bucket holds tokens. To transmit a packet, the
host must captureand destroy one token.
3. Tokens are generated by a clock at the rate of one token every t sec.
4. Idle hosts can capture and save up tokens (up to the max. size of the
bucket) in order tosend larger bursts later.
(a) Before. (b) After.

Leaky Bucket vs. Token Bucket

1. LB discards packets; TB does not. TB discards tokens.


2. With TB, a packet can only be transmitted if there are enough tokens to
cover its length inbytes.
3. LB sends packets at an average rate. TB allows for large bursts to be sent
faster by speeding up the output.
4. TB allows saving up tokens (permissions) to send large bursts. LB does not allow
saving.

IPv6
IPv4 produces 4 billion addresses, and the developers think that these addresses are enough,
but they were wrong. IPv6 is the next generation of IP addresses. The main difference between
IPv4 and IPv6 is the address size of IP addresses. The IPv4 is a 32-bit address, whereas IPv6 is a
128-bit hexadecimal address. IPv6 provides a large address space, and it contains a simple
header as compared to IPv4.
The address format of IPv6:

The above diagram shows the address format of IPv4 and IPv6. An IPv4 is a 32-bit decimal
address. It contains 4 octets or fields separated by 'dot', and each field is 8-bit in size. The
number that each field contains should be in the range of 0-255. Whereas an IPv6 is a 128-bit
hexadecimal address. It contains 8 fields separated by a colon, and each field is 16-bit in size.

Advantages of IPv6
 Reliability
 Faster Speeds: IPv6 supports multicast rather than broadcast in IPv4.This
feature allows bandwidth-intensive packet flows (like multimedia streams) to be
sent to multiple destinations all at once.
 Stronger Security: IPSecurity, which provides confidentiality, and data
integrity, is embedded into IPv6.
 Routing efficiency
 Most importantly it’s the final solution for growing nodes in Global-network.
Disadvantages of IPv6
 Conversion: Due to widespread present usage of IPv4 it will take a long
period to completely shift to IPv6.
 Communication: IPv4 and IPv6 machines cannot communicate directly with
each other. They need an intermediate technology to make that possible.

Differences between IPv4 and IPv6


IPv4 is a 32-bit address. IPv6 is a 128-bit address.

IPv4 is a numeric address that consists of 4 fields IPv6 is an alphanumeric address that
which are separated by dot (.). consists of 8 fields, which are separated
by colon.

IPv4 has 5 different classes of IP address that IPv6 does not contain classes of IP
includes Class A, Class B, Class C, Class D, and addresses.
Class E.

IPv4 has a limited number of IP addresses. IPv6 has a large number of IP addresses.

It supports manual and DHCP configuration. It supports manual, DHCP, auto-


configuration, and renumbering.

It generates 4 billion unique addresses It generates 340 undecillion unique


addresses.

In IPv4, end-to-end connection integrity is In the case of IPv6, end-to-end


unachievable. connection integrity is achievable.

In IPv4, security depends on the application. This In IPv6, IPSEC is developed for security
IP address is not developed in keeping the purposes.
security feature in mind.

In IPv4, the IP address is represented in decimal. In IPv6, the representation of the IP


address in hexadecimal.

It does not provide any mechanism for packet It uses flow label field in the header for
flow identification. the packet flow identification.

The checksum field is available in IPv4. The checksum field is not available in
IPv6.

IPv4 is broadcasting. On the other hand, IPv6 is multicasting,


which provides efficient network
operations.

It does not provide encryption and It provides encryption and authentication.


authentication.

It consists of 4 octets. It consists of 8 fields, and each field


contains 2 octets. Therefore, the total
number of octets in IPv6 is 16.

You might also like