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

CN4 NOTES Converted 796c356e 4937 4d06 Ba7e C8c2a69b7aec

Uploaded by

geetabenmavani03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

CN4 NOTES Converted 796c356e 4937 4d06 Ba7e C8c2a69b7aec

Uploaded by

geetabenmavani03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

CN Notes

Ch -4

Network Layer
o The Network Layer is the third layer of the OSI model.
o It handles the service requests from the transport layer and further
forwards the service request to the data link layer.
o The network layer translates the logical addresses into physical addresses
o It determines the route from the source to the destination and also
manages the traffic problems such as switching, routing and controls the
congestion of data packets.
o The main role of the network layer is to move the packets from sending
host to the receiving host.
The main functions performed by the network layer are:
o Routing: When a packet reaches the router's input link, the router will
move the packets to the router's output link. For example, a packet from
S1 to R1 must be forwarded to the next router on the path to S2.
o Logical Addressing: The data link layer implements the physical
addressing and network layer implements the logical addressing. Logical
addressing is also used to distinguish between source and destination
system. The network layer adds a header to the packet which includes the
logical addresses of both the sender and the receiver.
o Internetworking: This is the main role of the network layer that it
provides the logical connection between different types of networks.
o Fragmentation: The fragmentation is a process of breaking the packets
into the smallest individual data units that travel through different
networks

The design issues of network layer


• Store − and − Forward Packet Switching
• Services to Transport Layer
• Providing Connection Oriented Service
• Providing Connectionless Service
Store − and − Forward Packet Switching
The network layer operates in an environment that uses store and forward
packet switching. The node which has a packet to send, delivers it to the nearest
router. The packet is stored in the router until it has fully arrived and its
checksum is verified for error detection. Once, this is done, the packet is
forwarded to the next router. Since, each router needs to store the entire packet
before it can forward it to the next hop, the mechanism is called store − and −
forward switching.
Services to Transport Layer
The network layer provides service its immediate upper layer, namely transport
layer, through the network − transport layer interface. The two types of services
provided are −
• Connection − Oriented Service − In this service, a path is setup between
the source and the destination, and all the data packets belonging to a
message are routed along this path.
• Connectionless Service − In this service, each packet of the message is
considered as an independent entity and is individually routed from the
source to the destination.

The objectives of the network layer while providing these services are −
• The services should not be dependent upon the router technology.
• The router configuration details should not be of a concern to the
transport layer.
• A uniform addressing plan should be made available to the transport
layer, whether the network is a LAN, MAN or WAN.
Providing Connection Oriented Service
In connection − oriented services, a path or route called a virtual circuit is setup
between the source and the destination nodes before the transmission starts.
All the packets in the message are sent along this route. Each packet contains an
identifier that denotes the virtual circuit to which it belongs to. When all the
packets are transmitted, the virtual circuit is terminated and the connection is
released. An example of connection − oriented service is MultiProtocol Label
Switching (MPLS).
The process is complete in three phase
1.estblacement connection
2.data transfer
3.terminate connection
Providing Connectionless Service
In connectionless service, since each packet is transmitted independently, each
packet contains its routing information and is termed as datagram. The network
using datagrams for transmission is called datagram networks or datagram
subnets. No prior setup of routes are needed before transmitting a message.
Each datagram belong to the message follows its own individual route from the
source to the destination. An example of connectionless service is Internet
Protocol or IP.
Routing
o A Router is a process of selecting path along which the data can be
transferred from source to the destination. Routing is performed by a
special device known as a router.
o A Router works at the network layer in the OSI model and internet layer
in TCP/IP model
o A router is a networking device that forwards the packet based on the
information available in the packet header and forwarding table.
o The routing algorithms are used for routing the packets. The routing
algorithm is nothing but a software responsible for deciding the optimal
path through which packet can be transmitted.
o The routing protocols use the metric to determine the best path for the
packet delivery. The metric is the standard of measurement such as hop
count, bandwidth, delay, current load on the path, etc. used by the
routing algorithm to determine the optimal path to the destination.
o The routing algorithm initializes and maintains the routing table for the
process of path determination.
Static Routing
o Static Routing is also known as Nonadaptive Routing.
o It is a technique in which the administrator manually adds the routes in a
routing table.
o A Router can send the packets for the destination along the route defined
by the administrator.
o In this technique, routing decisions are not made based on the condition
or topology of the networks
Advantages Of Static Routing
Following are the advantages of Static Routing:
o No Overhead: It has ho overhead on the CPU usage of the router.
Therefore, the cheaper router can be used to obtain static routing.
o Bandwidth: It has not bandwidth usage between the routers.
o Security: It provides security as the system administrator is allowed only
to have control over the routing to a particular network.
Disadvantages of Static Routing:
Following are the disadvantages of Static Routing:
o For a large network, it becomes a very difficult task to add each route
manually to the routing table.
o The system administrator should have a good knowledge of a topology as
he has to add each route manually.
Dynamic Routing
o It is also known as Adaptive Routing.
o It is a technique in which a router adds a new route in the routing table
for each packet in response to the changes in the condition or topology of
the network.
o Dynamic protocols are used to discover the new routes to reach the
destination.
o In Dynamic Routing, RIP and OSPF are the protocols used to discover the
new routes.
o If any route goes down, then the automatic adjustment will be made to
reach the destination.
The Dynamic protocol should have the following features:
o All the routers must have the same dynamic routing protocol in order to
exchange the routes.
o If the router discovers any change in the condition or topology, then
router broadcast this information to all other routers.
Advantages of Dynamic Routing:
o It is easier to configure.
o It is more effective in selecting the best route in response to the changes
in the condition or topology.
Disadvantages of Dynamic Routing:
o It is more expensive in terms of CPU and bandwidth usage.
o It is less secure as compared to default and static routing.
Unicast – Unicast means the transmission from a single sender to a single
receiver. It is a point-to-point communication between sender and receiver.
There are various unicast protocols such as TCP, HTTP, etc.
Intradomain Routing Interdomain Routing
Routing algorithm works only Routing algorithm works within and
within domains. between domains.

It need to know only about other


It need to know only about other routers within and between their
routers within their domain. domain.

Protocols used in intradomain Protocols used in interdomain


routing are known as Interior- routing are known as Exterior-
gateway protocols. gateway protocols.

In this Routing, routing takes place In this Routing, routing takes place
within an autonomous network. between the autonomous networks.

Interdomain routing protocol


Intradomain routing protocols assumes that the internet contains
ignores the internet outside the the collection of interconnected
AS(autonomous system). AS(autonomous systems).

Some Popular Protocols of this Popular Protocols of this routing is


routing are RIP(resource BGP(Border Gateway Protocol) used
information protocol) and to connect two or more
OSPF(open shortest path first). AS(autonomous system).
Distance Vector Routing Algorithm-
Distance vector routing is an asynchronous algorithm in which node x sends
the copy of its distance vector to all its neighbors. When node x receives the
new distance vector from one of its neighboring vector, v, it saves the distance
vector of v and uses the Bellman-Ford equation to update its own distance
vector.
Important Notes-

In Distance Vector Routing,


• Only distance vectors are exchanged.
• “Next hop”values are not exchanged.
• This is because it results in exchanging the large amount of data which
consumes more bandwidth.

•A router takes into consideration only the distance vectors it has


obtained from its neighboring routers.
• It does not take into consideration its old routing table.

• Itinvolves exchanging of distance vectors between the routers.


• Distance vector is nothing but an array of distances.

• The algorithm keeps on repeating periodically and never stops.


• This is to update the shortest path in case any link goes down or
topology changes.

• Routing tables are prepared total (n-1) times if there are n routers in the
given network.
• This is because shortest path between any 2 nodes contains at most n-1
edges if there are n nodes in the graph.

• Distance Vector Routing suffers from count to infinity problem.


• Distance Vector Routing uses UDP at transport layer.

Step-01:
Each router prepares its routing table. By their local knowledge. each router
knows about-
• All the routers present in the network
• Distance to its neighboring routers
Step-02:
Each router exchanges its distance vector with its neighboring routers.
• Each router prepares a new routing table using the distance vectors it
has obtained from its neighbors.
• This step is repeated for (n-2) times if there are n routers in the network.
• After this, routing tables converge / become stable.

Distance Vector Routing Example-


Consider-
• There is a network consisting of 4 routers.
• The weights are mentioned on the edges.
• Weights could be distances or costs or delays.

Step-01:
Each router prepares its routing table using its local knowledge.
Routing table prepared by each router is shown below-

At Router A-
Destination Distance Next Hop

A 0 A

B 2 B

C ∞ –

D 1 D

At Router B-
Destination Distance Next Hop

A 2 A
B 0 B

C 3 C

D 7 D

At Router C-
Destination Distance Next Hop

A ∞ –

B 3 B

C 0 C

D 11 D

At Router D-

Destination Distance Next Hop

A 1 A

B 7 B

C 11 C

D 0 D

Step-02:

• Each router exchanges its distance vector obtained in Step-01 with its
neighbors.
• After exchanging the distance vectors, each router prepares a new
routing table.

This is shown below-

At Router A-
• Router A receives distance vectors from its neighbors B and D.
• Router A prepares a new routing table as-

• Cost of reaching destination B from router A = min { 2+0 , 1+7 } = 2 via B.


• Cost of reaching destination C from router A = min { 2+3 , 1+11 } = 5 via
B.
• Cost of reaching destination D from router A = min { 2+7 , 1+0 } = 1 via D.

Explanation For Destination B

• Router A can reach the destination router B via its neighbor B or neighbor D.
• It chooses the path which gives the minimum cost.
• Cost of reaching router B from router A via neighbor B = Cost (A→B) + Cost
(B→B)= 2 + 0 = 2
• Cost of reaching router B from router A via neighbor D = Cost (A→D) + Cost
(D→B) = 1 + 7 = 8
• Since the cost is minimum via neighbor B, so router A chooses the path via B.
• It creates an entry (2, B) for destination B in its new routing table.
• Similarly, we calculate the shortest path distance to each destination router at
every router.

Thus, the new routing table at router A is-


Destination Distance Next Hop

A 0 A

B 2 B
C 5 B

D 1 D

At Router B-

• Router B receives distance vectors from its neighbors A, C and D.


• Router B prepares a new routing table as-

• Cost of reaching destination A from router B = min { 2+0 , 3+∞ , 7+1 } = 2


via A.
• Cost of reaching destination C from router B = min { 2+∞ , 3+0 , 7+11 } =
3 via C.
• Cost of reaching destination D from router B = min { 2+1 , 3+11 , 7+0 } =
3 via A.

Thus, the new routing table at router B is-

Destination Distance Next Hop

A 2 A

B 0 B

C 3 C

D 3 A

At Router C-
• Router C receives distance vectors from its neighbors B and D.
• Router C prepares a new routing table as-

• Cost of reaching destination A from router C = min { 3+2 , 11+1 } = 5 via


B.
• Cost of reaching destination B from router C = min { 3+0 , 11+7 } = 3 via
B.
• Cost of reaching destination D from router C = min { 3+7 , 11+0 } = 10 via
B.

Thus, the new routing table at router C is-

Destination Distance Next Hop

A 5 B

B 3 B

C 0 C

D 10 B

At Router D-

• Router D receives distance vectors from its neighbors A, B and C.


• Router D prepares a new routing table as-
• Cost of reaching destination A from router D = min { 1+0 , 7+2 , 11+∞ } =
1 via A.
• Cost of reaching destination B from router D = min { 1+2 , 7+0 , 11+3 } =
3 via A.
• Cost of reaching destination C from router D = min { 1+∞ , 7+3 , 11+0 } =
10 via B.

Thus, the new routing table at router D is-

Destination Distance Next Hop

A 1 A

B 3 A

C 10 B

D 0 D

Step-03:

• Each router exchanges its distance vector obtained in Step-02 with its
neighboring routers.
• After exchanging the distance vectors, each router prepares a new
routing table.

This is shown below-

At Router A-

• Router A receives distance vectors from its neighbors B and D.


• Router A prepares a new routing table as-

• Cost of reaching destination B from router A = min { 2+0 , 1+3 } = 2 via B.


• Cost of reaching destination C from router A = min { 2+3 , 1+10 } = 5 via
B.
• Cost of reaching destination D from router A = min { 2+3 , 1+0 } = 1 via D.

Thus, the new routing table at router A is-

Destination Distance Next Hop

A 0 A

B 2 B

C 5 B

D 1 D

At Router B-

• Router B receives distance vectors from its neighbors A, C and D.


• Router B prepares a new routing table as-
• Cost of reaching destination A from router B = min { 2+0 , 3+5 , 3+1 } = 2
via A.
• Cost of reaching destination C from router B = min { 2+5 , 3+0 , 3+10 } = 3
via C.
• Cost of reaching destination D from router B = min { 2+1 , 3+10 , 3+0 } =
3 via A.

Thus, the new routing table at router B is-

Destination Distance Next Hop

A 2 A

B 0 B

C 3 C

D 3 A

At Router C-

• Router C receives distance vectors from its neighbors B and D.


• Router C prepares a new routing table as-
• Cost of reaching destination A from router C = min { 3+2 , 10+1 } = 5 via
B.
• Cost of reaching destination B from router C = min { 3+0 , 10+3 } = 3 via
B.
• Cost of reaching destination D from router C = min { 3+3 , 10+0 } = 6 via
B.

Thus, the new routing table at router C is-

Destination Distance Next Hop

A 5 B

B 3 B

C 0 C

D 6 B

At Router D-

• Router D receives distance vectors from its neighbors A, B and C.


• Router D prepares a new routing table as-
• Cost of reaching destination A from router D = min { 1+0 , 3+2 , 10+5 } =
1 via A.
• Cost of reaching destination B from router D = min { 1+2 , 3+0 , 10+3 } =
3 via A.
• Cost of reaching destination C from router D = min { 1+5 , 3+3 , 10+0 } =
6 via A.

Thus, the new routing table at router D is-

Destination Distance Next Hop

A 1 A

B 3 A

C 6 A

D 0 D

Route Poisoning and Count to infinity problem in Routing


The main issue with Distance Vector Routing (DVR) protocols is Routing Loops
since Bellman-Ford Algorithm cannot prevent loops. This routing loop in the
DVR network causes the Count to Infinity Problem. Routing loops usually occur
when an interface goes down or two routers send updates at the same time.
example
Counting to infinity problem:
So in this example, the Bellman-Ford algorithm will converge for each router,
they will have entries for each other. B will know that it can get to C at a cost of
1, and A will know that it can get to C via B at a cost of 2.

If the link between B and C is disconnected, then B will know that it can no
longer get to C via that link and will remove it from its table. Before it can send
any updates it’s possible that it will receive an update from A which will be
advertising that it can get to C at a cost of 2. B can get to A at a cost of 1, so it
will update a route to C via A at a cost of 3. A will then receive updates from B
later and update its cost to 4. They will then go on feeding each other bad
information toward infinity which is called as Count to Infinity problem.

Disadvantages of Distance Vector routing –


• It is slower to converge than link state.
• It is at risk from the count-to-infinity problem.
• It creates more traffic than link state since a hop count change must
be propagated to all routers and processed on each router
• For larger networks, distance vector routing results in larger routing
tables than link state since each router must know about all other
routers. This can also lead to congestion on WAN links.

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.
o 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.
o In a routing table, the first column is the destination, or we can say that it
is a network address.
o 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.
o 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.
o The next column contains the address of the router to which the packet
is to be sent to reach the destination.
Features of RIP :
1. Updates of the network are exchanged periodically.
2. Updates (routing information) are always broadcast.
3. Full routing tables are sent in updates.
4. Routers always trust routing information received from neighbor
routers. This is also known as Routing on rumours.
How is hop count determined?
Hop count:-
Hop count is the number of routers occurring in between the source and
destination network. The path with the lowest hop count is considered as the
best route to reach a network and therefore placed in the routing table.
When the router sends the packet to the network segment, then it is counted
as a single hop.
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.
10.3M
172Triggers in SQL (Hindi)
RIP Message Format
Now, we look at the structure of the RIP message format. The message format
is used to share information among different routers. The RIP contains the
following fields in a message:

o 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.
o 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.
o Reserved: This is a reserved field, so it is filled with zeroes.
o Family: It is a 16-bit field. As we are using the TCP/IP family, so we put 2
value in this field.
o 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.
o 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.
Let's look at another example.

Suppose R1 wants to send the data to R4. There are two possible routes to send
data from r1 to r2. As both the routes contain the same number of hops, i.e., 3,
so RIP will send the data to both the routes simultaneously. This way, it manages
the load balancing, and data reach the destination a bit faster.
Disadvantages of RIP
• It is only based on hop count. So, if there is a better route available
with better bandwidth then it will not select that route.
Example: Suppose we have two routes, the first route has a bandwidth
of 100 Kbps(Kilobits per second) and is there is high traffic in this route
whereas the second route has a bandwidth of 100 Mbps (Megabits per
second) and is free. Now the RIP will select route 1 though it has high traffic
its bandwidth is much less than the bandwidth of route 2. This is one of the
biggest disadvantages of RIP.

• Bandwidth utilization in RIP is very high as it broadcasts its updates


every 30 seconds.
• RIP supports only 15 hop count so a maximum of 16 routers can be
configured in RIP.
• Here the convergence rate is slow. It means that when any link goes
down it takes a lot of time to choose alternate routes.
Advantages of RIP
The following are the advantages of a RIP protocol:
o It is easy to configure
o It has less complexity
o The CPU utilization is less.
How RIP updates its Routing table
o RIP update timer : 30 sec
The routers configured with RIP send their updates to all the neighboring routers
every 30 seconds.
o 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.
o 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.
RIP versions :
1. RIPv1(Routing Information Protocol version 1): It is also called
a classful routing protocol because it does not send the information of
the subnet mask in the routing update. The routing update is sent as a
broadcast( at 255.255.255.255) to every station on the attached
network.
2. RIPv2(Routing Information Protocol version 2): It is a classless routing
protocol because it does send the information of the subnet mask in its
routing updates. RIPv2 sends the routing table as multicast (at
224.0.0.9)to reduce the network traffic.
3. RIPng(Routing Information Protocol next generation): It is an
extended version of RIPV2 that was made to support IPv6. RIPng sends
the routing table as multicast (at FF02::9).

RIP v1 RIP v2 RIPng

Sends update as Sends update as Sends update as


broadcast multicast multicast

Multicast at FF02::9
(RIPng can only run
Broadcast at on IPv6 networks)
255.255.255.255 Multicast at 224.0.0.9

Doesn’t support Supports authentication


authentication of of RIPv2 update
update messages messages –

Classless
protocolupdated Classless updates are
Classful routing protocol supports classful sent

Link State Routing


Link state routing is a technique in which each router shares the knowledge of
its neighborhood with every other router in the internetwork.
The three keys to understand the Link State Routing algorithm:
o 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.
o Flooding: Each router sends the information to every other router on the
internetwork except its neighbors. 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.
o Information sharing: A router sends the information to every other router
only when the change occurs in the information.

Dijkstra's algorithm:
Each node uses Dijkstra's algorithm on the graph to calculate the optimal routes
to all nodes.
o 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.
o 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.
o Algorithm
1) Create a set sptSet (shortest path tree set) that keeps track of
vertices included in the shortest-path tree, i.e., whose minimum
distance from the source is calculated and finalized. Initially, this set is
empty.
2) Assign a distance value to all vertices in the input graph. Initialize all
distance values as INFINITE. Assign distance value as 0 for the source
vertex so that it is picked first.
3) While sptSet doesn’t include all vertices
….a) Pick a vertex u which is not there in sptSet and has a minimum
distance value.
….b) Include u to sptSet.
….c) Update distance value of all adjacent vertices of u. To update the
distance values, iterate through all adjacent vertices. For every
adjacent vertex v, if the sum of distance value of u (from source) and
weight of edge u-v, is less than the distance value of v, then update the
distance value of v.

example:

o The set sptSet is initially empty and distances assigned to vertices are
{0, INF, INF, INF, INF, INF, INF, INF} where INF indicates infinite. Now
pick the vertex with a minimum distance value. The vertex 0 is picked,
include it in sptSet. So sptSet becomes {0}. After including 0 to sptSet,
update distance values of its adjacent vertices. Adjacent vertices of 0
are 1 and 7. The distance values of 1 and 7 are updated as 4 and 8. The
following subgraph shows vertices and their distance values, only the
vertices with finite distance values are shown. The vertices included in
SPT are shown in green colour.
o
o Pick the vertex with minimum distance value and not already included
in SPT (not in sptSET). The vertex 1 is picked and added to sptSet. So
sptSet now becomes {0, 1}. Update the distance values of adjacent
vertices of 1. The distance value of vertex 2 becomes 12.

o
o Pick the vertex with minimum distance value and not already included
in SPT (not in sptSET). Vertex 7 is picked. So sptSet now becomes {0, 1,
7}. Update the distance values of adjacent vertices of 7. The distance
value of vertex 6 and 8 becomes finite (15 and 9 respectively).

o Pick the vertex with minimum distance value and not already included
in SPT (not in sptSET). Vertex 6 is picked. So sptSet now becomes {0, 1,
7, 6}. Update the distance values of adjacent vertices of 6. The distance
value of vertex 5 and 8 are updated.
o We repeat the above steps until sptSet includes all vertices of the given
graph. Finally, we get the following Shortest Path Tree (SPT).

Bellman ford algorithm:

Dijkstra doesn’t work for Graphs with negative weight cycle, Bellman-Ford
works for such graphs. Bellman-Ford is also simpler than Dijkstra and suites
well for distributed systems. But time complexity of Bellman-Ford is O(VE),
which is more than Dijkstra.

Example
Let us understand the algorithm with following example graph. The images
are taken from this source.
Let the given source vertex be 0. Initialize all distances as infinite, except the
distance to the source itself. Total number of vertices in the graph is 5, so all
edges must be processed 4 times.
Let all edges are processed in the following order: (B, E), (D, B), (B, D), (A, B),
(A, C), (D, C), (B, C), (E, D). We get the following distances when all edges are
processed the first time. The first row shows initial distances. The second row
shows distances when edges (B, E), (D, B), (B, D) and (A, B) are processed. The
third row shows distances when (A, C) is processed. The fourth row shows
when (D, C), (B, C) and (E, D) are processed.

The first iteration guarantees to give all shortest paths which are at most 1
edge long. We get the following distances when all edges are processed
second time (The last row shows final values).

The second iteration guarantees to give all shortest paths which are at most 2
edges long. The algorithm processes all edges 2 more times. The distances are
minimized after the second iteration, so third and fourth iterations don’t
update the distances.
OSPF Protocol
The OSPF stands for Open Shortest Path First. 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

How does
OSPF work?
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 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
The following are the fields in an OSPF message format:

o Version: It is an 8-bit field that specifies the OSPF protocol version.


o Type: It is an 8-bit field. It specifies the type of the OSPF packet.
o 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.
o Source IP address: It defines the address from which the packets are sent.
It is a sending routing IP address.
o Area identification: It defines the area within which the routing takes
place.
o Checksum: It is used for error correction and error detection.
o 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.
o Authentication: It is a 32-bit field that contains the actual value of the
authentication data.
Flooding:-

Flooding is a non-adaptive routing technique following this simple method:


when a data packet arrives at a router, it is sent to all the outgoing links except
the one it has arrived on.
For example, let us consider the network in the figure, having six routers that
are connected through transmission lines.

Using flooding technique −


• An incoming packet to A, will be sent to B, C and D.
• B will send the packet to C and E.
• C will send the packet to B, D and F.
• D will send the packet to C and F.
• E will send the packet to F.
• F will send the packet to C and E.
Types of Flooding
Flooding may be of three types −
• Uncontrolled flooding − Here, each router unconditionally transmits the
incoming data packets to all its neighbours.
• Controlled flooding − They use some methods to control the transmission
of packets to the neighbouring nodes. The two popular algorithms for
controlled flooding are Sequence Number Controlled Flooding (SNCF) and
Reverse Path Forwarding (RPF).
• Selective flooding − Here, the routers don't transmit the incoming
packets only along those paths which are heading towards approximately
in the right direction, instead of every available paths.
Advantages of Flooding
• It is very simple to setup and implement, since a router may know only its
neighbours.
• It is very robust. Even in case of malfunctioning of a large number routers,
the packets find a way to reach the destination.
• All nodes which are directly or indirectly connected are visited. So, there
are no chances for any node to be left out.
• The shortest path is always chosen by flooding.
Limitations of Flooding
• Flooding tends to create an infinite number of duplicate data packets,
unless some measures are adopted to damp packet generation.
• It is wasteful if a single destination needs the packet, since it delivers the
data packet to all nodes irrespective of the destination.
RIP OSPF

RIP Stands for Routing OSPF stands for Open Shortest


Information Protocol. Path First.

RIP works on Bellman Ford


algorithm. OSPF works on Dijkstra algorithm.

It is a Distance Vector
protocol and it uses the It is a link state protocol and it
distance or hops count to analyzes different sources like the
determine the transmission speed, cost and path congestion
path. while identifying the shortest path.

It is basically use for smaller It is basically use for larger size


size organization. organization in the network.

It allows a maximum of 15 There is no such restriction on the


hops. hop count.

It is not a more intelligent It is a more intelligent routing


dynamic routing protocol. protocol than RIP.

The networks are classified as


The networks are classified as areas, sub areas, autonomous
areas and tables here. systems and backbone areas here.

Its administrative distance is


120. Its administrative distance is 110.

RIP uses UDP(User Datagram OSPF works for IP(Internet


Protocol) Protocol. Protocol) Protocol.

It calculates the metric in It calculates the metric in terms of


terms of Hop Count. bandwidth.
IP V4 Addrersses

Introduction of Classful IP Addressing

IP address is an address having information about how to reach a specific host,


especially outside the LAN. An IP address is a 32 bit unique address having an
address space of 232.

Dotted Decimal Notation:


Hexadecimal Notation:

Some points to be noted about dotted decimal notation:


1. The value of any segment (byte) is between 0 and 255 (both
included).
2. There are no zeroes preceding the value in any segment (054 is
wrong, 54 is correct).

Classful Addressing
The 32 bit IP address is divided into five sub-classes. These are:
• Class A
• Class B
• Class C
• Class D
• Class E
Each of these classes has a valid range of IP addresses. Classes D and E are
reserved for multicast and experimental purposes respectively. The order of
bits in the first octet determine the classes of IP address.
IPv4 address is divided into two parts:
• Network ID
• Host ID
The class of IP address is used to determine the bits used for network ID and
host ID and the number of total networks and hosts possible in that particular
class. Each ISP or network administrator assigns IP address to each device that
is connected to its network.
Note: IP addresses are globally managed by Internet Assigned Numbers
Authority(IANA) and regional Internet registries(RIR).

Note: While finding the total number of host IP addresses, 2 IP addresses are
not counted and are therefore, decreased from the total count because the
first IP address of any network is the network number and whereas the last IP
address is reserved for broadcast IP.

Class A:
IP address belonging to class A are assigned to the networks that contain a
large number of hosts.
• The network ID is 8 bits long.
• The host ID is 24 bits long.
The higher order bit of the first octet in class A is always set to 0. The
remaining 7 bits in first octet are used to determine network ID. The 24 bits of
host ID are used to determine the host in any network. The default subnet
mask for class A is 255.x.x.x. Therefore, class A has a total of:
• 2^7-2= 126 network ID(Here 2 address is subtracted because 0.0.0.0
and 127.x.y.z are special address. )
• 2^24 – 2 = 16,777,214 host ID
IP addresses belonging to class A ranges from 1.x.x.x – 126.x.x.x

Class B:
IP address belonging to class B are assigned to the networks that ranges from
medium-sized to large-sized networks.
• The network ID is 16 bits long.
• The host ID is 16 bits long.
The higher order bits of the first octet of IP addresses of class B are always set
to 10. The remaining 14 bits are used to determine network ID. The 16 bits of
host ID is used to determine the host in any network. The default sub-net mask
for class B is 255.255.x.x. Class B has a total of:
• 2^14 = 16384 network address
• 2^16 – 2 = 65534 host address
IP addresses belonging to class B ranges from 128.0.x.x – 191.255.x.x.

Class C:
IP address belonging to class C are assigned to small-sized networks.
• The network ID is 24 bits long.
• The host ID is 8 bits long.
The higher order bits of the first octet of IP addresses of class C are always set
to 110. The remaining 21 bits are used to determine network ID. The 8 bits of
host ID is used to determine the host in any network. The default sub-net mask
for class C is 255.255.255.x. Class C has a total of:
• 2^21 = 2097152 network address
• 2^8 – 2 = 254 host address
IP addresses belonging to class C ranges from 192.0.0.x – 223.255.255.x.

Class D:
IP address belonging to class D are reserved for multi-casting. The higher order
bits of the first octet of IP addresses belonging to class D are always set to
1110. The remaining bits are for the address that interested hosts recognize.
Class D does not posses any sub-net mask. IP addresses belonging to class D
ranges from 224.0.0.0 – 239.255.255.255.

Class E:
IP addresses belonging to class E are reserved for experimental and research
purposes. IP addresses of class E ranges from 240.0.0.0 – 255.255.255.254. This
class doesn’t have any sub-net mask. The higher order bits of first octet of class
E are always set to 1111.

Rules for assigning Host ID:


Host ID’s are used to identify a host within a network. The host ID are assigned
based on the following rules:
• Within any network, the host ID must be unique to that network.
• Host ID in which all bits are set to 0 cannot be assigned because this
host ID is used to represent the network ID of the IP address.
• Host ID in which all bits are set to 1 cannot be assigned because this
host ID is reserved as a broadcast address to send packets to all the
hosts present on that particular network.
Rules for assigning Network ID:
Hosts that are located on the same physical network are identified by the
network ID, as all host on the same physical network is assigned the same
network ID. The network ID is assigned based on the following rules:
• The network ID cannot start with 127 because 127 belongs to class A
address and is reserved for internal loop-back functions.
• All bits of network ID set to 1 are reserved for use as an IP broadcast
address and therefore, cannot be used.
• All bits of network ID set to 0 are used to denote a specific host on the
local network and are not routed and therefore, aren’t used.

Summary of Classful addressing :


Problems with Classful Addressing:
The problem with this classful addressing method is that millions of class A
address are wasted, many of the class B address are wasted, whereas, number
of addresses available in class C is so small that it cannot cater the needs of
organizations. Class D addresses are used for multicast routing and are therefore
available as a single block only. Class E addresses are reserved.
Since there are these problems, Classful networking was replaced by Classless
Inter-Domain Routing (CIDR) in 1993. We will be discussing Classless addressing
in next post.

IPv4 | IPv4 Header | IPv4 Header Format

• 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.
IPv4 Header-

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.

• Theinitial 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.
• 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

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.
• If is 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
• If is 1 It indicates to the receiver that the current datagram is a fragment
of some larger datagram.

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.

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.

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.
Subnetting
Subnetting is the practice of dividing a network into two or smaller networks.
It increases routing efficiency, which helps to enhance the security of the
network and reduces the size of the broadcast domain.
IP Subnetting designates high-order bits from the host as part of the network
prefix. This method divides a network into smaller subnets.
It also helps you to reduce the size of the routing tables, which is stored in
routers. This method also helps you to extend the existing IP address base &
restructures the IP address.

What is Subnet Mask?


A subnet mask is a 32 bits address used to distinguish between a network
address and a host address in IP address. A subnet mask identifies which part
of an IP address is the network address and the host address. They are not
shown inside the data packets traversing the Internet. They carry the
destination IP address, which a router will match with a subnet.ng with
Beginners Tutorial

represent network 0 represent hosts


Two types of subnet masks are:
• The default Subnet Mask is the number of bits which is reserved by the
address class. Using this default mask will accommodate a single
network subnet in the relative class.
• A Custom Subnet Mask can be defined by an administrator
to accommodate many Network

How to Use a Subnet Mask?


The subnet mask is used by the router to cover up the network address. It
shows which bits are used to identify the subnet.
Every network has its own unique address, Like here, class B network has
network address 172.20.0.0, which has all zeroes in the host portion of the
address.
Example IP address: 11000001. Here 1st and 2nd bits are 1, and the 3rd bit is 0;
hence, it is class C.
How to identify which class the IP address belongs to
Above example shows how IP addresses should be deconstructed, which
makes it simple for Internet routers to find the right Network to route data
into. However, in a Class A network there could be millions of connected
devices, and it could take some time for the router to find the right device.

Methods of Subnet Masking


We can subnet the masking process in two ways: Straight or Short-cut.
1) Straight
You should use the binary notation method for both the address and the mask
and then apply the AND operation to get the block address.
2) Short-Cut Method
• In case the byte in the mask is 255, you need to copy the byte in the
destination address.
• When the byte in the mask is 0, then you need to replace the byte in the
address with 0.
• When the byte in the mask is neither 255 nor 0, then you should write
the mask and the address in binary and use the AND operation.
• In case if the extracted network address matches the local network ID,
and the destination is located on the local Network. However, if they do
not match, the message must be routed outside the local Network.
Class Default subnet mask No. of networks No. of host per network
A 255.0.0.0 256 16,777,214
B 255.255.0.0 65,536 65,534
C 255.255.255.0 16,77,216 126
Example
In the above diagram, there are two Subnets.
Note: It is a class C IP so, there are 24 bits in the network id part and 8 bits in
the host id part.
• For Subnet-1:
The first bit which is chosen from the host id part is zero and the
range will be from (193.1.2.00000000 till you get all 1’s in the host
ID part i.e, 193.1.2.01111111) except for the first bit which is chosen
zero for subnet id part.
Thus, the range of subnet-1:
193.1.2.0 to 193.1.2.127
• For Subnet-2:
The first bit chosen from the host id part is one and the range will be
from (193.1.2.100000000 till you get all 1’s in the host ID part i.e,
193.1.2.11111111).
Thus, the range of subnet-2:
193.1.2.128 to 193.1.2.255
Note:
1. To divide a network into four (2 2) parts you need to choose two bits
from host id part for each subnet i.e, (00, 01, 10, 11).
2. To divide a network into eight (2 3) parts you need to choose three
bits from host id part for each subnet i.e, (000, 001, 010, 011, 100,
101, 110, 111) and so on.
Network Address Translation (NAT)

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

Network Address Translation (NAT) working –


Generally, the border router is configured for NAT i.e the router which has
one interface in the local (inside) network and one interface in the global
(outside) network. When a packet traverse outside the local (inside) network,
then NAT converts that local (private) IP address to a global (public) IP
address. When a packet enters the local network, the global (public) IP
address is converted to a local (private) IP address.

If NAT runs out of addresses, i.e., no address is left in the pool configured
then the packets will be dropped and an Internet Control Message Protocol
(ICMP) host unreachable packet to the destination is sent.

NAT inside and outside addresses –


Inside refers to the addresses which must be translated. Outside refers to the
addresses which are not in control of an organization. These are the network
Addresses in which the translation of the addresses will be done.

• Inside local address – An IP address that is assigned to a host on the


Inside (local) network. The address is probably not an IP address
assigned by the service provider i.e., these are private IP addresses.
This is the inside host seen from the inside network.

• Inside global address – IP address that represents one or more


inside local IP addresses to the outside world. This is the inside host
as seen from the outside network.

• Outside local address – This is the actual IP address of the


destination host in the local network after translation.

• Outside global address – This is the outside host as seen from the
outside network. It is the IP address of the outside destination host
before translation.

Advantages of NAT –

• NAT conserves legally registered IP addresses.


• It provides privacy as the device’s IP address, sending and receiving the
traffic, will be hidden.
• Eliminates address renumbering when a network evolves.

Disadvantage of NAT –

• Translation results in switching path delays.


• Certain applications will not function while NAT is enabled.
• Complicates tunneling protocols such as IPsec.
• Also, the router being a network layer device, should not tamper with port
numbers(transport layer) but it has to do so because of NAT.

CIDR Full Form

CIDR stands for Classless Inter-Domain Routing. It is an IP address assigning


method that improves the efficiency of address distribution. It is also known as
supernetting that replaces the older system based on classes A, B, and C
networks. By using a single CIDR IP address many unique IP addresses can be
designated. CIDR IP address is the same as the normal IP address except that it
ends with a slash followed by a number.
172.200.0.0/16 It is called IP network prefix.
Characteristics of CIDR
It dynamically allocates the IP addresses by using CIDR blocks on the
requirement of the user based on certain rules. The assignment of the CIDR
block is handled by the Internet Assigned Number Authority (IANA). CIDR block
consists of IP addresses and it consists of some rules:
• All IP addresses which are allocated to host must be continuous.
• The block size must be of power 2 and equal to the total number of IP
addresses.
• The size of the block must be divisible by the first IP address of the block.
Advantages
• CIDR provide efficient address space allocation i.e. with CIDR addresses
are allocated in sizes of any binary multiple.
• It eliminates the class imbalance, i.e. there are no more class networks
so you can widely use some portion of the address space and neglect
others.
• It allows efficient routing entries i.e. a Large number of networks can be
represented by a small number of routing entries.
• No separate subnetting method is required, It implements the concept
of subnetting within the internet itself.
• It aggregates the network description and represents by a single entry.
Disadvantage
The main benefit of the older system based on classes was its simplicity. You
can determine how many bits of an IP address represents the network ID and
how many the host ID by just looking at the first octet. But it is no longer
possible, the main drawback of CIDR is its complexity.

Internet Protocol version 6 (IPv6)


IP v6 was developed by Internet Engineering Task Force (IETF) to deal with the
problem of IP v4 exhaustion. IP v6 is a 128-bits address having an address space
of 2^128, which is way bigger than IPv4. In IPv6 we use Colon-Hexa
representation. There are 8 groups and each group represents 2 Bytes.
In IPv6 representation, we have three addressing methods :
• Unicast
• Multicast
• Anycast
1. Unicast Address –
Unicast Address identifies a single network interface. A packet sent to a
unicast address is delivered to the interface identified by that address.

2. Multicast Address –
Multicast Address is used by multiple hosts, called as Group, acquires a
multicast destination address. These hosts need not be geographically
together. If any packet is sent to this multicast address, it will be distributed
to all interfaces corresponding to that multicast address.

3. Anycast Address –
Anycast Address is assigned to a group of interfaces. Any packet sent to an
anycast address will be delivered to only one member interface (mostly
nearest host possible).

Note: In IPv6, all 0’s and all 1’s can be assigned to any host, there is not any
restriction like IPv4.

Provider-based Unicast address :


These are used for global communication.
The First 3 bits identify it as of this type.
Registry Id (5-bits): Registry Id identifies the region to which it belongs. Out
of 32 (i.e. 2^5), only 4 registry IDs are being used.

Provider Id: Depending on the number of service providers that operate


under a region, certain bits will be allocated to the Provider Id field. This field
need not be fixed. Let’s say if Provider Id = 10 bits then Subscriber Id will be
56 – 10 = 46 bits.
Subscriber Id: After Provider Id is fixed, the remaining part can be used by ISP
as a normal IP address.
Intra Subscriber: This part can be modified as per the need of the
organization that is using the service.
Geography based Unicast address :

Global routing prefix: Global routing prefix contains all the details of Latitude
and Longitude. As of now, it is not being used. In Geography-based Unicast
address routing will be based on location.
Interface Id: In IPv6, instead of using Host Id, we use the term Interface Id.
Some special addresses:
Unspecified –

nternet Protocol version 6 (IPv6) Header

IP version 6 is the new version of Internet Protocol, which is way better than
IP version 4 in terms of complexity and efficiency. Let’s look at the header of
IP version 6 and understand how it is different from the IPv4 header.
Version (4-bits): Indicates version of Internet Protocol which contains bit
sequence 0110.

Traffic Class (8-bits): The Traffic Class field indicates class or priority of IPv6
packet which is similar to Service Field in IPv4 packet. It helps routers to
handle the traffic based on the priority of the packet. If congestion occurs on
the router then packets with the least priority will be discarded.
As of now, only 4-bits are being used (and the remaining bits are under
research), in which 0 to 7 are assigned to Congestion controlled traffic and 8
to 15 are assigned to Uncontrolled traffic.

Priority assignment of Congestion controlled traffic :


Uncontrolled data traffic is mainly used for Audio/Video data. So we give
higher priority to Uncontrolled data traffic.
The source node is allowed to set the priorities but on the way, routers can
change it. Therefore, the destination should not expect the same priority
which was set by the source node.

Flow Label (20-bits): Flow Label field is used by a source to label the packets
belonging to the same flow in order to request special handling by
intermediate IPv6 routers, such as non-default quality of service or real-time
service. In order to distinguish the flow, an intermediate router can use the
source address, a destination address, and flow label of the packets. Between
a source and destination, multiple flows may exist because many processes
might be running at the same time. Routers or Host that does not support the
functionality of flow label field and for default router handling, flow label
field is set to 0. While setting up the flow label, the source is also supposed to
specify the lifetime of the flow.

Payload Length (16-bits): It is a 16-bit (unsigned integer) field, indicates the


total size of the payload which tells routers about the amount of information
a particular packet contains in its payload. The payload Length field includes
extension headers(if any) and an upper-layer packet. In case the length of the
payload is greater than 65,535 bytes (payload up to 65,535 bytes can be
indicated with 16-bits), then the payload length field will be set to 0 and the
jumbo payload option is used in the Hop-by-Hop options extension header.

Next Header (8-bits): Next Header indicates the type of extension header(if
present) immediately following the IPv6 header. Whereas In some cases it
indicates the protocols contained within upper-layer packets, such as TCP,
UDP.
Hop Limit (8-bits): Hop Limit field is the same as TTL in IPv4 packets. It
indicates the maximum number of intermediate nodes IPv6 packet is allowed
to travel. Its value gets decremented by one, by each node that forwards the
packet and the packet is discarded if the value decrements to 0. This is used
to discard the packets that are stuck in an infinite loop because of some
routing error.

Source Address (128-bits): Source Address is the 128-bit IPv6 address of the
original source of the packet.

Destination Address (128-bits): The destination Address field indicates the


IPv6 address of the final destination(in most cases). All the intermediate
nodes can use this information in order to correctly route the packet.

Extension Headers: In order to rectify the limitations of the IPv4 Option Field,
Extension Headers are introduced in IP version 6. The extension header
mechanism is a very important part of the IPv6 architecture. The next Header
field of IPv6 fixed header points to the first Extension Header and this first
extension header points to the second extension header and so on.

IPv4 IPv6

IPv4 has a 32-bit address length IPv6 has a 128-bit address length

It Supports Manual and DHCP It supports Auto and renumbering


address configuration address configuration

In IPv4 end to end, connection In IPv6 end to end, connection integrity is


integrity is Unachievable Achievable

It can generate Address space of IPv6 is quite large it can


4.29×109 address space produce 3.4×1038 address space

The Security feature is IPSEC is an inbuilt security feature in the


dependent on application IPv6 protocol
IPv4 IPv6

Address representation of IPv4 Address Representation of IPv6 is in


is in decimal hexadecimal

Fragmentation performed by In IPv6 fragmentation performed only by


Sender and forwarding routers the sender

In IPv6 packet flow identification are


In IPv4 Packet flow Available and uses the flow label field in
identification is not available the header

In IPv4 checksum field is


available In IPv6 checksum field is not available

It has broadcast Message In IPv6 multicast and anycast message


Transmission Scheme transmission scheme is available

In IPv4 Encryption and In IPv6 Encryption and Authentication are


Authentication facility not provided
provided

IPv4 has a header of 20-60 IPv6 has header of 40 bytes fixed


bytes.

You might also like