You are on page 1of 87

UNIT – III : Network Layer

Forwarding and Routing, Network Service Models


Connection Oriented Technology-Virtual Circuit(example-MPLS-MultiProtocol Label
Switching) and Connection Less Technology-Datagram Networks,IP
Router, Routing Table, Internet Protocol (IP) – IPv4 and IPv6 , ICMP, Link State
Routing , Distance Vector Routing, Hierarchical Routing , RIP, OSPF, BGP, Broadcast
and Multicast Routing ,
Mobile IP, IP sec. IPv4 :
Classes, Classless, Subneting, Super netting and its numerical.
Network Layer Services- Packetizing,
Routing and Forwarding
• Network layer is the third layer in the OSI model of computer
networks. It’s main function is to transfer network packets from the
source to the destination.
• It is involved both at the source host and the destination host. At the
source, it accepts a packet from the transport layer, encapsulates it in
a datagram and then deliver the packet to the data link layer so that it
can further be sent to the receiver.
• At the destination, the datagram is decapsulated, the packet is
extracted and delivered to the corresponding transport layer.
Features :
• Main responsibility of Network layer is to carry the data packets from
the source to the destination without changing or using it.
• If the packets are too large for delivery, they are fragmented i.e.,
broken down into smaller packets.
• It decides the route to be taken by the packets to travel from the
source to the destination among the multiple routes available in a
network (also called as routing).
• The source and destination addresses are added to the data packets
inside the network layer.
Services
Packetizing –
• The process of encapsulating the data received from upper layers of the
network(also called as 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.
Routing and Forwarding –

• 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 has some strategies
which find out the best possible route. This process is referred to as
routing. There are a number of routing protocols which are used in
this process and they should be run to help the routers coordinate
with each other and help in establishing communication throughout
the network.
• Forwarding is simply defined as the action applied by each router
when a packet arrives at one of its interfaces. When a router receives
a packet from one of its attached networks, it needs to forward the
packet to another attached network (unicast routing) or to some
attached networks(in case of multicast routing).
Virtual Circuit
• Virtual – circuit network is a category of packet switching network,
where a virtual path is established between the source and the
destination systems for data communication to occur.
• This path appears to the user as if it is a dedicated physical path, but
actually is a logical circuit allocated from a managed pool of circuit
resources as per traffic requirements. The network resources forming
parts of this path can be shared by other communications, however, is
not visible to this user.
Features of Virtual – Circuit Network

• Virtual – circuit switching is done at the network layer of the


communication system.
• In these networks, the path between the source and the destination
nodes that is followed by first data packet gets allocated. All other
data packets transmitted between them will use the same path.
• All the resources like buffers and bandwidth get reserved before the
transmission, and all data packets consume same resources.
• Since all packets follow the same path, a common header and routing
information is used by them.
• They provide greater reliability and less complexity owing to fixed
paths and fixed resources.
Phases of Virtual - Circuit Transmission

• There are three phases of transmission by virtual circuits, set up, data transfer
and teardown.
• Set up Phase − In this phase, a virtual circuit or a route is established from the
source to the destination through number of switches. The source and
destination use global addresses using which the switches make routing table
entries.
• Data Transfer − Once the virtual circuit is set up, all packets follow the route
established during the set up phase adhering to the routing tables.
• Teardown Phase − When data transfer is complete, the source sends a teardown
request. The destination responds using a teardown confirmation. The switches
flush their routing table entries, thus relinquishing the circuit.
• In the following diagram, we can that a virtual circuit is created, as denoted by
the dotted lines, and all the packets from the sender to the receiver are being
routed along this virtual circuit.
Advantages & Disadvantages of Virtual
Circuit:
• Advantages
• Packets are delivered to the receiver in the same order sent by the sender.
• Virtual circuit is a reliable network circuit.
• There is no need for overhead in each packet.
• Single global packet overhead is used in virtual circuit.
• Disadvantages
• Virtual circuit is costly to implement.
• It provides only connection-oriented service.
• Always a new connection set up is required for transmission.
Datagram Network

• In a connectionless communication systems, datagram refers to the


smallest unit via which data is transmitted. Datagrams are data
packets which contain adequate header information so that they can
be individually routed by all intermediate network switching devices
to the destination. These networks are called datagram networks
since communication occurs via datagrams. They exist in packet
switching networks.
Features of Datagram Networks

• Datagram switching is done at the network layer of the communication


system.
• In datagram networks, each data packet or datagram is routed
independently from the source to the destination even if they belong to
the same message. The network treats the packet as if it exists alone.
• Since the datagrams are treated as independent units, no dedicated path
is fixed for data transfer. Each datagram is routed by the intermediate
routers using dynamically changing routing tables. So two successive
packets from the source may follow completely separate routes to reach
destination.
• In these networks, no prior resource allocation is done for the individual
packets. This implies that no resources like buffers, processors, bandwidth,
etc. are reserved before the communication commences.
• In datagram networks, resources are allocated on demand on a
First−Come First−Serve (FCFS) basis. When a packet arrives at a
router, the packet must wait if there are other packets being
processed, irrespective of its source or destination.
• Datagram communication is generally guided by User Datagram
Protocol or UDP.
• The following diagram shows datagram packets being send by host H1
to host H2. The four datagram packets labelled as A, B, C and D, all
belonging to same message are being routed separately via separate
routes. The packets in the message arrives in the destination out of
order. It is the responsibility of H2 to reorder the packets in order to
retrieve the original message.
Advantages & Diadvantages of Datagram
N/W
• Advantages
• Transmission Delay. Whenever data is being received by the receiver in UDP, it often
experiences very less delay in transmission.
• Datagram is best for Multicast Applications.
• Connection Speed is fast.
• Processing Time is less.
• Error Detection is absent,just check the headers only.
• Diadvantages
• Datagram networks are not as reliable as Virtual Circuits. The major drawback of
Datagram Packet switching is that a packet can only be forwarded if resources such
as the buffer, CPU, and bandwidth are available. Otherwise, the packet will be
discarded.
DataGram Network Virtual Circuit
It is connection less service. There is no need for Virtual circuits are connection-oriented, which means
reservation of resources as there is no dedicated path that there is a reservation of resources like buffers,
for a connection session. bandwidth, etc. for the time during which the new
setup VC is going to be used by a data transfer session.
All packets are free to use any available path. As a The first sent packet reserves resources at each server
result, intermediate routers calculate routes on the go along the path. Subsequent packets will follow the
due to dynamically changing routing tables on routers. same path as the first sent packet for the connection
time.
Data packets reach the destination in random order, Packets reach in order to the destination as data
which means they need not reach in the order in follows the same path.
which they were sent out.
Every packet is free to choose any path, and hence all All the packets follow the same path and hence a
the packets must be associated with a header global header is required only for the first packet of
containing information about the source and the connection and other packets will not require it.
upper layer data.
Datagram networks are not as reliable as Virtual Virtual Circuits are highly reliable.
Circuits.
DataGram Network Virtual Circuit
Efficiency high, delay more Efficiency low and delay less
But it is always easy and cost-efficient to implement Implementation of virtual circuits is costly as each
datagram networks as there is no need of reserving time a new connection has to be set up with
resources and making a dedicated path each time an reservation of resources and extra information
application has to communicate. handling at routers.

A Datagram based network is a true packet switched A virtual circuit network uses a fixed path for a
network. There is no fixed path for transmitting data. particular session, after which it breaks the connection
and another path has to be set up for the next session.

Widely used in Internet Used in X.25, ATM(Asynchronous Transfer Mode)

Questions:
1.Discuss Virtual-Circuit.
2.Discuss Datagram Network .
3.Differences between Virtual-Circuit and Datagram Network.
4.What are network layer Services.
Routing Algorithms
• In order to transfer the packets from source to the destination, the network
layer must determine the best route through which packets can be
transmitted.
• Whether the network layer provides datagram service or virtual circuit
service, the main job of the network layer is to provide the best route. The
routing protocol provides this job.
• The routing protocol is a routing algorithm that provides the best path from
the source to the destination. The best path is the path that has the "least-
cost path" from source to the destination.
• Routing is the process of forwarding the packets from source to the
destination but the best route to send the packets is determined by the
routing algorithm.
Classification of a Routing algorithm
• The Routing algorithm is divided
into two categories:

• Adaptive Routing algorithm


• Non-adaptive Routing algorithm
Adaptive Routing algorithm
• An adaptive routing algorithm is also known as dynamic routing
algorithm.
• This algorithm makes the routing decisions based on the topology
and network traffic.
• The main parameters related to this algorithm are hop count( total
number of intermediate devices), distance and estimated transit
time.
Adaptive Routing Algorithm classification:
• Centralized algorithm: It is also known as global routing algorithm as it computes the least-cost
path between source and destination by using complete and global knowledge about the
network. This algorithm takes the connectivity between the nodes and link cost as input, and this
information is obtained before actually performing any calculation. Link state algorithm is
referred to as a centralized algorithm since it is aware of the cost of each link in the network.
• Isolation algorithm: It is an algorithm that obtains the routing information by using local
information rather than gathering information from other nodes.
• Distributed algorithm: It is also known as decentralized algorithm as it computes the least-cost
path between source and destination in an iterative and distributed manner. In this algorithm, no
node has the knowledge about the cost of all the network links. In the beginning, a node contains
the information only about its own directly attached links and through an iterative process of
calculation computes the least-cost path to the destination. A Distance vector algorithm is a
decentralized algorithm as it never knows the complete path from source to the destination,
instead it knows the direction through which the packet is to be forwarded along with the least
cost path.
Non-Adaptive Routing algorithm

• Non Adaptive routing algorithm is also known as a static routing


algorithm.
• When booting up the network, the routing information stores to the
routers.
• Non Adaptive routing algorithms do not take the routing decision
based on the network topology or network traffic.
Non-Adaptive Routing Algorithm classification:

• Flooding: In case of flooding, every incoming packet is sent to all the


outgoing links except the one from it has been reached. The
disadvantage of flooding is that node may contain several copies of a
particular packet.

• Random walks: In case of random walks, a packet sent by the node


to one of its neighbors randomly. An advantage of using random
walks is that it uses the alternative routes very efficiently.
Differences b/w Adaptive and Non-Adaptive
Routing Algorithm
Basis Of Comparison Adaptive Routing algorithm Non-Adaptive Routing algorithm
Define Adaptive Routing algorithm is an The Non-Adaptive Routing
algorithm that constructs the algorithm is an algorithm that
routing table based on the network constructs the static table to
conditions. determine which node to send the
packet.

Usage Adaptive routing algorithm is used The Non-Adaptive Routing


by dynamic routing. algorithm is used by static routing.
Routing decision Routing decisions are made based Routing decisions are the static
on topology and network traffic. tables.
Categorization The types of adaptive routing The types of Non Adaptive routing
algorithm, are Centralized, isolation algorithm are flooding and random
and distributed algorithm. walks.

Complexity Adaptive Routing algorithms are Non-Adaptive Routing algorithms


more complex. are simple.
LINK STATE ROUTING(adaptive -
centralized)
RECAP
• Centralized algorithm: It is also known as global routing algorithm as
it computes the least-cost path between source and destination by
using complete and global knowledge about the network.
• This algorithm takes the connectivity between the nodes and link
cost as input, and this information is obtained before actually
performing any calculation.
• Link state algorithm is referred to as a centralized algorithm since it is
aware of the cost of each link in the network.
The three keys to understand the Link State Routing algorithm:

• Knowledge about the neighborhood: Instead of sending its routing


table, a router sends the information about its neighborhood only. A
router broadcast its identities and cost of the directly attached links to
other routers.
• Flooding: Each router sends the information to every other router on
the internetwork .This process is known as Flooding. Every router that
receives the packet sends the copies to all its neighbors. Finally, each
and every router receives a copy of the same information.
• Information sharing: A router sends the information to every other
router only when the change occurs in the information.
Link State Routing has two phases:
• Reliable Flooding
• Initial state: Each node knows the cost of its neighbors.
• Final state: Each node knows the entire graph.
Route Calculation
• Each node uses Dijkstra's algorithm on the graph to calculate the optimal routes to all nodes.

• The Link state routing algorithm is also known as Dijkstra's algorithm which is used to find the
shortest path from one node to every other node in the network.
• The Dijkstra's algorithm is an iterative, and it has the property that after kth iteration of the
algorithm, the least cost paths are well known for k destination nodes.
• Let's describe some notations:
• c( i , j): Link cost from node i to node j. If i and j nodes are not directly linked, then c(i , j) = ∞.
• D(v): It defines the cost of the path from source code to destination v that has the least cost
currently.
• P(v): It defines the previous node (neighbor of v) along with current least cost path from
source to v.
• N: It is the total number of nodes available in the network.
Algorithm
• Initialization
• N = {A} // A is a root node.
• for all nodes v
• if v adjacent to A
• then D(v) = c(A,v)
• else D(v) = infinity
• loop
• find w not in N such that D(w) is a minimum.
• Add w to N
• Update D(v) for all v adjacent to w and not in N:
• D(v) = min(D(v) , D(w) + c(w,v))
• Until all nodes in N
• Step 1:
• The first step is an initialization step. The currently known least cost path
from A to its directly attached neighbors, B, C, D are 2,5,1 respectively.
The cost from A to B is set to 2, from A to D is set to 1 and from A to C is
set to 5. The cost from A to E and F are set to infinity as they are not
directly linked to A.

• Step N D(B),P(B) D(C),P(C) D(D),P(D)D(E),P(E) D(F),P(F)


• 1 A 2,A 5,A 1,A ∞ ∞
• Step 2:
• In the above table, we observe that vertex D contains the least cost path in step
1. Therefore, it is added in N. Now, we need to determine a least-cost path
through D vertex.

a) Calculating shortest path from A to B

• v = B, w = D
• D(B) = min( D(B) , D(D) + c(D,B) )
= min( 2, 1+2)
= min( 2, 3)
The minimum value is 2. Therefore, the currently shortest path from A to B is 2.
• b) Calculating shortest path from A to C
• v = C, w = D
• D(B) = min( D(C) , D(D) + c(D,C) )
• = min( 5, 1+3)
• = min( 5, 4)
• The minimum value is 4. Therefore, the currently shortest path from A to C is 4.</p>

• c) Calculating shortest path from A to E


• v = E, w = D
• D(B) = min( D(E) , D(D) + c(D,E) )
• = min( ∞, 1+1)
• = min(∞, 2)
• The minimum value is 2. Therefore, the currently shortest path from A to E is 2.
• Note: The vertex D has no direct link to vertex E. Therefore, the value of D(F) is infinity.
• Step N D(B),P(B) D(C),P(C) D(D),P(D)D(E),P(E) D(F),P(F)
• 1 A 2,A 5,A 1,A ∞ ∞
• 2 AD 2,A 4,D 2,D ∞
• Step 3:
• In the above table, we observe that both E and B have the least cost path in step 2. Let's consider
the E vertex. Now, we determine the least cost path of remaining vertices through E.
a) Calculating the shortest path from A to B.
• v = B, w = E
• D(B) = min( D(B) , D(E) + c(E,B) )
= min( 2 , 2+ ∞ )
= min( 2, ∞)
The minimum value is 2. Therefore, the currently shortest path from A to B is 2.
b) Calculating the shortest path from A to C.
• v = C, w = E
• D(B) = min( D(C) , D(E) + c(E,C) )
= min( 4 , 2+1 )
= min( 4,3)
The minimum value is 3. Therefore, the currently shortest path from A to C is 3.
• c) Calculating the shortest path from A to F.
• v = F, w = E
• D(B) = min( D(F) , D(E) + c(E,F) )
= min( ∞ , 2+2 )
= min(∞ ,4)
• The minimum value is 4. Therefore, the currently shortest path from A to
F is 4.
• Step N D(B),P(B) D(C),P(C) D(D),P(D)D(E),P(E) D(F),P(F)
• 1 A 2,A 5,A 1,A ∞ ∞
• 2 AD 2,A 4,D 2,D ∞
• 3 ADE 2,A 3,E 4,E
• Step 4:
• In the above table, we observe that B vertex has the least cost path
in step 3. Therefore, it is added in N. Now, we determine the least
cost path of remaining vertices through B.

• a) Calculating the shortest path from A to C.


• v = C, w = B
• D(B) = min( D(C) , D(B) + c(B,C) )
= min( 3 , 2+3 )
= min( 3,5)
• The minimum value is 3. Therefore, the currently shortest path from
A to C is 3.
• b) Calculating the shortest path from A to F.
• v = F, w = B
• D(B) = min( D(F) , D(B) + c(B,F) )
= min( 4, ∞)
= min(4, ∞)
• The minimum value is 4. Therefore, the currently shortest path from A to F
is 4.
• Step N D(B),P(B) D(C),P(C) D(D),P(D)D(E),P(E) D(F),P(F)
•1 A 2,A 5,A 1,A ∞ ∞
• 2 AD 2,A 4,D 2,D ∞
• 3 ADE 2,A 3,E 4,E
• 4 ADEB 3,E 4,E
• Step 5:
• In the above table, we observe that C vertex has the least cost path in
step 4. Therefore, it is added in N. Now, we determine the least cost
path of remaining vertices through C.

• a) Calculating the shortest path from A to F.


• v = F, w = C
• D(B) = min( D(F) , D(C) + c(C,F) )
= min( 4, 3+5)
= min(4,8)
• The minimum value is 4. Therefore, the currently shortest path from A
to F is 4.
• Disadvantage:
• Heavy traffic is created
in Line state routing due
to Flooding. Flooding
can cause an infinite
looping, this problem
can be solved by using
Time-to-leave field.
Distance Vector Routing Algorithm
• The Distance vector algorithm is iterative, asynchronous and distributed.
• Distributed: It is distributed in that each node receives information from
one or more of its directly attached neighbors, performs calculation and
then distributes the result back to its neighbors.
• Iterative: It is iterative in that its process continues until no more
information is available to be exchanged between neighbors.
• Asynchronous: It does not require that all of its nodes operate in the lock
step with each other.
• The Distance vector algorithm is a dynamic algorithm.
• It is mainly used in ARPANET, and RIP.
• Each router maintains a distance table known as Vector.
Working
• Knowledge about the whole network: Each router shares its
knowledge through the entire network. The Router sends its collected
knowledge about the network to its neighbors.
• Routing only to neighbors: The router sends its knowledge about the
network to only those routers which have direct links. The router
sends whatever it has about the network through the ports. The
information is received by the router and uses the information to
update its own routing table.
• Information sharing at regular intervals: Within 30 seconds, the
router sends the information to the neighboring routers.
Distance Vector Routing Algorithm
• Let dx(y) be the cost of the least-cost path from node x to node y. The
least costs are related by Bellman-Ford equation,

• dx(y) = minv{c(x,v) + dv(y)}


• Where the minv is the equation taken for all x neighbors. After
traveling from x to v, if we consider the least-cost path from v to y, the
path cost will be c(x,v)+dv(y). The least cost from x to y is the
minimum of c(x,v)+dv(y) taken over all neighbors.
• The node x has updated its own distance vector table by using the
above equation and sends its updated table to all its neighbors so that
they can update their own distance vectors.
Routing Table

• Two process occurs:


• Creating the Table
• Updating the Table
• Creating the Table
• Initially, the routing table is created for each router that contains atleast
three types of information such as Network ID, the cost and the next hop.

• Distance Vector Routing Algorithm


• NET ID: The Network ID defines the final destination of the packet.
• Cost: The cost is the number of hops that packet must take to get there.
• Next hop: It is the router to which the packet must be delivered.
Questions
• Discuss Distance Vector routing using suitable example.
• Discuss Link State routing using suitable example.
• Differnce between DV and LS routing algorithm.
• Shortnotes on RIP(intra),OSPF(intra),BGP(inter domain).
• Discuss Hierarchical Routing .
• Write short notes on MPLS(Multi Protocol Label Switching).
• Differences between IPv4 vs IPv6.
• subnetting vs supernetting.
Hierarchical Routing
• In hierarchical routing, the routers are divided into regions. Each
router has complete details about how to route packets to
destinations within its own region. But it does not have any idea
about the internal structure of other regions.
• As we know, in both Link State and Distance Vector algorithms, every
router needs to save some information about other routers. When
network size is growing, the number of routers in the network will
increase. Therefore, the size of routing table increases, then routers
cannot handle network traffic as efficiently. To overcome this problem
we are using hierarchical routing.
• In hierarchical routing, routers are classified in groups called regions.
Each router has information about the routers in its own region and
it has no information about routers in other regions. So, routers save
one record in their table for every other region.

• For huge networks, a two-level hierarchy may be insufficient hence,


it may be necessary to group the regions into clusters, the clusters
into zones, the zones into groups and so on.
Example

• Consider an example of two-


level hierarchy with five regions
as shown in figure −
• Let see the full routing table for
router 1A which has 17 entries,
as shown below −
• Full Table for 1A
• Dest. Line Hops • When routing is done hierarchically then
• 1A - -
there will be only 7 entries as shown
below −
• 1B 1B 1
• 1C 1C 1
• 2A 1B 2 • Hierarchical Table for 1A
• 2B 1B 3
• Dest. Line Hops
• 2C 1B 3
• 2D 1B 4 • 1A - -
• 3A 1C 3 • 1B 1B 1
• 3B 1C 2
• 1C 1C 1
• 4A 1C 3
• 4B 1C 4 • 2 1B 2
• 4C 1C 4 • 3 1C 2
• 5A 1C 4 • 4 1C 3
• 5B 1C 5
• 5C 1B 5
• 5 1C 4
• 5D 1C 6 • Unfortunately, this reduction in table
• 5E 1C 5 space comes with the increased path
length.
RIP Protocol

• RIP stands for Routing Information Protocol. RIP is an intra-domain


routing protocol used within an autonomous system.
• Here, intra-domain means routing the packets in a defined domain,
for example, web browsing within an institutional area.
• To understand the RIP protocol, our main focus is to know the
structure of the packet, how many fields it contains, and how these
fields determine the routing table.
Few IMP Points
• RIP is based on the distance vector-based strategy, so we consider the
entire structure as a graph where nodes are the routers, and the links
are the networks.
• In a routing table, the first column is the destination, or we can say
that it is a network address.
• The cost metric is the number of hops to reach the destination. The
number of hops available in a network would be the cost. The hop
count is the number of networks required to reach the destination.
• In RIP, infinity is defined as 16, which means that the RIP is useful for
smaller networks or small autonomous systems. The maximum
number of hops that RIP can contain is 15 hops, i.e., it should not have
more than 15 hops as 16 is infinity.
• The next column contains the address of the router to which the
packet is to be sent to reach the destination.
How is hop count determined?
• In the above figure, when the router 1
forwards the packet to the router 2
then it will count as 1 hop count.
• Similarly, when the router 2 forwards
the packet to the router 3 then it will
count as 2 hop count, and when the
router 3 forwards the packet to router
4, it will count as 3 hop count.
• In the same way, RIP can support
maximum upto 15 hops, which means
that the 16 routers can be configured
in a RIP.
RIP Message Format
• The message format is used to share information
among different routers. The RIP contains the
following fields in a message:
• Command: It is an 8-bit field that is used for
request or reply. The value of the request is 1,
and the value of the reply is 2.
• Version: Here, version means that which version
of the protocol we are using. Suppose we are
using the protocol of version1, then we put the 1
in this field.
• Reserved: This is a reserved field, so it is filled
with zeroes.
• Family: It is a 16-bit field. As we are using the
TCP/IP family, so we put 2 value in this field.
• Network Address: It is defined as 14 bytes field.
If we use the IPv4 version, then we use 4 bytes,
and the other 10 bytes are all zeroes.
• Distance: The distance field specifies the hop
count, i.e., the number of hops used to reach
the destination.
How does the RIP work?
• If there are 8 routers in a network where
Router 1 wants to send the data to
Router 3. If the network is configured
with RIP, it will choose the route which
has the least number of hops.
• There are three routes in the above
network, i.e., Route 1, Route 2, and
Route 3.
• The Route 2 contains the least number
of hops, i.e., 2 where Route 1 contains 3
hops, and Route 3 contains 4 hops, so
RIP will choose Route 2.
How RIP updates its Routing table
• RIP update timer : 30 sec
The routers configured with RIP send their updates to all the neighboring routers
every 30 seconds.
• RIP Invalid timer : 180 sec
The RIP invalid timer is 180 seconds, which means that if the router is disconnected
from the network or some link goes down, then the neighbor router will wait for 180
seconds to take the update. If it does not receive the update within 180 seconds,
then it will mark the particular route as not reachable.
• RIP Flush timer : 240 sec
The RIP flush timer is 240 second which is almost equal to 4 min means that if the
router does not receive the update within 240 seconds then the neighbor route will
remove that particular route from the routing table which is a very slow process as 4
minutes is a long time to wait.
Advantages of RIP Disadvantages of
RIP
• It is easy to configure • In RIP, the route is chosen based
• It has less complexity on the hop count metric. If
another route of better
• The CPU utilization is less. bandwidth is available, then that
route would not be chosen.
Open Shortest Path First(OSPF)
• It is a widely used and supported routing protocol. It is an intradomain protocol,
which means that it is used within an area or a network. It is an interior gateway
protocol that has been designed within a single autonomous system.
• It is based on a link-state routing algorithm in which each router contains the
information of every domain, and based on this information, it determines the
shortest path. The goal of routing is to learn routes.
• The OSPF achieves by learning about every router and subnet within the entire
network. Every router contains the same information about the network. The way
the router learns this information by sending LSA (Link State Advertisements).
These LSAs contain information about every router, subnet, and other networking
information.
• Once the LSAs have been flooded, the OSPF stores the information in a link-state
database known as LSDB. The main goal is to have the same information about
every router in an LSDBs.
OSPF Areas
• OSPF divides the autonomous systems into areas
where the area is a collection of networks, hosts,
and routers. Like internet service providers divide
the internet into a different autonomous system
for easy management and OSPF further divides the
autonomous systems into Areas.
• Routers that exist inside the area flood the area
with routing information.
• In Area, the special router also exists. The special
routers are those that are present at the border of
an area, and these special routers are known as
Area Border Routers. This router summarizes the
information about an area and shares the
information with other areas.
• All the areas inside an autonomous system are
connected to the backbone routers, and these
backbone routers are part of a primary area. The
role of a primary area is to provide communication
between different areas.
Working of OSPF(Open Shortest Path First)
• There are three steps that can explain the working of OSPF:
• Step 1: The first step is to become OSPF neighbors. The two
connecting routers running OSPF on the same link creates a neighbor
relationship.
• Step 2: The second step is to exchange database information. After
becoming the neighbors, the two routers exchange the LSDB
information with each other.
• Step 3: The third step is to choose the best route. Once the LSDB( link-
state database) information has been exchanged with each other, the
router chooses the best route to be added to a routing table based on
the calculation of SPF.
OSPF Message Format
• Version: It is an 8-bit field that specifies the OSPF protocol
version.
• Type: It is an 8-bit field. It specifies the type of the OSPF
packet.
• Message: It is a 16-bit field that defines the total length of
the message, including the header. Therefore, the total
length is equal to the sum of the length of the message
and header.
• Source IP address: It defines the address from which the
packets are sent. It is a sending routing IP address.
• Area identification: It defines the area within which the
routing takes place.
• Checksum: It is used for error correction and error
detection.
• Authentication type: There are two types of
authentication, i.e., 0 and 1. Here, 0 means for none that
specifies no authentication is available and 1 means for
pwd that specifies the password-based authentication.
• Authentication: It is a 32-bit field that contains the actual
value of the authentication data.
OSPF Packets
• There are five different types of packets in OSPF:

• Hello
• Database Description
• Link state request
• Link state update
• Link state Acknowledgment
1. Hello packet
The Hello packet is used to create a neighborhood relationship and check the neighbor's reachability. Therefore,
the Hello packet is used when the connection between the routers need to be established.
2. Database Description
After establishing a connection, if the neighbor router is communicating with the system first time, it sends the
database information about the network topology to the system so that the system can update or modify
accordingly.
3. Link state request
The link-state request is sent by the router to obtain the information of a specified route. Suppose there are two
routers, i.e., router 1 and router 2, and router 1 wants to know the information about the router 2, so router 1
sends the link state request to the router 2. When router 2 receives the link state request, then it sends the link-
state information to router 1.
4. Link state update
The link-state update is used by the router to advertise the state of its links. If any router wants to broadcast the
state of its links, it uses the link-state update.
5. Link state acknowledgment
The link-state acknowledgment makes the routing more reliable by forcing each router to send the
acknowledgment on each link state update. For example, router A sends the link state update to the router B and
router C, then in return, the router B and C sends the link- state acknowledgment to the router A, so that the router
A gets to know that both the routers have received the link-state update.
OSPF States
• Down: If the device is in a down state, it has not received the HELLO packet. Here,
down does not mean that the device is physically down; it means that the OSPF
process has not been started yet.
• Init: If the device comes in an init state, it means that the device has received the
HELLO packet from the other router.
• 2WAY: If the device is in a 2WAY state, which means that both the routers have
received the HELLO packet from the other router, and the connection gets established
between the routers.
• Exstart: Once the exchange between the routers get started, both the routers move to
the Exstart state. In this state, master and slave are selected based on the router's id.
The master controls the sequence of numbers, and starts the exchange process.
• Exchange: In the exchange state, both the routers send a list of LSAs to each other that
contain a database description.
• Loading: On the loading state, the LSR, LSU, and LSA are exchanged.
• Full: Once the exchange of the LSAs is completed, the routers move to the full state.
Border Gateway Protocol

• It is an interdomain routing protocol, and it uses the path-vector


routing. It is a gateway protocol that is used to exchange routing
information among the autonomous system on the internet.

• Features
• Types of autonomous system
• Path Attributes
• BGP Neighbor type
• BGP Table
• BGP Session
• BGP Packet and Format
ICMP Protocol
• The ICMP stands for Internet Control Message Protocol. It is a
network layer protocol. It is used for error handling in the network
layer, and it is primarily used on network devices such as routers. As
different types of errors can exist in the network layer, so ICMP can be
used to report these errors and to debug those errors.

• For example, some sender wants to send the message to some


destination, but the router couldn't send the message to the
destination. In this case, the router sends the message to the sender
that I could not send the message to that destination.
• The IP protocol does not have any error-reporting or error-correcting
mechanism, so it uses a message to convey the information.
• For example, if someone sends the message to the destination, the
message is somehow stolen between the sender and the
destination. If no one reports the error, then the sender might think
that the message has reached the destination. If someone in-
between reports the error, then the sender will resend the message
very quickly.
Position of ICMP in the network layer
ICMP Messages
• Error-reporting messages
• The error-reporting message means that the router encounters a
problem when it processes an IP packet then it reports a message.

• Query messages
• The query messages are those messages that help the host to get the
specific information of another host. For example, suppose there are
a client and a server, and the client wants to know whether the server
is live or not, then it sends the ICMP message to the server.
ICMP Message Format
• The message format has two things; one is a category that tells us
which type of message it is.
• If the message is of error type, the error message contains the type
and the code.
• The type defines the type of message while the code defines the
subtype of the message.

• The ICMP message contains the following fields:


• Type: It is an 8-bit field. It defines
the ICMP message type. The values
range from 0 to 127 are defined for
ICMPv6, and the values from 128 to
255 are the informational
messages.
• Code: It is an 8-bit field that defines
the subtype of the ICMP message
• Checksum: It is a 16-bit field to
detect whether the error exists in
the message or not.
• Error message reporting details:

• The destination unreachable error occurs when the packet does not reach the
destination. Suppose the sender sends the message, but the message does not
reach the destination, then the intermediate router reports to the sender that
the destination is unreachable.
• There is no flow control or congestion control mechanism in the network layer or
the IP protocol. The sender is concerned with only sending the packets, and the
sender does not think whether the receiver is ready to receive those packets or is
there any congestion occurs in the network layer so that the sender can send a
lesser number of packets, so there is no flow control or congestion control
mechanism. In this case, ICMP provides feedback, i.e., source quench. Suppose
the sender resends the packet at a higher rate, and the router is not able to
handle the high data rate. To overcome such a situation, the router sends a
source quench message to tell the sender to send the packet at a lower rate.
• Sometimes the situation arises when there are many routers that exist
between the sender and the receiver. When the sender sends the
packet, then it moves in a routing loop. The time exceeded is based on
the time-to-live value. When the packet traverses through the router,
then each router decreases the value of TTL by one. Whenever a
router decreases a datagram with a time-to-live value to zero, then the
router discards a datagram and sends the time exceeded message to
the original source.
• The router and the destination host can send a parameter problem
message. This message conveys that some parameters are not properly
set.
• When the packet is sent, then the routing table is gradually augmented
and updated. The tool used to achieve this is the redirection message.
• The ICMP Query message is used for error handling or debugging the
internet. This message is commonly used to ping a message.A router
or a host can send an echo-request message. It is used to ping a
message to another host that "Are you alive". If the other host is
alive, then it sends the echo-reply message. An echo-reply message
is sent by the router or the host that receives an echo-request
message.
• The timestamp-request and timestamp-reply messages are also a
type of query messages. Suppose the computer A wants to know the
time on computer B, so it sends the timestamp-request message to
computer B. The computer B responds with a timestamp-reply
message.
IP
An IP stands for internet protocol. An IP address is assigned to each device
connected to a network. Each device uses an IP address for communication. It also
behaves as an identifier as this address is used to identify the device on a network.
It defines the technical format of the packets. Mainly, both the networks, i.e., IP and
TCP, are combined together, so together, they are referred to as a TCP/IP. It creates
a virtual connection between the source and the destination.
To facilitate the routing of packets, TCP/IP protocol uses a 32-bit logical address
known as IPv4(Internet Protocol version 4).An IP address consists of two parts, i.e.,
the first one is a network address, and the other one is a host address.
There are two types of IP addresses:
• IPv4
• IPv6
• What is IPv4?
• IPv4 is a version 4 of IP. It is a current version and the most commonly
used IP address. It is a 32-bit address written in four numbers
separated by 'dot', i.e., periods. This address is unique for each device.

• For example, 66.94.29.13


• The above example represents the IP address in which each group of
numbers separated by periods is called an Octet. Each number in an
octet is in the range from 0-255. This address can produce
4,294,967,296 possible unique addresses.
• Each bit in an octet can be either 1 or 0. If the bit the 1, then the number it
represents will count, and if the bit is 0, then the number it represents does not
count.
• Representation of 8 Bit Octet
• Now, we will see how to obtain
the binary representation of the
above IP address, i.e.,
66.94.29.13
• Step 1: First, we find the binary
number of 66.
• Step 2: Now, we calculate the
binary number of 94.
• Step 3: The next number is 29.
• Step 4: The last number is 13.
Drawback of IPv4

• Currently, the population of the world is 7.6 billion. Every user is


having more than one device connected with the internet, and private
companies also rely on the internet. As we know that IPv4 produces 4
billion addresses, which are not enough for each device connected to
the internet on a planet.
What is IPv6?
• IPv4 produces 4 billion addresses, and the developers think that these addresses are
enough, but they were wrong. IPv6 is the next generation of IP addresses. The main
difference between IPv4 and IPv6 is the address size of IP addresses. The IPv4 is a 32-bit
address, whereas IPv6 is a 128-bit hexadecimal address. IPv6 provides a large address
space, and it contains a simple header as compared to IPv4.

• It provides transition strategies that convert IPv4 into IPv6, and these strategies are as
follows:
• Dual stacking: It allows us to have both the versions, i.e., IPv4 and IPv6, on the same
device.
• Tunneling: In this approach, all the users have IPv6 communicates with an IPv4 network to
reach IPv6.
• Network Address Translation: The translation allows the communication between the
hosts having a different version of IP.
• This hexadecimal address contains both numbers and alphabets. Due
to the usage of both the numbers and alphabets, IPv6 is capable of
producing over 340 undecillion (3.4*1038) addresses.

• IPv6 is a 128-bit hexadecimal address made up of 8 sets of 16 bits


each, and these 8 sets are separated by a colon. In IPv6, each
hexadecimal character represents 4 bits. So, we need to convert 4 bits
to a hexadecimal number at a time
• The above diagram shows the
address format of IPv4 and IPv6. An
IPv4 is a 32-bit decimal address. It
contains 4 octets or fields separated
by 'dot', and each field is 8-bit in
size. The number that each field
contains should be in the range of
0-255. Whereas an IPv6 is a 128-bit
hexadecimal address. It contains 8
fields separated by a colon, and
each field is 16-bit in size.
IPv4 and IPv6
Agenda 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 that consists of 8 fields,
consists of 4 fields which are which are separated by colon.
separated by dot (.).
Classes IPv4 has 5 different classes of IP IPv6 does not contain classes of IP addresses.
address that includes Class A,
Class B, Class C, Class D, and Class
E.
Number of IP IPv4 has a limited number of IP IPv6 has a large number of IP addresses.
address 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, and
configuration configuration. renumbering.
Agenda IPv4 IPv6

Address space It generates 4 billion unique It generates 340 undecillion unique addresses.
addresses
End-to-end In IPv4, end-to-end connection In the case of IPv6, end-to-end connection integrity is
connection integrity is unachievable. achievable.
integrity

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

Address In IPv4, the IP address is In IPv6, the representation of the IP address in hexadecimal.
representation represented in decimal.
Fragmentation Fragmentation is done by the Fragmentation is done by the senders only.
senders and the forwarding
routers.
Packet flow identification It does not provide any mechanism It uses flow label field in the header
for packet flow identification. for the packet flow identification.

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

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


multicasting, which provides
efficient network operations.

Encryption and Authentication It does not provide encryption and It provides encryption and
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.

You might also like