4th Unit

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 60

Network Layer Design Issues

Network layer comes up with certain design issues and they can be described as below:

1). Store-and-Forward Packet Switching


Here, the foremost elements are the carrier’s equipment (the connection between
routers through transmission lines) and the customer’s equipment.

store-and-
forward packet switching
 H1 has a direct connection with carrier router ‘A’, while H2 is connected to carrier
router ‘F’ on a LAN connection.
 One of the carrier router ‘F’, is pointed outside the carrier’s equipment as it does not
come under the carrier, whereas considered as protocols, software, and construction.
 This switching network performs as Transmission of data happens when the host
(H1) with a packet transfers it to the nearby router through LAN (or) point-to-point
connection to the carrier. The carrier stores the packet until it completely arrives thus
confirms the checksum.
 Then after, the packet is transmitted over the path until H2 is reached.
2). Services Provided to the Transport Layer
Through the network/transport layer interface, the network layer delivers its services to
the transport layer. One might come across the question of what type of services does
the network layer provides?

So, we shall move with the same query and find out the services offered.

Services offered by the network layer are outlined considering few objectives. Those
are:

 Offering services must not depend on router technology


 The transport layer needs to be protected from type, number and the topology of the
available routers.
 Network addressing the transport layer needs to follow a consistent numbering
scenario also at LAN and WAN connections.
Note: Next comes the scenario of connection-Oriented or connectionless
Here, two groupings are possible based on the offered services.

Connectionless – Here, routing and insertion of packets into subnet is accomplished


individually. No additional setup is necessary
Connection-Oriented – Subnet must offer reliable service and all the packets are
transmitted over a single route.
3). Implementation of Connectionless Service
In this scenario, packets are termed as datagrams and the corresponding subnet is
termed as datagram subnet. Routing in datagram subnet is as follows:

datagram subnet truth table


When the message size that has to be transmitted is 4 times the size of the packet, then
the network layer divides into 4 packets and then transmits each packet to router ‘A’
through a few protocols. Each router is provided with a routing table where it decides
the destination points.
In the above figure, it is clear that packets from ‘A’ need to be transmitted either to B or
C even when the destination is ‘F’. The routing table of ‘A’ is clearly outlined above.
Whereas in the case of packet 4, the packet from ‘A’ is routed to ‘B’, even the
destination node is ‘F’. Packet ‘A’ chooses to transmit packet 4 through a different path
than the initial three paths. This might happen because of traffic congestion along the
path ACE. So, the

4). Implementation of Connection-Oriented Service


Here, the functionality of connection-oriented service works on the virtual subnet. A
virtual subnet performs the operation of avoiding a new path for each packet
transmission. As a substitute for this, when there forms a connection, a route from a
source node to a destination node is selected and maintained in tables. This route
performs its action at the time of traffic congestion.

At the time when the connection is released, the virtual subnet also gets dismissed. In
this service, every packet carries its own identifier that states the exact address of the
virtual circuit. The below diagram shows the routing algorithm in the virtual subnet.
Routing Algorithms in Computer Networs -

Data is converted into packets in computer networks before being transferred from
source to destination. The network layer chooses the best path for data packet
transmission. The network layers provide a routing protocol, which is a routing algorithm
that determines the best and shortest path for transmitting data from source to
destination.

Routing algorithms are an essential component of computer networks. Without them,


data cannot flow between different parts of the network. This article will look at the
various types of routing algorithms and how they work.

What is Routing Algorithm?

A routing algorithm is a routing protocol determined by the network layer for transmitting
data packets from source to destination. This algorithm determines the best or least-
cost path for data transmission from sender/source to receiver/destination.

The network layer performs operations that effectively and efficiently regulate internet
traffic. In computer networks, this is known as a routing algorithm. It is used to
determine the best path or route mathematically.
Types of Routing Algorithms

Algorithms may be dynamic, where the routers make decisions based on information
they gather, and the routes change over time adaptively. Routing Algorithms can be
classified based on the following types.

 Static or Dynamic Routing


 Distributed or Centralized
 Single-path or Multi-path
 Flat or Hierarchical
 Intra Domain or Inter-Domain
 link State or Distance Vector

Further routing can be grouped into two categories: Non-adaptive routing


and Adaptive routing.

Non-adaptive Routing

Once the pathway to the destination has been selected, the router sends all packets for
that destination along that one route. The routing decisions are not made based on the
condition or topology of the network.

Examples: Centralized, Isolated, and Distributed Algorithms

Adaptive Routing

A router may select a new route for each packet (even packets belonging to the same
transmission) in response to changes in the condition and topology of the networks.

Examples: Flooding and Random Walk.

Routing Algorithms Examples


Algorithms may be static, where the routing decisions are made ahead of time, with
information about the network topology and capacity, then loaded into the routers.
Examples of Routing algorithms can be classified into shorting path routing, distance
vector routing, Link State Routing, Flooding Algorithm etc.

Shortest Path Routing

 Links between routers have a cost associated with them. It could be a function of
distance, bandwidth, average traffic, communication cost, mean queue length,
measured delay, router processing speed, etc.
 The shortest path algorithm finds the least expensive path through the network
based on the cost function.
 Examples: Dijkstra's algorithm

Distance Vector Routing

Each router periodically shares knowledge about the entire network with its neighbours
in this routing scheme. Each router has a table with information about the network.
These tables are updated by exchanging information with the immediate neighbours. It
is also known as Belman-Ford or Ford-Fulkerson Algorithm. It is used in the original
ARPANET and the Internet as RIP.

 Neighbouring nodes in the subnet exchange their tables periodically to update


each other on the state of the subnet (which makes this a dynamic algorithm). If
a neighbour claims to have a path to a node shorter than your path, you start
using that neighbour as the route to that node.
 Distance vector protocols (a vector contains both distance and direction), such as
RIP, determine the path to remote networks using hop count as the metric. A hop
count is defined as the number of times a packet needs to pass through a router
to reach a remote destination.
 For IP RIP, the maximum hop is 15. Therefore, a hop count of 16 indicates an
unreachable network. Two versions of RIP exist version 1 and version 2.
 IGRP is another example of a distance vector protocol with a higher hop count of
255 hops.
 Periodic updates are sent at a set interval. For IP RIP, this interval is 30 seconds.
 Updates are sent to the broadcast address 255.255.255.255. Only devices
running routing algorithms listen to these updates.
 When an update is sent, the entire routing table is sent.

Link State Routing

The following sequence of steps can be executed in the Link State Routing. This
advertising is a short pack called a Link State Packet (LSP). OSPF (Open shortest path
first) and IS-IS are examples of Link state routing. Link State Packet(LSP) contains the
following information:

1. The ID of the node that created the LSP;


2. A list of directly connected neighbours of that node, with the cost of the link to
each one;
3. A sequence number;
4. A time to live(TTL) for this packet.

When a router floods the network with information about its neighbourhood, it is said to
be advertising.

Signup for Free Mock Test


1. Discover your neighbours
2. Measure delay to your neighbours
3. Bundle all the information about your neighbours together
4. Send this information to all other routers in the subnet
5. Compute the shortest path to every router with the information you receive
6. Each router finds its own shortest path to the other routers using Dijkstra's
algorithm.

In link-state routing, each router shares its knowledge of its neighbourhood with all
routers in the network. Link-state protocols implement an algorithm called the shortest
path first (SPF, also known as Dijkstra's Algorithm) to determine the path to a remote
destination. There is no hop-count limit. (For an IP datagram, the maximum time to live
ensures that loops are avoided.).Only when changes occur, It sends all summary
information every 30 minutes by default. Only devices running routing algorithms listen
to these updates. Updates are sent to a multicast address. As a result, updates are
faster, and convergence times are reduced. Higher CPU and memory requirements to
maintain link-state databases. Link-state protocols maintain three separate tables.

1. Neighbour table: It contains a list of all neighbours and the interface to which
each neighbour is connected. Neighbours are formed by sending Hello packets.
2. Topology table (Link- State table): It contains a map of all links within an area,
including each link’s status.
3. Routing table: It contains the best routes to each particular destination

Flooding Algorithm

It is a non-adaptive algorithm or static algorithm. When a router receives a packet, it


sends a copy of the packet out on each line (except the one on which it arrived). Each
router decrements a hop count contained in the packet header to prevent looping
forever. As soon as the hop count decrements to zero, the router discards the packet.

Flow-Based Routing Algorithm

 It is a non-adaptive routing algorithm.


 It takes into account both the topology and the load in this routing algorithm;
 We can estimate the flow between all pairs of routers.
 You can compute the mean packet delays using queuing theory from the known
average amount of traffic and the average length of a packet.
 Flow-based routing then seeks to find a routing table to minimize the average
packet delay through the subnet.
 Given the line capacity and the flow, we can determine the delay. It needs to use
the formula for delay time T.
 Where, μ = Mean number of arrivals in packet/sec, 1/μ = The mean packet size
in the bits, and c = Line capacity (bits/s).

The Optimality Principle simply states that if router J is on the optimal path from the
router I to router k, then the optimal path from J to K also falls along this same path.

Candidates can also practice 110+ Mock tests for exams like GATE and NIELIT with
BYJU'S Exam Prep Test Series; check the following link

What is Congestion Control? Describe the Congestion Control Algorithm


commonly used
Congestion is an important issue that can arise in packet switched network.
Congestion is a situation in Communication Networks in which too many packets are
present in a part of the subnet, performance degrades. Congestion in a network may
occur when the load on the network (i.e. the number of packets sent to the network) is
greater than the capacity of the network (i.e. the number of packets a network can
handle.). Network congestion occurs in case of traffic overloading.

In other words when too much traffic is offered, congestion sets in and performance
degrades sharply
Causing of Congestion:

The various causes of congestion in a subnet are:


• The input traffic rate exceeds the capacity of the output lines. If suddenly, a stream of
packet start arriving on three or four input lines and all need the same output line. In
this case, a queue will be built up. If there is insufficient memory to hold all the packets,
the packet will be lost. Increasing the memory to unlimited size does not solve the
problem. This is because, by the time packets reach front of the queue, they have
already timed out (as they waited the queue). When timer goes off source transmits
duplicate packet that are also added to the queue. Thus same packets are added
again and again, increasing the load all the way to the
destination.

• The routers are too slow to perform bookkeeping tasks (queuing buffers, updating
tables, etc.).
• The routers’ buffer is too limited.
• Congestion in a subnet can occur if the processors are slow. Slow speed CPU at
routers will perform the routine tasks such as queuing buffers, updating table etc
slowly. As a result of this, queues are built up even though there is excess line
capacity.
• Congestion is also caused by slow links. This problem will be solved when high speed
links are used. But it is not always the case. Sometimes increase in link bandwidth can
further deteriorate the congestion problem as higher speed links may make the
network more unbalanced.Congestion can make itself worse. If a route!” does not have
free buffers, it start ignoring/discarding the newly arriving packets. When these packets
are discarded, the sender may retransmit them after the timer goes off. Such packets
are transmitted by the sender again and again until the source gets the
acknowledgement of these packets. Therefore multiple transmissions of packets will
force the congestion to take place at the sending end.
How to correct the Congestion Problem:

Congestion Control refers to techniques and mechanisms that can either prevent
congestion, before it happens, or remove congestion, after it has happened.
Congestion control mechanisms are divided into two categories, one category prevents
the congestion from happening and the other category removes congestion after it has
taken place.
These two categories are:
1. Open loop
2.Closedloop

Open Loop Congestion Control

• In this method, policies are used to prevent the congestion before it happens.
• Congestion control is handled either by the source or by the destination.
• The various methods used for open loop congestion control are:
Retransmission Policy
• The sender retransmits a packet, if it feels that the packet it has sent is lost or
corrupted.
• However retransmission in general may increase the congestion in the network. But
we need to implement good retransmission policy to prevent congestion.
• The retransmission policy and the retransmission timers need to be designed to
optimize efficiency and at the same time prevent the congestion.
Window Policy
• To implement window policy, selective reject window method is used for congestion
control.
• Selective Reject method is preferred over Go-back-n window as in Go-back-n
method, when timer for a packet times out, several packets are resent, although some
may have arrived safely at the receiver. Thus, this duplication may make congestion
worse.
• Selective reject method sends only the specific lost or damaged packets.
Acknowledgement Policy
• The acknowledgement policy imposed by the receiver may also affect congestion.
• If the receiver does not acknowledge every packet it receives it may slow down the
sender and help prevent congestion.
• Acknowledgments also add to the traffic load on the network. Thus, by sending fewer
acknowledgements we can reduce load on the network.
• To implement it, several approaches can be used:
1. A receiver may send an acknowledgement only if it has a packet to be sent.
2. A receiver may send an acknowledgement when a timer expires.
3. A receiver may also decide to acknowledge only N packets at a time.
Discarding Policy
• A router may discard less sensitive packets when congestion is likely to happen.
• Such a discarding policy may prevent congestion and at the same time may not harm
the integrity of the transmission.
Admission Policy
• An admission policy, which is a quality-of-service mechanism, can also prevent
congestion in virtual circuit networks.
• Switches in a flow first check the resource requirement of a flow before admitting it to
the network.
• A router can deny establishing a virtual circuit connection if there is congestion in the
“network or if there is a possibility of future congestion.
ClosedLoopCongestionControl

• Closed loop congestion control mechanisms try to remove the congestion after it
happens.
• The various methods used for closed loop congestion control are:
Backpressure
• Back pressure is a node-to-node congestion control that starts with a node and
propagates, in the opposite direction of data flow.
• The
backpressure technique can be applied only to virtual circuit networks. In such virtual
circuit each node knows the upstream node from which a data flow is coming.
• In this method of congestion control, the congested node stops receiving data from
the immediate upstream node or nodes.
• This may cause the upstream node on nodes to become congested, and they, in turn,
reject data from their upstream node or nodes.
• As shown in fig node 3 is congested and it stops receiving packets and informs its
upstream node 2 to slow down. Node 2 in turns may be congested and informs node 1
to slow down. Now node 1 may create congestion and informs the source node to slow
down. In this way the congestion is alleviated. Thus, the pressure on node 3 is moved
backward to the source to remove the congestion.

ChokePacket

• In this method of congestion control, congested router or node sends a special type of
packet called choke packet to the source to inform it about the congestion.
• Here, congested node does not inform its upstream node about the congestion as in
backpressure method.
• In choke packet method, congested node sends a warning directly to the source
station i.e. the intermediate nodes through which the packet has traveled are not
warned.

Implicit Signaling
• In implicit signaling, there is no communication between the congested node or nodes
and the source.
• The source guesses that there is congestion somewhere in the network when it does
not receive any acknowledgment. Therefore the delay in receiving an acknowledgment
is interpreted as congestion in the network.
• On sensing this congestion, the source slows down.
• This type of congestion control policy is used by TCP.
Explicit Signaling
• In this method, the congested nodes explicitly send a signal to the source or
destination to inform about the congestion.
• Explicit signaling is different from the choke packet method. In choke packed method,
a separate packet is used for this purpose whereas in explicit signaling method, the
signal is included in the packets that carry data .
• Explicit signaling can occur in either the forward direction or the backward direction .
• In backward signaling, a bit is set in a packet moving in the direction opposite to the
congestion. This bit warns the source about the congestion and informs the source to
slow down.
• In forward signaling, a bit is set in a packet moving in the direction of congestion. This
bit warns the destination about the congestion. The receiver in this case uses policies
such as slowing down the acknowledgements to remove the congestion.
Congestion control algorithms

Leaky Bucket Algorithm

• It is a traffic shaping mechanism that controls the amount and the rate of the traffic
sent to the network.
• A leaky bucket algorithm shapes bursty traffic into fixed rate traffic by averaging the
data rate.
• Imagine a bucket with a small hole at the bottom.
• The rate at which the water is poured into the bucket is not fixed and can vary but it
leaks from the bucket at a constant rate. Thus (as long as water is present in bucket),
the rate at which the water leaks does not depend on the rate at which the water is
input to the bucket.
• Also, when the
bucket is full, any additional water that enters into the bucket spills over the sides and
is lost.
• The same concept can be applied to packets in the network. Consider that data is
coming from the source at variable speeds. Suppose that a source sends data at 12
Mbps for 4 seconds. Then there is no data for 3 seconds. The source again transmits
data at a rate of 10 Mbps for 2 seconds. Thus, in a time span of 9 seconds, 68 Mb data
has been transmitted.
If a leaky bucket algorithm is used, the data flow will be 8 Mbps for 9 seconds. Thus
constant flow is maintained.
Token bucket Algorithm

• The leaky bucket algorithm allows only an average (constant) rate of data flow. Its
major problem is that it cannot deal with bursty data.
• A leaky bucket algorithm does not consider the idle time of the host. For example, if
the host was idle for 10 seconds and now it is willing to sent data at a very high speed
for another 10 seconds, the total data transmission will be divided into 20 seconds and
average data rate will be maintained. The host is having no advantage of sitting idle for
10 seconds.
• To overcome this problem, a token bucket algorithm is used. A token bucket
algorithm allows bursty data transfers.
• A token bucket algorithm is a modification of leaky bucket in which leaky bucket
contains tokens.
• In this algorithm, a token(s) are generated at every clock tick. For a packet to be
transmitted, system must remove token(s) from the bucket.
• Thus, a token bucket algorithm allows idle hosts to accumulate credit for the future in
form of tokens.
• For example, if a system generates 100 tokens in one clock tick and the host is idle
for 100 ticks. The bucket will contain 10,000 tokens.
Now, if the host wants to send bursty data, it can consume all 10,000 tokens at once
for sending 10,000 cells or bytes.
Thus a host can send bursty data as long as bucket is not empty.

What is IPv4 Address and What is its Role in the Network?


IPv4 or Internet Protocol version 4, address is a 32-bit string of numbers separated by
periods. It uniquely identifies a network interface in a device. IP is a part of the TCP/IP
(Transmission Control Protocol/Internet Protocol) suite, where IP is the principal set of
rules for communication on the Internet. An IP address is needed to be allocated on the
devices, such as PCs, printers, servers, routers, switches, etc., to be able to
communicate with each other in the network and out the Internet.

IPv4 Address Format

IPv4 addresses are expressed as a set of four numbers in decimal format, and each set
is separated by a dot. Thus, the term ‘dotted decimal format.’ Each set is called an
‘octet’ because a set is composed of 8 bits. The figure below shows the binary format of
each octet in the 192.168.10.100 IP address:
A number in an octet can range from 0 to 255. Therefore, the full IPv4 address space
goes from 0.0.0.0 to 255.255.255.255. The IPv4 address has two parts, the network
part and the host part. A subnet mask is used to identify these parts.

Network Part
The network part of the IPv4 address is on the left-hand side of the IP address. It
specifies the particular network to where the IPv4 address belongs. The network portion
of the address also identifies the IP address class of the IPv4 address.
For example, we have the IPv4 address 192.168.10.100 and a /24 subnet mask. /24
simply means that the first 24 bits, starting from the left side, is the network portion of
the IPv4 address. The 8 remaining bits of the 32 bits will be the host portion.

Host Part
The host portion of the IPv4 address uniquely identifies the device or the interface on
your network. Hosts that have the same network portion can communicate with one
another directly, without the need for the traffic to be routed.

IPv4 Address Allocation

The Internet Protocol address can be allocated to hosts or interfaces either manually or
dynamically.

 Static – static IP address is set manually on the device. It is best practice to set static IP
addresses on network devices, such as routers and switches, and on servers as well.
 Dynamic – dynamic IP address can be automatically allocated to a device via Dynamic
Host Configuration Protocol (DHCP). Dynamic IP addresses are best to be used on end
devices, such as PCs.
Types of IPv4 Addresses

We have two types of IP addresses, namely public IP addresses and private IP


addresses.

 Public IP address – used to route Internet traffic. This is used on the Internet and is
given out by Internet Service Providers (ISPs) to their customers.
 Private IP address – used in private networks for internal traffics within the LAN.
Private addresses are not routable out the Internet.
 Internet Protocol hierarchy contains several classes of IP Addresses to be used
efficiently in various situations as per the requirement of hosts per network.
Broadly, the IPv4 Addressing system is divided into five classes of IP Addresses.
All the five classes are identified by the first octet of IP Address.
 Internet Corporation for Assigned Names and Numbers is responsible for
assigning IP addresses.
 The first octet referred here is the left most of all. The octets numbered as follows
depicting dotted decimal notation of IP Address −

 The number of networks and the number of hosts per class can be derived by
this formula −

 When calculating hosts' IP addresses, 2 IP addresses are decreased because


they cannot be assigned to hosts, i.e. the first IP of a network is network number
and the last IP is reserved for Broadcast IP.
 Class A Address
 The first bit of the first octet is always set to 0 (zero). Thus the first octet ranges
from 1 – 127, i.e.


 Class A addresses only include IP starting from 1.x.x.x to 126.x.x.x only. The IP
range 127.x.x.x is reserved for loopback IP addresses.
 The default subnet mask for Class A IP address is 255.0.0.0 which implies that
Class A addressing can have 126 networks (27-2) and 16777214 hosts (224-2).
 Class A IP address format is
thus: 0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH
 Class B Address
 An IP address which belongs to class B has the first two bits in the first octet set
to 10, i.e.

 Class B IP Addresses range from 128.0.x.x to 191.255.x.x. The default subnet


mask for Class B is 255.255.x.x.
 Class B has 16384 (214) Network addresses and 65534 (216-2) Host addresses.
 Class B IP address format
is: 10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH
 Class C Address
 The first octet of Class C IP address has its first 3 bits set to 110, that is −

 Class C IP addresses range from 192.0.0.x to 223.255.255.x. The default subnet


mask for Class C is 255.255.255.x.
 Class C gives 2097152 (221) Network addresses and 254 (28-2) Host addresses.
 Class C IP address format
is: 110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH
 Class D Address
 Very first four bits of the first octet in Class D IP addresses are set to 1110, giving
a range of −

 Class D has IP address range from 224.0.0.0 to 239.255.255.255. Class D is


reserved for Multicasting. In multicasting data is not destined for a particular host,
that is why there is no need to extract host address from the IP address, and
Class D does not have any subnet mask.
 Class E Address
 This IP Class is reserved for experimental purposes only for R&D or Study. IP
addresses in this class ranges from 240.0.0.0 to 255.255.255.254. Like Class D,
this class too is not equipped with any subnet mask.
Introduction To Subnetting
When a bigger network is divided into smaller networks, to maintain security, then that is known
as Subnetting. So, maintenance is easier for smaller networks. For example, if we consider a
class A address, the possible number of hosts is 224 for each network, it is obvious that it is
difficult to maintain such a huge number of hosts, but it would be quite easier to maintain if we
divide the network into small parts.

Example-

Following diagram shows the subnetting of a big single network into 4 smaller subnets-

Advantages-

The two main advantages of subnetting a network are-


 It improves the security.
 The maintenance and administration of subnets is easy.

Subnet ID-

 Each subnet has its unique network address known as its Subnet ID.
 The subnet ID is created by borrowing some bits from the Host ID part of the IP
Address.
 The number of bits borrowed depends on the number of subnets created.

Types of Subnetting-

Subnetting of a network may be carried out in the following two ways-

1. Fixed Length Subnetting


2. Variable Length Subnetting

1. Fixed Length Subnetting-

Fixed length subnetting also called as classful subnetting divides the network into
subnets where-
 All the subnets are of same size.
 All the subnets have equal number of hosts.
 All the subnets have same subnet mask.

2. Variable Length Subnetting-

Variable length subnetting also called as classless subnetting divides the network into
subnets where-
 All the subnets are not of same size.
 All the subnets do not have equal number of hosts.
 All the subnets do not have same subnet mask.
Subnetting Examples-

Now, we shall discuss some examples of subnetting a network-

Example-01:

Consider-
 We have a big single network having IP Address 200.1.2.0.
 We want to do subnetting and divide this network into 2 subnets.

Clearly, the given network belongs to class C.

Also Read- Classes of IP Address

For creating two subnets and to represent their subnet IDs, we require 1 bit.
So,
 We borrow one bit from the Host ID part.
 After borrowing one bit, Host ID part remains with only 7 bits.
 If borrowed bit = 0, then it represents the first subnet.
 If borrowed bit = 1, then it represents the second subnet.

IP Address of the two subnets are-


 200.1.2.00000000 = 200.1.2.0
 200.1.2.10000000 = 200.1.2.128

For 1st Subnet-

 IP Address of the subnet = 200.1.2.0


 Total number of IP Addresses = 27 = 128
 Total number of hosts that can be configured = 128 – 2 = 126
 Range of IP Addresses = [200.1.2.00000000, 200.1.2.01111111] = [200.1.2.0,
200.1.2.127]
 Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
 Limited Broadcast Address = 255.255.255.255

For 2nd Subnet-

 IP Address of the subnet = 200.1.2.128


 Total number of IP Addresses = 27 = 128
 Total number of hosts that can be configured = 128 – 2 = 126
 Range of IP Addresses = [200.1.2.10000000, 200.1.2.11111111] = [200.1.2.128,
200.1.2.255]
 Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
 Limited Broadcast Address = 255.255.255.255

Example-02:

Consider-
 We have a big single network having IP Address 200.1.2.0.
 We want to do subnetting and divide this network into 4 subnets.

Clearly, the given network belongs to class C.

For creating four subnets and to represent their subnet IDs, we require 2 bits.
So,
 We borrow two bits from the Host ID part.
 After borrowing two bits, Host ID part remains with only 6 bits.
 If borrowed bits = 00, then it represents the 1st subnet.
 If borrowed bits = 01, then it represents the 2nd subnet.
 If borrowed bits = 10, then it represents the 3rd subnet.
 If borrowed bits = 11, then it represents the 4th subnet.

IP Address of the four subnets are-


 200.1.2.00000000 = 200.1.2.0
 200.1.2.01000000 = 200.1.2.64
 200.1.2.10000000 = 200.1.2.128
 200.1.2.11000000 = 200.1.2.192

For 1st Subnet-


 IP Address of the subnet = 200.1.2.0
 Total number of IP Addresses = 26 = 64
 Total number of hosts that can be configured = 64 – 2 = 62
 Range of IP Addresses = [200.1.2.00000000, 200.1.2.00111111] = [200.1.2.0,
200.1.2.63]
 Direct Broadcast Address = 200.1.2.00111111 = 200.1.2.63
 Limited Broadcast Address = 255.255.255.255

For 2nd Subnet-

 IP Address of the subnet = 200.1.2.64


 Total number of IP Addresses = 26 = 64
 Total number of hosts that can be configured = 64 – 2 = 62
 Range of IP Addresses = [200.1.2.01000000, 200.1.2.01111111] = [200.1.2.64,
200.1.2.127]
 Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
 Limited Broadcast Address = 255.255.255.255

For 3rd Subnet-

 IP Address of the subnet = 200.1.2.128


 Total number of IP Addresses = 26 = 64
 Total number of hosts that can be configured = 64 – 2 = 62
 Range of IP Addresses = [200.1.2.10000000, 200.1.2.10111111] = [200.1.2.128,
200.1.2.191]
 Direct Broadcast Address = 200.1.2.10111111 = 200.1.2.191
 Limited Broadcast Address = 255.255.255.255

For 4th Subnet-

 IP Address of the subnet = 200.1.2.192


 Total number of IP Addresses = 26 = 64
 Total number of hosts that can be configured = 64 – 2 = 62
 Range of IP Addresses = [200.1.2.11000000, 200.1.2.11111111] = [200.1.2.192,
200.1.2.255]
 Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
 Limited Broadcast Address = 255.255.255.255
Example-03:

Consider-
 We have a big single network having IP Address 200.1.2.0.
 We want to do subnetting and divide this network into 3 subnets.

Here, the subnetting will be performed in two steps-


1. Dividing the given network into 2 subnets
2. Dividing one of the subnets further into 2 subnets

Step-01: Dividing Given Network into 2 Subnets-

The subnetting will be performed exactly in the same way as performed in Example-01.
After subnetting, we have-

Step-02: Dividing One Subnet into 2 Subnets-

 We perform the subnetting of one of the subnets further into 2 subnets.


 Consider we want to do subnetting of the 2nd subnet having IP Address 200.1.2.128.

For creating two subnets and to represent their subnet IDs, we require 1 bit.
So,
 We borrow one more bit from the Host ID part.
 After borrowing one bit, Host ID part remains with only 6 bits.

 If 2nd borrowed bit = 0, then it represents one subnet.


 If 2nd borrowed bit = 1, then it represents the other subnet.

IP Address of the two subnets are-


 200.1.2.10000000 = 200.1.2.128
 200.1.2.11000000 = 200.1.2.192

Finally, the given single network is divided into 3 subnets having IP Address-
 200.1.2.0
 200.1.2.128
 200.1.2.192
For 1st Subnet-

 IP Address of the subnet = 200.1.2.0


 Total number of IP Addresses = 27 = 128
 Total number of hosts that can be configured = 128 – 2 = 126
 Range of IP Addresses = [200.1.2.00000000, 200.1.2.01111111] = [200.1.2.0,
200.1.2.127]
 Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
 Limited Broadcast Address = 255.255.255.255

For 2nd Subnet-

 IP Address of the subnet = 200.1.2.128


 Total number of IP Addresses = 26 = 64
 Total number of hosts that can be configured = 64 – 2 = 62
 Range of IP Addresses = [200.1.2.10000000, 200.1.2.10111111] = [200.1.2.128,
200.1.2.191]
 Direct Broadcast Address = 200.1.2.10111111 = 200.1.2.191
 Limited Broadcast Address = 255.255.255.255

For 3rd Subnet-

 IP Address of the subnet = 200.1.2.192


 Total number of IP Addresses = 26 = 64
 Total number of hosts that can be configured = 64 – 2 = 62
 Range of IP Addresses = [200.1.2.11000000, 200.1.2.11111111] = [200.1.2.192,
200.1.2.255]
 Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
 Limited Broadcast Address = 255.255.255.255

Disadvantages of Subnetting-

Point-01:

Subnetting leads to loss of IP Addresses.


During subnetting,
 We have to face a loss of IP Addresses.
 This is because two IP Addresses are wasted for each subnet.
 One IP address is wasted for its network address.
 Other IP Address is wasted for its direct broadcasting address.

Point-02:

Subnetting leads to complicated communication process.

After subnetting, the communication process becomes complex involving the following 4
steps-
1. Identifying the network
2. Identifying the sub network
3. Identifying the host
4. Identifying the process

PRACTICE PROBLEMS BASED ON SUBNETTING IN NETWORKING-

Problem-01:

Suppose a network with IP Address 192.16.0.0. is divided into 2 subnets, find number of
hosts per subnet.
Also for the first subnet, find-
1. Subnet Address
2. First Host ID
3. Last Host ID
4. Broadcast Address

Solution-

 Given IP Address belongs to class C.


 So, 24 bits are reserved for the Net ID.
 The given network is divided into 2 subnets.
 So, 1 bit is borrowed from the host ID part for the subnet IDs.
 Then, Number of bits remaining for the Host ID = 7.
 Thus, Number of hosts per subnet = 27 = 128.

For 1st Subnet-

 Subnet Address = First IP Address = 192.16.0.00000000 = 172.16.0.0


 First Host ID = 192.16.0.00000001 = 192.16.0.1
 Last Host ID = 192.16.0.01111110 = 192.16.0.126
 Broadcast Address = Last IP Address = 192.16.0.01111111 = 172.16.0.127

Problem-02:

What is not true about subnetting?


1. It is applied for a single network
2. It is used to improve security
3. Bits are borrowed from network portion
4. Bits are borrowed from Host portion

Solution-

Clearly, Option (C) is correct.

Problem-03:

In a class B, network on the internet has a subnet mask of 255.255.240.0. What is the
maximum number of hosts per subnet?
1. 4096
2. 4094
3. 4092
4. 4090

Solution-

 Number of bits reserved for network ID in the given subnet mask = 20.
 So, Number of bits reserved for Host ID = 32 – 20 = 12 bits.
 Thus, Number of hosts per subnet = 212 – 2 = 4094.
 In class B, 16 bits are reserved for the network.
 So, Number of bits reserved for subnet ID = 20 – 16 = 4 bits.
 Number of subnets possible = 24 = 16.
 Thus, Option (B) is correct.

Classless Addressing-

 Classless Addressing is an improved IP Addressing system.


 It makes the allocation of IP Addresses more efficient.
 It replaces the older classful addressing system based on classes.
 It is also known as Classless Inter Domain Routing (CIDR).

CIDR Block-

When a user asks for specific number of IP Addresses,


 CIDR dynamically assigns a block of IP Addresses based on certain rules.
 This block contains the required number of IP Addresses as demanded by the user.
 This block of IP Addresses is called as a CIDR block.

Rules For Creating CIDR Block-

A CIDR block is created based on the following 3 rules-

Rule-01:

 All the IP Addresses in the CIDR block must be contiguous.

Rule-02:

 The size of the block must be presentable as power of 2.


 Size of the block is the total number of IP Addresses contained in the block.
 Size of any CIDR block will always be in the form 21, 22, 23, 24, 25 and so on.
Rule-03:

 First IP Address of the block must be divisible by the size of the block.

REMEMBER

If any binary pattern consisting of (m + n) bits is divided by 2n, then-


 Remainder is least significant n bits
 Quotient is most significant m bits

So, any binary pattern is divisible by 2n, if and only if its least significant n
bits are 0.

Examples-

Consider a binary pattern-


01100100.00000001.00000010.01000000
(represented as 100.1.2.64)
 It is divisible by 25 since its least significant 5 bits are zero.
 It is divisible by 26 since its least significant 6 bits are zero.
 It is not divisible by 27 since its least significant 7 bits are not zero.

CIDR Notation-

CIDR IP Addresses look like-


a.b.c.d / n

 They end with a slash followed by a number called as IP network prefix.


 IP network prefix tells the number of bits used for the identification of network.
 Remaining bits are used for the identification of hosts in the network.

Example-
An example of CIDR IP Address is-
182.0.1.2 / 28

It suggests-
 28 bits are used for the identification of network.
 Remaining 4 bits are used for the identification of hosts in the network.

PRACTICE PROBLEMS BASED ON CLASSLESS INTER DOMAIN ROUTING-

Problem-01:

Given the CIDR representation 20.10.30.35 / 27. Find the range of IP Addresses in the
CIDR block.

Solution-

Given CIDR representation is 20.10.30.35 / 27.

It suggests-
 27 bits are used for the identification of network.
 Remaining 5 bits are used for the identification of hosts in the network.

Given CIDR IP Address may be represented as-


00010100.00001010.00011110.00100011 / 27

So,
 First IP Address = 00010100.00001010.00011110.00100000 = 20.10.30.32
 Last IP Address = 00010100.00001010.00011110.00111111 = 20.10.30.63

Thus, Range of IP Addresses = [ 20.10.30.32 , 20.10.30.63]

Problem-02:
Given the CIDR representation 100.1.2.35 / 20. Find the range of IP Addresses in the
CIDR block.

Solution-

Given CIDR representation is 100.1.2.35 / 20.

It suggests-
 20 bits are used for the identification of network.
 Remaining 12 bits are used for the identification of hosts in the network.

Given CIDR IP Address may be represented as-


01100100.00000001.00000010.00100011 / 20

So,
 First IP Address = 01100100.00000001.00000000.00000000 = 100.1.0.0
 Last IP Address = 01100100.00000001.00001111.11111111 = 100.1.15.255

Thus, Range of IP Addresses = [ 100.1.0.0 , 100.1.15.255]

Problem-03:

Consider a block of IP Addresses ranging from 100.1.2.32 to 100.1.2.47.


1. Is it a CIDR block?
2. If yes, give the CIDR representation.

Solution-

For any given block to be a CIDR block, 3 rules must be satisfied-

Rule-01:

 According to Rule-01, all the IP Addresses must be contiguous.


 Clearly, all the given IP Addresses are contiguous.
 So, Rule-01 is satisfied.

Rule-02:

 According to Rule-02, size of the block must be presentable as 2n.


 Number of IP Addresses in the given block = 47 – 32 + 1 = 16.
 Size of the block = 16 which can be represented as 24.
 So, Rule-02 is satisfied.

Rule-03:

 According to Rule-03, first IP Address must be divisible by size of the block.


 So, 100.1.2.32 must be divisible by 24.
 100.1.2.32 = 100.1.2.00100000 is divisible by 24 since its 4 least significant bits are
zero.
 So, Rule-03 is satisfied.

Since all the rules are satisfied, therefore given block is a CIDR block.

CIDR Representation-

We have-
 Size of the block = Total number of IP Addresses = 24.
 To have 24 total number of IP Addresses, total 4 bits are required in the Host ID part.
 So, Number of bits present in the Network ID part = 32 – 4 = 28.

Thus,

CIDR Representation = 100.1.2.32 / 28

NOTE-

For writing the CIDR representation,


 We can choose to mention any IP Address from the CIDR block.
 The chosen IP Address is followed by a slash and IP network prefix.
 We generally choose to mention the first IP Address.

Problem-04:

Consider a block of IP Addresses ranging from 150.10.20.64 to 150.10.20.127.


1. Is it a CIDR block?
2. If yes, give the CIDR representation.

Solution-

For any given block to be a CIDR block, 3 rules must be satisfied-

Rule-01:

 According to Rule-01, all the IP Addresses must be contiguous.


 Clearly, all the given IP Addresses are contiguous.
 So, Rule-01 is satisfied.

Rule-02:

 According to Rule-02, size of the block must be presentable as 2n.


 Number of IP Addresses in given block = 127 – 64 + 1 = 64.
 Size of the block = 64 which can be represented as 26.
 So, Rule-02 is satisfied.

Rule-03:

 According to Rule-03, first IP Address must be divisible by size of the block.


 So, 150.10.20.64 must be divisible by 26.
 150.10.20.64 = 150.10.20.01000000 is divisible by 26 since its 6 least significant bits
are zero.
 So, Rule-03 is satisfied.

Since all the rules are satisfied, therefore given block is a CIDR block.
CIDR Representation-

We have-
 Size of the block = Total number of IP Addresses = 26.
 To have 26 total number of IP Addresses, 6 bits are required in the Host ID part.
 So, Number of bits in the Network ID part = 32 – 6 = 26.

Thus,

CIDR Representation = 150.10.20.64 / 26

Problem-05:

Perform CIDR aggregation on the following IP Addresses-


128.56.24.0/24
128.56.25.0/24
128.56.26.0/24
128.56.27.0/24

Solution-

All the 4 given entities represent CIDR block in itself.


We have to now perform the aggregation of these 4 blocks.

Rule-01:

 According to Rule-01, all the IP Addresses must be contiguous.


 Clearly, all the IP Addresses are contiguous.
 So, Rule-01 is satisfied.

Rule-02:
 According to Rule-02, size of the block must be presentable as 2n.
 Total number of IP Addresses = 28 + 28 + 28 + 28 = 22 x 28 = 210.
 So, Rule-02 is satisfied.

Rule-03:

 According to Rule-03, first IP Address must be divisible by size of the block.


 So, 128.56.24.0 must be divisible by 210.
 128.56.24.0 = 128.56.00011000.00000000 is divisible by 210 since its 10 least
significant bits are zero.
 So, Rule-03 is satisfied.

Since all the 3 rules are satisfied, so they can be aggregated.

CIDR Representation-

We have-
 Size of the block = Total number of IP Addresses = 210.
 To have 210 total number of IP Addresses, 10 bits are required in the Host ID part.
 So, Number of bits in the Network ID part = 32 – 10 = 22.

Thus,

CIDR Representation = 128.56.24.0/22

Problem-06:

Perform CIDR aggregation on the following IP Addresses-


200.96.86.0/24
200.96.87.0/24
200.96.88.0/24
200.96.89.0/24
Solution-

All the 4 given entities represent CIDR block in itself.


We have to now perform the aggregation of these 4 blocks.

Rule-01:

 According to Rule-01, all the IP Addresses must be contiguous.


 Clearly, all the IP Addresses are contiguous.
 So, Rule-01 is satisfied.

Rule-02:

 According to Rule-02, size of the block must be presentable as 2n.


 Total number of IP Addresses = 28 + 28 + 28 + 28 = 22 x 28 = 210.
 So, Rule-02 is satisfied.

Rule-03:

 According to Rule-03, first IP Address must be divisible by size of the block.


 So, 200.96.86.0 must be divisible by 210.
 200.96.86.0 = 200.96.01010110.00000000 is not divisible by 210 since its 10 least
significant bits are not zero.
 So, Rule-03 is unsatisfied.

Since all the 3 rules are not satisfied, so they can not be aggregated.

To gain better understanding about Classless Addressing,


Internet Protocol Version 4-

 IPv4 short for Internet Protocol Version 4 is the fourth version of the Internet
Protocol (IP).
 IP is responsible to deliver data packets from the source host to the destination host.
 This delivery is solely based on the IP Addresses in the packet headers.
 IPv4 is the first major version of IP.
 IPv4 is a connectionless protocol for use on packet-switched networks.

In this article, we will discuss about IPv4 Header.

IPv4 Header-

The following diagram represents the IPv4 header-

Let us discuss each field of IPv4 header one by one.

1. Version-

 Version is a 4 bit field that indicates the IP version used.


 The most popularly used IP versions are version-4 (IPv4) and version-6 (IPv6).
 Only IPv4 uses the above header.
 So, this field always contains the decimal value 4.

2. Header Length-

 Header length is a 4 bit field that contains the length of the IP header.
 It helps in knowing from where the actual data begins.

Minimum And Maximum Header Length-

The length of IP header always lies in the range-


[20 bytes , 60 bytes]

 The initial 5 rows of the IP header are always used.


 So, minimum length of IP header = 5 x 4 bytes = 20 bytes.
 The size of the 6th row representing the Options field vary.
 The size of Options field can go up to 40 bytes.
 So, maximum length of IP header = 20 bytes + 40 bytes = 60 bytes.

Concept of Scaling Factor-

 Header length is a 4 bit field.


 So, the range of decimal values that can be represented is [0, 15].
 But the range of header length is [20, 60].
 So, to represent the header length, we use a scaling factor of 4.

In general,

Header length = Header length field value x 4 bytes


Examples-

 If header length field contains decimal value 5 (represented as 0101), then-


Header length = 5 x 4 = 20 bytes
 If header length field contains decimal value 10 (represented as 1010), then-
Header length = 10 x 4 = 40 bytes
 If header length field contains decimal value 15 (represented as 1111), then-
Header length = 15 x 4 = 60 bytes

3. Type Of Service-

 Type of service is a 8 bit field that is used for Quality of Service (QoS).
 The datagram is marked for giving a certain treatment using this field.

4. Total Length-

 Total length is a 16 bit field that contains the total length of the datagram (in bytes).

Total length = Header length + Payload length

 Minimum total length of datagram = 20 bytes (20 bytes header + 0 bytes data)
 Maximum total length of datagram = Maximum value of 16 bit word = 65535 bytes

5. Identification-

 Identification is a 16 bit field.


 It is used for the identification of the fragments of an original IP datagram.

When an IP datagram is fragmented,


 Each fragmented datagram is assigned the same identification number.
 This number is useful during the re assembly of fragmented datagrams.
 It helps to identify to which IP datagram, the fragmented datagram belongs to.
6. DF Bit-

 DF bit stands for Do Not Fragment bit.


 Its value may be 0 or 1.

When DF bit is set to 0,


 It grants the permission to the intermediate devices to fragment the datagram if
required.

When DF bit is set to 1,


 It indicates the intermediate devices not to fragment the IP datagram at any cost.
 If network requires the datagram to be fragmented to travel further but settings does
not allow its fragmentation, then it is discarded.
 An error message is sent to the sender saying that the datagram has been discarded
due to its settings.

7. MF Bit-

 MF bit stands for More Fragments bit.


 Its value may be 0 or 1.

When MF bit is set to 0,


 It indicates to the receiver that the current datagram is either the last fragment in the
set or that it is the only fragment.

When MF bit is set to 1,


 It indicates to the receiver that the current datagram is a fragment of some larger
datagram.
 More fragments are following.
 MF bit is set to 1 on all the fragments except the last one.

8. Fragment Offset-

 Fragment Offset is a 13 bit field.


 It indicates the position of a fragmented datagram in the original unfragmented IP
datagram.
 The first fragmented datagram has a fragment offset of zero.

Fragment offset for a given fragmented datagram


= Number of data bytes ahead of it in the original unfragmented datagram

Concept Of Scaling Factor-

 We use a scaling factor of 8 for the fragment offset.


 Fragment offset field value = Fragment Offset / 8

9. Time To Live-

 Time to live (TTL) is a 8 bit field.


 It indicates the maximum number of hops a datagram can take to reach the
destination.
 The main purpose of TTL is to prevent the IP datagrams from looping around forever
in a routing loop.

The value of TTL is decremented by 1 when-


 Datagram takes a hop to any intermediate device having network layer.
 Datagram takes a hop to the destination.

If the value of TTL becomes zero before reaching the destination, then datagram is
discarded.

10. Protocol-

 Protocol is a 8 bit field.


 It tells the network layer at the destination host to which protocol the IP datagram
belongs to.
 In other words, it tells the next level protocol to the network layer at the destination
side.
 Protocol number of ICMP is 1, IGMP is 2, TCP is 6 and UDP is 17.

11. Header Checksum-

 Header checksum is a 16 bit field.


 It contains the checksum value of the entire header.
 The checksum value is used for error checking of the header.

At each hop,
 The header checksum is compared with the value contained in this field.
 If header checksum is found to be mismatched, then the datagram is discarded.
 Router updates the checksum field whenever it modifies the datagram header.

12. Source IP Address-

 Source IP Address is a 32 bit field.


 It contains the logical address of the sender of the datagram.

13. Destination IP Address-

 Destination IP Address is a 32 bit field.


 It contains the logical address of the receiver of the datagram.

14. Options-

 Options is a field whose size vary from 0 bytes to 40 bytes.


 This field is used for several purposes such as-
1. Record route
2. Source routing
3. Padding

1. Record Route-

 A record route option is used to record the IP Address of the routers through which the
datagram passes on its way.
 When record route option is set in the options field, IP Address of the
router gets recorded in the Options field.

2. Source Routing-

 A source routing option is used to specify the route that the datagram must take to
reach the destination.
 This option is generally used to check whether a certain path is working fine or not.
 Source routing may be loose or strict.

3. Padding-

 Addition of dummy data to fill up unused space in the transmission unit and make it
conform to the standard size is called as padding.
 Options field is used for padding.

Example-

 When header length is not a multiple of 4, extra zeroes are padded in the Options
field.
 By doing so, header length becomes a multiple of 4.
 If header length = 30 bytes, 2 bytes of dummy data is added to the header.
 This makes header length = 32 bytes.
 Then, the value 32 / 4 = 8 is put in the header length field.
 In worst case, 3 bytes of dummy data might have to be padded to make the header
length a multiple of 4.
IPv6 - Headers
The wonder of IPv6 lies in its header. An IPv6 address is 4 times larger than IPv4, but
surprisingly, the header of an IPv6 address is only 2 times larger than that of IPv4. IPv6
headers have one Fixed Header and zero or more Optional (Extension) Headers. All the
necessary information that is essential for a router is kept in the Fixed Header. The
Extension Header contains optional information that helps routers to understand how to
handle a packet/flow.
Fixed Header

[Image:
IPv6 Fixed Header]

IPv6 fixed header is 40 bytes long and contains the following information.

S.N. Field & Description

1 Version (4-bits): It represents the version of Internet Protocol, i.e. 0110.

2 Traffic Class (8-bits): These 8 bits are divided into two parts. The most
significant 6 bits are used for Type of Service to let the Router Known
what services should be provided to this packet. The least significant 2
bits are used for Explicit Congestion Notification (ECN).

3 Flow Label (20-bits): This label is used to maintain the sequential flow of
the packets belonging to a communication. The source labels the
sequence to help the router identify that a particular packet belongs to a
specific flow of information. This field helps avoid re-ordering of data
packets. It is designed for streaming/real-time media.

4 Payload Length (16-bits): This field is used to tell the routers how much
information a particular packet contains in its payload. Payload is
composed of Extension Headers and Upper Layer data. With 16 bits, up
to 65535 bytes can be indicated; but if the Extension Headers contain
Hop-by-Hop Extension Header, then the payload may exceed 65535
bytes and this field is set to 0.

5 Next Header (8-bits): This field is used to indicate either the type of
Extension Header, or if the Extension Header is not present then it
indicates the Upper Layer PDU. The values for the type of Upper Layer
PDU are same as IPv4’s.

6 Hop Limit (8-bits): This field is used to stop packet to loop in the network
infinitely. This is same as TTL in IPv4. The value of Hop Limit field is
decremented by 1 as it passes a link (router/hop). When the field reaches
0 the packet is discarded.

7 Source Address (128-bits): This field indicates the address of originator


of the packet.

8 Destination Address (128-bits): This field provides the address of


intended recipient of the packet.

Extension Headers
In IPv6, the Fixed Header contains only that much information which is necessary,
avoiding those information which is either not required or is rarely used. All such
information is put between the Fixed Header and the Upper layer header in the form of
Extension Headers. Each Extension Header is identified by a distinct value.
When Extension Headers are used, IPv6 Fixed Header’s Next Header field points to the
first Extension Header. If there is one more Extension Header, then the first Extension
Header’s ‘Next-Header’ field points to the second one, and so on. The last Extension
Header’s ‘Next-Header’ field points to the Upper Layer Header. Thus, all the headers
points to the next one in a linked list manner.
If the Next Header field contains the value 59, it indicates that there are no headers
after this header, not even Upper Layer Header.
The following Extension Headers must be supported as per RFC 2460:
The sequence of Extension Headers should be:

These headers:
 1. should be processed by First and subsequent destinations.
 2. should be processed by Final Destination.
Extension Headers are arranged one after another in a linked list manner, as depicted
in the following diagram:

Transition From IPv4 to IPv6


Complete transition from IPv4 to IPv6 might not be possible because IPv6 is not
backward compatible. This results in a situation where either a site is on IPv6 or it is not.
It is unlike implementation of other new technologies where the newer one is backward
compatible so the older system can still work with the newer version without any
additional changes.
To overcome this short-coming, we have a few technologies that can be used to ensure
slow and smooth transition from IPv4 to IPv6.
Dual Stack Routers
A router can be installed with both IPv4 and IPv6 addresses configured on its interfaces
pointing to the network of relevant IP scheme.

[Image: Dual
Stack Router]

In the above diagram, a server having IPv4 as well as IPv6 address configured for it can
now speak with all the hosts on both the IPv4 as well as the IPv6 networks with the help
of a Dual Stack Router. The Dual Stack Router, can communicate with both the
networks. It provides a medium for the hosts to access a server without changing their
respective IP versions.
Tunneling
In a scenario where different IP versions exist on intermediate path or transit networks,
tunneling provides a better solution where user’s data can pass through a non-
supported IP version.

[Image:
Tunneling]

The above diagram depicts how two remote IPv4 networks can communicate via a
Tunnel, where the transit network was on IPv6. Vice versa is also possible where the
transit network is on IPv6 and the remote sites that intend to communicate are on IPv4.
NAT Protocol Translation
This is another important method of transition to IPv6 by means of a NAT-PT (Network
Address Translation – Protocol Translation) enabled device. With the help of a NAT-PT
device, actual can take place happens between IPv4 and IPv6 packets and vice versa.
See the diagram below:

[Image: NAT - Protocol


Translation]

A host with IPv4 address sends a request to an IPv6 enabled server on Internet that
does not understand IPv4 address. In this scenario, the NAT-PT device can help them
communicate. When the IPv4 host sends a request packet to the IPv6 server, the NAT-
PT device/router strips down the IPv4 packet, removes IPv4 header, and adds IPv6
header and passes it through the Internet. When a response from the IPv6 server
comes for the IPv4 host, the router does vice versa.

Differences between IPv4 and IPv6

Ipv4 Ipv6

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

Fields IPv4 is a numeric address that IPv6 is an alphanumeric address


consists of 4 fields which are that consists of 8 fields, which
separated by dot (.). are separated by colon.

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

Number of IP IPv4 has a limited number of IP IPv6 has a large number of IP


address addresses. addresses.

VLSM It supports VLSM (Virtual Length It does not support VLSM.


Subnet Mask). Here, VLSM means that
Ipv4 converts IP addresses into a
subnet of different sizes.
Address It supports manual and DHCP It supports manual, DHCP, auto-
configuration configuration. configuration, and renumbering.

Address space It generates 4 billion unique It generates 340 undecillion


addresses unique addresses.

End-to-end In IPv4, end-to-end connection In the case of IPv6, end-to-end


connection integrity is unachievable. connection integrity is
integrity achievable.

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

Address In IPv4, the IP address is represented In IPv6, the representation of the


representation in decimal. IP address in hexadecimal.

Fragmentation Fragmentation is done by the senders Fragmentation is done by the


and the forwarding routers. senders only.

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

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

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


scheme multicasting, which provides
efficient network operations.

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

Number of octets 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.
Address Resolution Protocol (ARP)

ARP stands for Address Resolution Protocol, which is used to find the MAC address of
the device from its known IP address. This means, the source device already knows the
IP address but not the MAC address of the destination device. The MAC address of the
device is required because you cannot communicate with a device in a local area
network (Ethernet) without knowing its MAC address. So, the Address Resolution
Protocol helps to obtain the MAC address of the destination device.

Scenario 1: When the data packet is lost or erroneous.

The purpose of ARP is to convert the 32-bit logical address (IPv4 address) to the 48-bit
physical address (MAC address). This protocol works between layer 2 and layer 3 of the
OSI model. The MAC address resides at layer 2, which is also known as the data link
layer and IP address resides at layer 3, this layer is also known as the network layer.

Note: The ARP request is generated only when both the devices (source and
destination) are in the same network.

Example: Suppose two devices (device A and device B) want to communicate with each
other. The device A already knows the IP address of the Device B. But in order to
communicate with the device B, device A still needs the MAC address of the device B.
The IP address is used to locate a device on a local area network and the MAC
address is used to identify the actual device. The device A first look at its internal list
known as ARP cache (table) to check if the IP address of the device B already consists of
its MAC address or not. If the ARP table consists of the MAC address of the device B,
then device A simply use that MAC address and start communication.

If the table does not consist of the MAC address of device B, then device A sends an
ARP broadcast message on the network to know which device has that specific IP
address and ask for the MAC address of that particular device. Then the device that has
matching IP address to the source address sends an ARP response message that
consists of the MAC address of the device B. When device A obtains the MAC address of
the device B, it will store the information in the ARP cache (table). The ARP cache is used
to make the network more efficient. It stores the IP address of the device along with its
MAC address. The stored information is used when device A wants to communicate with
device B on a network, and it does not need to broadcast a message on the network
again. It will simply check the ARP cache for the entries and then use it for
communication.
Types of Mapping in ARP

There are two different ways to map the IP address into the MAC address, which
are given below:

o Static Mapping
o Dynamic Mapping

Static Mapping - In the static mapping, a table consists of a logical address and
corresponding physical address of the destination device. In this, the IP and MAC
address of the device is entered manually in an ARP table. The source device has to
access the table first if a source wants to communicate with the destination device.

Dynamic Mapping - In the dynamic mapping, if a device knows the logical address of
the other device, then by using the Address Resolution protocol, this device will also
find the physical address of the device. The dynamic entries are created automatically
when the source device sends an ARP broadcast request. These entries are not
permanent and cleared periodically.

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.

DHCP is also used to configure the proper subnet mask, default gateway and DNS server information on the
node or device.

There are many versions of DCHP are available for use in IPV4 (Internet Protocol Version 4) and IPV6 (Internet
Protocol Version 6).
How DHCP works
DHCP runs at the application layer of the TCP/IP protocol stack to dynamically assign IP addresses to DHCP
clients/nodes and to allocate TCP/IP configuration information to the DHCP clients. Information includes subnet
mask information, default gateway, IP addresses and domain name system addresses.

DHCP is based on client-server protocol in which servers manage a pool of unique IP addresses, as well as
information about client configuration parameters, and assign addresses out of those address pools.

The DHCP lease process works as follows:

o First of all, a client (network device) must be connected to the internet.


o DHCP clients request an IP address. Typically, client broadcasts a query for this information.
o DHCP server responds to the client request by providing IP server address and other configuration
information. This configuration information also includes time period, called a lease, for which the
allocation is valid.
o When refreshing an assignment, a DHCP clients request the same parameters, but the DHCP server
may assign a new IP address. This is based on the policies set by the administrator.

Components of DHCP
When working with DHCP, it is important to understand all of the components. Following are the list of
components:

o DHCP Server: DHCP server is a networked device running the DCHP service that holds IP addresses
and related configuration information. This is typically a server or a router but could be anything that
acts as a host, such as an SD-WAN appliance.
o DHCP client: DHCP client is the endpoint that receives configuration information from a DHCP server.
This can be any device like computer, laptop, IoT endpoint or anything else that requires connectivity
to the network. Most of the devices are configured to receive DHCP information by default.
o IP address pool: IP address pool is the range of addresses that are available to DHCP clients. IP
addresses are typically handed out sequentially from lowest to the highest.
o Subnet: Subnet is the partitioned segments of the IP networks. Subnet is used to keep networks
manageable.
o Lease: Lease is the length of time for which a DHCP client holds the IP address information. When a
lease expires, the client has to renew it.
o DHCP relay: A host or router that listens for client messages being broadcast on that network and
then forwards them to a configured server. The server then sends responses back to the relay agent
that passes them along to the client. DHCP relay can be used to centralize DHCP servers instead of
having a server on each subnet.
Internet Control Message Protocol (ICMP)
Since IP does not have an inbuilt mechanism for sending error and control messages. It depends
on Internet Control Message Protocol(ICMP) to provide an error control. It is used for reporting
errors and management queries. It is a supporting protocol and is used by networks devices like
routers for sending error messages and operations information., e.g. the requested service is not
available or that a host or router could not be reached.

ICMPv4 Packet Format :

Source quench message :


Source quench message is a request to decrease the traffic rate for messages sending to the
host(destination). Or we can say when receiving host detects that the rate of sending packets
(traffic rate) to it is too fast it sends the source quench message to the source to slow the pace
down so that no packet can be lost.

ICMP will take the source IP from the discarded packet and informs the source by sending a
source quench message.
Then source will reduce the speed of transmission so that router will be free from congestion.
When the congestion router is far away from the source the ICMP will send hop by hop source
quench message so that every router will reduce the speed of transmission.

Parameter problem :
Whenever packets come to the router then the calculated header checksum should be equal to the
received header checksum then the only the packet is accepted by the router.

If there is a mismatch packet will be dropped by the router.


ICMP will take the source IP from the discarded packet and informs to the source by sending a
parameter problem message.

Time exceeded message :


When some fragments are lost in a network then the holding fragment by the router will be
dropped then ICMP will take the source IP from the discarded packet and informs the source, of
discarded datagram due to time to live field reaches zero, by sending time exceeded message.
Destination un-reachable :
Destination unreachable is generated by the host or its inbound gateway to inform the client that
the destination is unreachable for some reason.

There is no necessary condition that the only the router gives the ICMP error message some time
the destination host sends an ICMP error message when any type of failure (link failure,
hardware failure, port failure, etc) happens in the network.
Redirection message :
Redirect requests data packets are sent on an alternate route. The message informs a host to
update its routing information (to send packets on an alternate route).
Ex. If the host tries to send data through a router R1 and R1 sends data on a router R2 and there
is a direct way from the host to R2. Then R1 will send a redirect message to inform the host that
there is the best way to the destination directly through R2 available. The host then sends data
packets for the destination directly to R2.
The router R2 will send the original datagram to the intended destination.
But if the datagram contains routing information then this message will not be sent even if a
better route is available as redirects should only be sent by gateways and should not be sent by
Internet hosts.

Whenever a packet is forwarded in a wrong direction later it is re-directed in a current direction


then ICMP will send a re-directed message.

You might also like