0% found this document useful (0 votes)
4 views15 pages

CN - Module 3

Uploaded by

haadilaza71
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)
4 views15 pages

CN - Module 3

Uploaded by

haadilaza71
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/ 15

Module 3: The Network Layer

The network Layer is the third layer in the OSI model of computer networks. Its
main function is to transfer network packets from the source to the destination. It
involves both the source host and the destination host.

What is the Network?


A network is a group of two or more connected computers or devices. These devices
usually connect to a central hub, like a router. Networks can also have subnetworks,
which are smaller sections of the main network. Subnetworks help large networks,
such as those used by Internet Service Providers, manage many IP addresses and
devices.
The Internet is like a network of networks. Computers connect within their own
networks and then connect to other networks. This allows computers to communicate
with each other, no matter where they are.
What is the Network Layer?
The network layer is a part of the communication process in computer networks. Its
main job is to move data packets between different networks. It helps route these
packets from the sender to the receiver across multiple paths and networks. Network-
to-network connections enable the Internet to function. These connections happen at
the “network layer,” which sends data packets between different networks. In the 7-
layer OSI model, the network layer is layer 3. The Internet Protocol (IP) is a key
protocol used at this layer, along with other protocols for routing, testing, and
encryption.

Services Offered by Network Layer


The services which are offered by the network layer protocol are as follows:
• Packetizing
• Routing
• Forwarding
1. 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.
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. The routers in the path are not allowed to change either the source or the
destination address. The routers in the path are not allowed to decapsulate the
packets they receive unless they need to be fragmented.
2. 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.

Different Types of Routing:

There are three different types of routing:


1. Static Routing
2. Dynamic Routing
3. Default Routing
Static Routing: In this type of routing the routing table is updated by the network
administrator.
Dynamic Routing: In this type of routing the routing table is automatically updated
using routing protocols.
Default Routing: In this type of routing the router is configured to send all the data
towards a specific router.

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

Packet Forwarding Techniques:

Following are the packet forwarding techniques based on the destination host:

• Next-Hop Method: By only maintaining the details of the next hop or next
router in the packet’s path, the next-hop approach reduces the size of the
routing table. The routing table maintained using this method does not have
the information regarding the whole route that the packet must take.

• Network-Specific Method: In this method, the entries are not made for all
of the destination hosts in the router’s network. Rather, the entry is made of
the destination networks that are connected to the router.
• Host-Specific Method: In this method, the routing table has the entries for
all of the destination hosts in the destination network. With the increase in
the size of the routing table, the efficiency of the routing table decreases. It
finds its application in the process of verification of route and security
purposes.

• Default Method: Let’s assume- A host in network N1 is connected to two


routers, one of which (router R1) is connected to network N2 and the other
router R2 to the rest of the internet. As a result, the routing table only has
one default entry for the router R2.
4. CONGESTION CONTROL

Network Congestion occurs when the traffic moving through a network exceeds its
highest capacity. Congestion control refers to the techniques used to control or
prevent congestion. Congestion control techniques can be broadly classified into two
categories:

Open Loop Congestion Control


Open loop congestion control policies are applied to prevent congestion before it
happens. The congestion control is handled either by the source or the destination.
Policies adopted by open loop congestion control are:
1. Retransmission Policy :
It is the policy in which retransmission of the packets are taken care of. If
the sender feels that a sent packet is lost or corrupted, the packet needs to
be retransmitted. This transmission may increase the congestion in the
network.
To prevent congestion, retransmission timers must be designed to prevent
congestion and also able to optimize efficiency.
2. Window Policy :
The type of window at the sender’s side may also affect the congestion.
Several packets in the Go-back-n window are re-sent, although some
packets may be received successfully at the receiver side. This duplication
may increase the congestion in the network and make it worse.
Therefore, Selective repeat window should be adopted as it sends the
specific packet that may have been lost.
3. Acknowledgment Policy :
Since acknowledgements are also the part of the load in the network, the
acknowledgment policy imposed by the receiver may also affect
congestion. Several approaches can be used to prevent congestion related
to acknowledgment. The receiver should send acknowledgement for N
packets rather than sending acknowledgement for a single packet. The
receiver should send an acknowledgment only if it has to send a packet or
a timer expires.
4. Admission Policy :
In admission policy a mechanism should be used to prevent congestion.
Switches in a flow should first check the resource requirement of a
network flow before transmitting it further. If there is a chance of a
congestion or there is a congestion in the network, router should deny
establishing a virtual network connection to prevent further congestion.
Closed Loop Congestion Control
Closed loop congestion control techniques are used to treat or alleviate congestion
after it happens. Several techniques are used by different protocols. Some of them
are:

1. Backpressure :
Backpressure is a technique in which a congested node stops receiving packets from
upstream node. This may cause the upstream node or nodes to become congested
and reject receiving data from above nodes. Backpressure is a node-to-node
congestion control technique that propagate in the opposite direction of data flow.
The backpressure technique can be applied only to virtual circuit where each node
has information of its above upstream node.

In above diagram the 3rd node is congested and stops receiving packets as a
result 2nd node may be get congested due to slowing down of the output data flow.
Similarly 1st node may get congested and inform the source to slow down.

2. Choke Packet Technique :


Choke packet technique is applicable to both virtual networks as well as datagram
subnets. A choke packet is a packet sent by a node to the source to inform it of
congestion. Each router monitors its resources and the utilization at each of its
output lines. Whenever the resource utilization exceeds the threshold value which is
set by the administrator, the router directly sends a choke packet to the source giving
it feedback to reduce the traffic. The intermediate nodes through which the packets
have traveled are not warned about congestion.

3. Implicit Signaling :
In implicit signaling, there is no communication between the congested nodes and
the source. The source guesses that there is congestion in a network. For example
when sender sends several packets and there is no acknowledgment for a while, one
assumption is that there is a congestion.

4. Explicit Signaling :
In explicit signaling, if a node experiences congestion it can explicitly send a packet
to the source or destination to inform about congestion. The difference between
choke packet and explicit signaling is that the signal is included in the packets that
carry data rather than creating a different packet as in case of choke packet
technique.
Explicit signaling can occur in either forward or backward direction.
• Forward Signaling : In forward signaling, a signal is sent in the direction
of the congestion. The destination is warned about congestion. The
receiver in this case adopt policies to prevent further congestion.
• Backward Signaling : In backward signaling, a signal is sent in the
opposite direction of the congestion. The source is warned about
congestion and it needs to slow down.

IP ADDRESSING
An IP address is a unique address that is used to identify computers or nodes on the
internet. This address is just a string of numbers written in a certain format. It is
generally expressed in a set of numbers for example 192.155.12.1.

Types of IP Address

IP Address is of two types:


1. IPv4: Internet Protocol version 4. It consists of 4 numbers separated by the dots.
Each number can be from 0-255 in decimal numbers. But computers do not understand
decimal numbers, they instead change them to binary numbers which are only 0 and
1. Therefore, in binary, this (0-255) range can be written as (00000000 – 11111111).
Since each number N can be represented by a group of 8-digit binary digits. So, a
whole IPv4 binary address can be represented by 32-bits of binary digits. In IPv4, a
unique sequence of bits is assigned to a computer, so a total of 232 devices
approximately = 4,294,967,296 can be assigned with IPv4.
IPv4 can be written as:
189.123.123.90
2. IPv6: But, there is a problem with the IPv4 address. With IPv4, we can connect
only the above number of 4 billion devices uniquely, and apparently, there are much
more devices in the world to be connected to the internet. So, gradually we are making
our way to IPv6 Address which is a 128-bit IP address. In human-friendly form, IPv6
is written as a group of 8 hexadecimal numbers separated with colons(:). But in the
computer-friendly form, it can be written as 128 bits of 0s and 1s. Since, a unique
sequence of binary digits is given to computers, smartphones, and other devices to be
connected to the internet. So, via IPv6 a total of 2128 devices can be assigned with
unique addresses which are actually more than enough for upcoming future
generations.
IPv6 can be written as:
2011:0bd9:75c5:0000:0000:6b3e:0170:8394

Classful Addressing in IPv4


Classful IP addressing is a way of organizing and managing IP addresses, which
are used to identify devices on a network. The traditional IP address classes, their
ranges and subnet masking system is called the classful addressing.
The 32-bit IP address is divided into five sub-classes. These are given below:
• Class A
• Class B
• Class C
• Class D
• Class E
Each of these classes has a valid range of IP addresses. Classes D and E are reserved
for multicast and experimental purposes respectively. The order of bits in the first
octet determines the classes of the IP address.
The class of IP address is used to determine the bits used for network ID and host ID
and the number of total networks and hosts possible in that particular class. Each ISP
or network administrator assigns an IP address to each device that is connected to its
network.

Classful Addressing
Class A
IP addresses belonging to class A are assigned to the networks that contain a large
number of hosts.
• The network ID is 8 bits long.
• The host ID is 24 bits long.
The first octet is used to determine network ID. The 24 bits of host ID are used to
determine the host in any network. The default subnet mask for Class A is 255.0.0.0.
Therefore, class A has a total of:
• 2^24 – 2 = 16,777,214 host ID
IP addresses belonging to class A ranges from 0.0.0.0 – 127.255.255.255.

Class B
IP address belonging to class B is assigned to networks that range from medium-sized
to large-sized networks.
• The network ID is 16 bits long.
• The host ID is 16 bits long.
The 16 bits of host ID are used to determine the host in any network. The default
subnet mask for class B is 255.255.0.0. Class B has a total of:
• 2^16 – 2 = 65534 host address
IP addresses belonging to class B ranges from 128.0.0.0 – 191.255.255.255.

Class C
IP addresses belonging to class C are assigned to small-sized networks.
• The network ID is 24 bits long.
• The host ID is 8 bits long.
The 8 bits of host ID are used to determine the host in any network. The default subnet
mask for class C is 255.255.255.0. Class C has a total of:
• 2^8 – 2 = 254 host address
IP addresses belonging to class C range from 192.0.0.0 – 223.255.255.255.

Class D
IP address belonging to class D is reserved for multi-casting. Class D does not possess
any subnet mask. IP addresses belonging to class D range from 224.0.0.0 –
239.255.255.255.

Class E
IP addresses belonging to class E are reserved for experimental and research purposes.
IP addresses of class E range from 240.0.0.0 – 255.255.255.255. This class doesn’t
have any subnet mask.
Rules for Assigning Host ID
Host IDs are used to identify a host within a network. The host ID is assigned based
on the following rules:
• Within any network, the host ID must be unique to that network.
• A host ID in which all bits are set to 0 cannot be assigned because this host
ID is used to represent the network ID of the IP address.
• Host ID in which all bits are set to 1 cannot be assigned because this host
ID is reserved as a broadcast address to send packets to all the hosts
present on that particular network.

Problems With Classful Addressing


The problem with this classful addressing method is that millions of class A addresses
are wasted, many of the class B addresses are wasted, whereas, the number of
addresses available in class C is so small that it cannot cater to the needs of
organizations. Class D addresses are used for multicast routing and are therefore
available as a single block only. Class E addresses are reserved.

CLASSLESS ADDRESSING in IPv4


The Network address identifies a network on the internet. Using this, we can find
a range of addresses in the network and total possible number of hosts in the network.
Mask is a 32-bit binary number that gives the network address in the address block
when AND operation is applied on the mask and any IP address of the block.
The default masks in different classes are :
• Class A – 255.0.0.0
• Class B – 255.255.0.0
• Class C – 255.255.255.0

Subnetting
Dividing a large block of addresses into several contiguous sub-blocks and assigning
these sub-blocks to different smaller networks is called subnetting. It is a practice that
is widely used when classless addressing is done.
A subnet or subnetwork is a network inside a network. Subnets make networks more
efficient. Through subnetting, network traffic can travel a shorter distance without
passing through unnecessary routers to reach its destination.

What is a subnet mask?


A subnet mask is a 32-bit binary number used in modern network addressing schemes to
differentiate between a network's location and the specific location of a host or device on
that network. A subnet mask is one part of a network address and is always used with an
Internet Protocol address (IP address) to determine the precise destination for
each network packet.

Classless Addressing
To reduce the wastage of IP addresses in a block, we use sub-netting. What we do is
that we use host id bits as net id bits of a classful IP address. We give the IP address
and define the number of bits for mask along with it (usually followed by a ‘/’ symbol),
like, 192.168.1.1/28. Here, subnet mask is found by putting the given number of bits
out of 32 as 1, like, in the given address, we need to put 28 out of 32 bits as 1 and the
rest as 0, and so, the subnet mask would be 255.255.255.240. A classless addressing
system or classless interdomain routing (CIDR or supernetting) is the way to combine
two or more class C networks to create a/23 or a /22 supernet. A classless addressing
system or classless interdomain routing (CIDR) is an improved IP addressing system.
In a classless addressing system the block of IP address is assigned dynamically based
on specific rules.
Some values calculated in Subnetting:

1. Number of subnets : 2 𝑔𝑖𝑣𝑒𝑛 𝑚𝑎𝑠𝑘−𝑑𝑒𝑓𝑎𝑢𝑙𝑡 𝑚𝑎𝑠𝑘


2. Subnet address : AND result of subnet mask and the given IP address
3. Broadcast address : By putting the host bits as 1 and retaining the network bits as
in the IP address
4. Number of hosts per subnet : : 232−𝑔𝑖𝑣𝑒𝑛 𝑚𝑎𝑠𝑘 – 2
5. First Host ID : Subnet address + 1
6. Last Host ID : Subnet address + Number of Hosts

What is Supernetting?
Supernetting is the opposite of Subnetting. In subnetting, a single big network is
divided into multiple smaller subnetworks. In Supernetting, multiple networks are
combined into a bigger network termed a Supernetwork or Supernet.
Supernetting is the process of aggregating routes to multiple smaller networks. Thus
saving storage space in the routing table, simplifying routing decisions, and reducing
route advertisements. Supernetting has helped to address the increasing size of routing
tables as the Internet has expanded.
More specifically,
• When multiple networks are combined to form a bigger network, it is
termed super-netting
• Super netting is used in route aggregation to reduce the size of routing
tables and routing table updates
Conditions for Supernetting
• All the Networks should be contiguous.
• The block size of every network should be equal and must be in form of
2n.
• First Network id should be exactly divisible by whole size of supernet.
Suppose 4 small networks of class C:

200.1.0.0, 200.1.1.0, 200.1.2.0, 200.1.3.0

let’s check whether three conditions are satisfied or not:


• Contiguous: You can easily see that all networks are contiguous all
having size 256 IP Addresses(254 Hosts )..
Range of first Network from 200.1.0.0 to 200.1.0.255. If you add 1 in last
IP address of first network that is 200.1.0.255 + 0.0.0.1, you will get the
next network id which is 200.1.1.0. Similarly, check that all subnets are
contiguous.
• Equal size of all network: As all networks are of class C, so all of them
have a size of 256 which is in turn equal to 28 .
• First IP address exactly divisible by total size: in order to prove that
first IP address is exactly divisible by while size of Supernet Network, you
can check that if last n (n here refers to the number of bits required to
represent the Total Size of the Supernet) bits are 0 or not.
In the given example first IP is 200.1.0.0 and whole size of supernet is 4*28 = 210. If
last 10 bits of first IP address are zero then IP will be divisible.

Subnetting Supernetting

Subnetting is the procedure to divide While supernetting is the procedure of


the network into sub-networks. combining small networks.

In subnetting, Network addresses’ bits While in supernetting, Host addresses’ bits


are increased. are increased.

Subnetting is implemented via While supernetting is implemented via


Variable-length subnet masking. Classless interdomain routing.

In subnetting, Address wastage is It is used for simplifying the routing


reduced. process.
NETWORK ADDRESS TRANSLATION(NAT)
The idea of NAT is to allow multiple devices to access the Internet through a single
public address. One public IP address is needed to access the Internet, but we can use
a private IP address in our private network. To achieve this, a private IP address must
be translated into a public IP address.
Network Address Translation (NAT) is a process in which one or more local IP
addresses are translated into one or more Global IP addresses and vice versa to provide
Internet access to the local hosts. It also does the translation of port numbers, i.e.,
masks the port number of the host with another port number in the packet that will be
routed to the destination. It then makes the corresponding entries of IP address and
port number in the NAT table. NAT generally operates on a router or firewall.

Working of Network Address Translation (NAT)


Generally, the border router is configured for NAT i.e. the router which has one
interface in the local (inside) network and one interface in the global (outside)
network. When a packet traverse outside the local (inside) network, then NAT
converts that local (private) IP address to a global (public) IP address. When a packet
enters the local network, the global (public) IP address is converted to a local (private)
IP address.
Network Address Translation (NAT) Types
There are two basic ways to configure NAT:
Static NAT
In this, a single unregistered (Private) IP address is mapped with a legally registered
(Public) IP address i.e one-to-one mapping between local and global addresses. This
is generally used for Web hosting. These are not used in organizations as there are
many devices that will need Internet access and to provide Internet access, a public IP
address is needed.
Suppose, if there are 3000 devices that need access to the Internet, the organization
has to buy 3000 public addresses that will be very costly.

Dynamic NAT
In this type of NAT, many different unregistered IP address from a private network
can be translated into a single registered (Public) IP address.It is a type of many to
one mapping.
NAT is used when the number of users who want to access the Internet is fixed.
Port Address Translation (PAT)
This is also known as NAT overload.This helps many local (private) IP addresses to
be translated to a single registered IP address. Port numbers are used to distinguish
the traffic i.e., which traffic belongs to which IP address. This is most frequently used
as it is cost-effective as thousands of users can be connected to the Internet by using
only one real global (public) IP address.

MOBILE INTERNET PROTOCOL


Mobile IP is a communication protocol (created by extending Internet Protocol, IP)
that allows users to move from one network to another with the same IP address. It
ensures that the communication will continue without the user’s sessions or
connections being dropped. Imagine having a phone number that stays the same no
matter where you go. Mobile IP works similarly, ensuring that even if your device
changes its network connection, it can still communicate without interruption.
This is particularly useful for mobile devices like smartphones, laptops, and tablets,
which frequently switch between different networks, such as Wi-Fi and cellular.
Mobile IP helps keep internet connections stable and reliable, making it easier to stay
connected while on the move.

Basic Terminologies Related to Mobile IP


• A Mobile Node (MN): It is the hand-held communication device that the
user carries e.g. Cell phone.
• A Home Network: It is a network to which the mobile node originally
belongs as per its assigned IP address (home address).
• Home Agent (HA): It is a router in-home network to which the mobile
node was originally connected
• Foreign Network: It is the current network to which the mobile node is
visiting (away from its home network).
• A Foreign Agent (FA): It is a router in a foreign network to which the
mobile node is currently connected. The packets from the home agent are
sent to the foreign agent which delivers them to the mobile node.
• The Correspondent Node (CN): It is a device on the internet
communicating to the mobile node.
• Care-of Address (COA): It is the temporary address used by a mobile
node while it is moving away from its home network.
• Foreign Agent COA: The COA assigned by the FA, i.e., the COA is an IP
address of the FA. The FA is the tunnel end-point and forwards packets to
the MN.
• Co-Located COA: The COA is co-located if the MN temporarily
acquires an additional IP address from the DHCP server that acts as a
COA.
Mobile IP Architecture

How Does Mobile IP Work?


The correspondent node sends the data to the mobile node. Data packets contain the
correspondent node’s address (Source) and home address (Destination). Packets reach
the home agent. But now mobile node is not in the home network, it has moved into
the foreign network. The foreign agent sends the care-of-address to the home agent to
which all the packets should be sent. Now, a tunnel will be established between the
home agent and the foreign agent by the process of tunneling.
Tunneling establishes a virtual pipe for the packets available between a tunnel entry
and an endpoint. It is the process of sending a packet via a tunnel and it is achieved
by a mechanism called encapsulation.
Now, the home agent encapsulates the data packets into new packets in which the
source address is the home address and the destination is the care-of-address and sends
it through the tunnel to the foreign agent. Foreign agent, on another side of the tunnel,
receives the data packets, decapsulates them, and sends them to the mobile node. The
mobile node in response to the data packets received sends a reply in response to the
foreign agent. The foreign agent directly sends the reply to the correspondent node.

Key Mechanisms in Mobile IP


• Agent Discovery: Agents advertise their presence by periodically
broadcasting their agent advertisement messages. The mobile node
receiving the agent advertisement messages observes whether the message
is from its own home agent and determines whether it is in the home
network or foreign network.
• Agent Registration: Mobile node after discovering the foreign agent
sends a Registration Request (RREQ) to the foreign agent. The foreign
agent, in turn, sends the registration request to the home agent with the
care-of-address. The home agent sends a Registration Reply (RREP) to the
foreign agent. Then it forwards the registration reply to the mobile node
and completes the process of registration.
• Tunneling: It establishes a virtual pipe for the packets available between a
tunnel entry and an endpoint. It is the process of sending a packet via a
tunnel and it is achieved by a mechanism called encapsulation. Whenever
the home agent receives a packet from the correspondent node, it
encapsulates the packet with source address as home address and
destination as care-of-address and forwards it.

You might also like