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

cn unit 3 notes

The document contains lecture notes for the Computer Networks course at Gurunanak Institutions Technical Campus for the academic year 2024-2025. It covers various topics including network layer design issues, routing algorithms, congestion control, quality of service, and internetworking. Key concepts such as store-and-forward packet switching, connection-oriented and connectionless services, and different routing algorithms like Dijkstra’s and distance vector routing are discussed in detail.

Uploaded by

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

cn unit 3 notes

The document contains lecture notes for the Computer Networks course at Gurunanak Institutions Technical Campus for the academic year 2024-2025. It covers various topics including network layer design issues, routing algorithms, congestion control, quality of service, and internetworking. Key concepts such as store-and-forward packet switching, connection-oriented and connectionless services, and different routing algorithms like Dijkstra’s and distance vector routing are discussed in detail.

Uploaded by

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

GURUNANAK INSTITUTIONS TECHNICAL CAMPUS (AUTONOMOUS)

SCHOOL OF ENGINEERING & TECHNOLOGY

LECTURENOTES

COMPUTER NETWORKS

SUBJECTCODE: 22PC0CS14

B.TECH III Year-I Semester

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

AY: 2024-2025

B.TECH–COMPUTERSCINCEANDENGINEERING –GNITC(SPECIAL BATCH)


GURUNANAK INSTITUTIONS TECHNICAL CAMPUS (AUTONOMOUS)
SCHOOL OF ENGINEERING & TECHNOLOGY

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


LECTURE NOTES FOR THE ACADEMIC YEAR 2024-25

FACULTY NAME :P. HYMAVATHI

SUBJECT :COMPUTER NETWORKS

SUBJECT CODE :22PC0CS14

YEAR III

SEMESTER I

STREAM :CSE

VERIFIED BY HOD–SPECIAL BATCH

B.TECH–COMPUTERSCINCEANDENGINEERING –GNITC(SPECIAL BATCH)


GURUNANAK INSTITUTIONS TECHNICAL CAMPUS (AUTONOMOUS)
SCHOOL OF ENGINEERING & TECHNOLOGY

Network Layer
UNIT–III Notes

SYLLABUS: Network Layer: Design issues, Routing algorithms: the optimality principle, shortest path
algorithm, Flooding, distance vector routing, Hierarchical routing, Broadcast Routing, Multicast
Routing. Congestion Control Algorithms, Quality of Service, Internetworking, the Network layer in
the internet: IPv4 Protocol, IP Address, IPv6.

3.1. Network Layer Design Issues:

 Store-and-Forward Packet Switching


 Services Provided to the Transport Layer
 Implementation of Connectionless Service
 Implementation of Connection-Oriented Service
 Comparison of Virtual-Circuit and Datagram Subnets

a) Store-and-Forward Packet Switching

A host with a packet to send transmits it to the nearest router, either on its own LAN or over a point-to-
point link to the ISP. The packet is stored there until it has fully arrived and the link has finished its
processing by verifying the checksum. Then, it is forwarded to the next router along the path until it
reaches the destination host, where it is delivered. This mechanism is store-and-forward packet
switching.

b) Services Provided to the Transport Layer

The network layer provides services to the transport layer at the network.

Dept. of CSE Page1


The services need to be carefully designed with the following goals in mind:

1. Services independent of router technology.


2. Transport layer shielded from number, type, topology of routers.
3. Network addresses available to transport layer use uniform numbering plan – even across LANs and
WANs.

a) Implementation of Connectionless Service

If connectionless service is offered, packets are injected into the network individually and routed
independently of each other. No advance setup is needed. In this context, the packets are frequently
called datagrams.

A’s Table (Initially) | A’s Table (Later) | C’s Table | E’s Table

Let us assume for this example that the message is four times longer than the maximum packet size, so
the network layer has to break it into four packets, 1, 2, 3, and 4, and send each of them in turn to
router A. Every router has an internal table telling it where to send packets for each of the possible
destinations. Each table entry is a pair (destination and the outgoing line). Only directly connected
lines can be used.

A’s initial routing table is shown in the figure under the label "initially." At A, packets 1, 2, and 3 are
stored briefly, having arrived on the incoming link. Then each packet is forwarded according to A’s
table, onto the outgoing link to C within a new frame. Packet 1 is then forwarded to E and then to F.

However, something different happens to packet 4. When it gets to A, it is sent to router B, even though
it is also destined for F. For some reason (traffic jam along ACE path), A decided to send packet 4
via a different route than that of the first three packets. Router A updated its routing table, as shown
under the label "later." The algorithm that manages the tables and makes the routing decisions is
called the routing algorithm.

b) Implementation of Connection-Oriented Service

If connection-oriented service is used, a path from the source router all the way to the destination router
must be established before any data packets can be sent. This connection is called a VC (virtual
circuit), and the network is called a virtual-circuit network.

When a connection is established, a route from the source machine to the destination machine is chosen
as part of the connection setup and stored in tables inside the routers. That route is used for all traffic
flowing over the connection, exactly the same way that the telephone system works. When the
connection is released, the virtual circuit is also terminated.

Dept. of CSE Page2


a) Comparison of virtual-circuit and datagram networks:

Routing Algorithms

The main function of NL (Network Layer) is routing packets from the source machine to the
destination machine. There are two processes inside a router:

a) One of them handles each packet as it arrives, looking up the outgoing line to use for it in the routing
table. This process is forwarding.
b) The other process is responsible for filling in and updating the routing tables. That is where the
routing algorithm comes into play. This process is routing.

Regardless of whether routes are chosen independently for each packet or only when new connections
are established, certain properties are desirable in a routing algorithm:
Correctness, Simplicity, Robustness, Stability, Fairness, Optimality.

Routing algorithms can be grouped into two major classes:

1. Non-Adaptive (Static Routing)


2. Adaptive (Dynamic Routing)

Non-Adaptive Algorithm

Non-adaptive algorithms do not base their routing decisions on measurements or estimates of the current
traffic and topology. Instead, the choice of the route to use to get from I to J is computed in advance,
offline, and downloaded to the routers when the network is booted. This procedure is sometimes
called static routing.

Adaptive Algorithm
Dept. of CSE Page3
Adaptive algorithms, in contrast, change their routing decisions to reflect changes in the topology and
usually the traffic as well. Adaptive algorithms differ in:

1. Where they get their information (e.g., locally, from adjacent routers, or from all routers).
2. When they change the routes (e.g., every ΔT sec, when the load changes, or when the topology
changes).
3. What metric is used for optimization (e.g., distance, number of hops, or estimated transit time). This
procedure is called dynamic routing.

Different Routing Algorithms

 Optimality Principle
 Shortest Path Algorithm
 Flooding
 Distance Vector Routing
 Link State Routing
 Hierarchical Routing

The Optimality Principle

One can make a general statement about optimal routes without regard to network topology or traffic.
This statement is known as the optimality principle.

It states that if router J is on the optimal path from router I to router K, then the optimal path from J to
K also falls along the same path.

As a direct consequence of the optimality principle, we can see that the set of optimal routes from all
sources to a given destination form a tree rooted at the destination. Such a tree is called a sink
tree.

The goal of all routing algorithms is to discover and use the sink trees for all routers.

Dept. of CSE Page4


Shortest Path Routing (Dijkstra’s Algorithm)

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

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

1. Start with the local node (router) as the root of the tree.
2. Assign a cost of 0 to this node and make it the first permanent node.
3. Examine each neighbor of the node that was the last permanent node.
4. Assign a cumulative cost to each node and make it tentative.
5. Among the list of tentative nodes, find the node with the smallest cost and make it permanent.
6. If a node can be reached from more than one route, then select the route with the shortest
cumulative cost.
7. Repeat steps 3 to 6 until every node becomes permanent.

Dept. of CSE Page5


Dept. of CSE Page6
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.

Dept. of CSE Page7


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.

Advantages of Flooding

 It is very simple to set up and implement, since a router may know only its neighbors.
 It is extremely robust. Even in case of malfunctioning of a large number of 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. This is a main criterion in case of broadcast messages.
 The shortest path is always chosen by flooding.

Distance Vector Routing

 Dijkstra’s algorithm can find the shortest path from the source to the destination. In a real
network, how the topology is obtained.
 Distance Vector Routing algorithm – Dynamic routing
o Each router maintains a table (vector), giving the best known distance to each destination and the
outgoing line to get there.
o These tables are updated by exchanging information with the neighbors.
o The metric used might be the number of hops, time delay, or the number of queued packets.
o The router is assumed to know the “distance” to each of its neighbors.

Dept. of CSE Page8


Thecount-to-infinityproblem:

Hierarchical Routing

With the increase of network/routers, it is infeasible to have an entry for each router. The hierarchical
routing is required.

 Divide the routers into regions.


 The router only knows details to route packets to the destination within the same region.
 But it may not be optimal (e.g., The best route from 1A to 5C is via region 2, but since the route
via region 3 is better for most nodes in region 5).

Dept. of CSE Page9


Multicast Routing

Sending a packet to a group of nodes (a subset of the nodes in the network) is called multicasting.

 Multiple unicast or broadcast are too expensive.


 Builds a spanning tree. Upon receiving a packet, prune the spanning tree (cut off the routers/lines
that do not lead to any member in the group).
 Not scalable.

(a) A network.
(b) A spanning tree for the leftmost router.
(c) A multicast tree for group 1.
(d) A multicast tree for group 2.

Congestion Control Algorithms

(c) Congestion is a problem when too many packets are present in the subnet, causing performance
degradation.
(d) Congestion can be brought on by several factors:

Dept. of CSE Page10


• All of a sudden, streams of packets arrive on multiple input lines, and all of them need the same output line,
leading to a queue buildup. Allocating more memory may help to a point, but with infinite memory,
congestion gets worse because packets are timed out.
• Slow processors cause queues to build up even though there is enough bandwidth.
• Low bandwidth also causes congestion.

When too much traffic is offered, congestion sets in, and performance degrades sharply. The figure
below depicts the onset of congestion.

When the number of packets hosts send into the network is well within its carrying capacity, the
number delivered is proportional to the number sent. If twice as many are sent, twice as many are
delivered.

However, as the offered load approaches the carrying capacity, bursts of traffic occasionally fill up
the buffers inside routers, and some packets are lost. These lost packets consume some of the
capacity, so the number of delivered packets falls below the ideal curve. The network is now
congested.

Unless the network is well designed, it may experience a congestion collapse.

Dept. of CSE Page11


Difference Between Congestion Control and Flow Control

 Congestion control has to do with making sure the network is able to carry the offered traffic. It
is a global issue, involving the behavior of all the hosts and routers.
 Flow control, in contrast, relates to the traffic between a particular sender and a particular
receiver. Its job is to make sure that a fast sender cannot continually transmit data faster than
the receiver is able to absorb it.

To see the difference between these two concepts, consider a network made up of 100 Gbps fiber
optic links on which a supercomputer is trying to force-feed a large file to a personal computer
that is capable of handling only 1 Gbps.

Although there is no congestion (the network itself is not in trouble), flow control is needed to force
the supercomputer to stop frequently to give the personal computer a chance to breathe.

At the other extreme, consider a network with 1-Mbps lines and 1000 large computers, half of which
are trying to transfer files at 100 kbps to the other half.

Here, the problem is not that of fast senders overpowering slow receivers, but that the total offered
traffic exceeds what the network can handle.

The reason congestion control and flow control are often confused is that the best way to handle both
problems is to get the host to slow down.

Thus, a host can get a "slow down" message either because the receiver cannot handle the load or
because the network cannot handle it.

Congestion Prevention Policies

Dept. of CSE Page12


Quality of Service (QoS)

 Requirements
 Techniques for Achieving Good Quality of Service
 Integrated Services
 Differentiated Services
 Label Switching and MPLS

A stream of packets from a source to a destination is called a flow.

QoS (Quality of Service) is characterized by four primary parameters:

 Reliability
 Delay
 Jitter
 Bandwidth

To achieve high reliability, the checksum is used to verify the packet at the destination. If a packet is
damaged in transit, it is not acknowledged and will be retransmitted eventually.

Requirements:

Dept. of CSE Page13


Internetworking

 Two or more networks are connected to form an internet.

The reasons why different networks will always be around:

 The installed base of different networks is large.


 As computers and networks get cheaper, the place where purchasing decisions are made moves
downward in the organization.
 Different networks have radically different technology.

How Networks Differ:

Dept. of CSE Page14


How Networks Can Be Connected:

 A router that can handle multiple protocols is called a multiprotocol router.


 With a switch (or bridge), the entire frame is transported based on its MAC address.
 With a router, the packet is extracted from the frame, and the address in the packet is used to
decide where to send it.

Dept. of CSE Page15


(a) Two Ethernets connected by a switch

(b) Two Ethernets connected by routers

Two Types of Internetworking:

1. Concatenated Virtual Circuits:

 A connection to a remote host is set up by concatenating virtual circuits in all networks it passes by.
 Gateways are responsible for converting packet format and maintaining the virtual circuit (VC).
 Works best when all networks have the same properties:
o Either all reliable or all unreliable.
 Can also be done on the transport layer.

2. Connectionless Internetworking:

 Inject datagrams into subnets and hope for the best.


 Packets may not follow the same route.
 Also works on VC subnets.

Concatenated Virtual Circuits

Advantages:

 Buffers can be reserved.


 Sequencing can be guaranteed.

Dept. of CSE Page16


 Shorter headers can be used.
 Troubles caused by delayed duplicate packets can be avoided.

Disadvantages:

 Table space required in the router for each open connection.


 No alternate routing to avoid congested areas.
 Vulnerability to router failure along the path.
 Difficult to implement if one of the networks is an unreliable datagram network.

Connectionless Internetworking:

Advantages:

 More potential for adapting to congestion.


 Robustness in the face of router failures.
 Various adaptive routing algorithms are possible.
 It can be used over subnets that do not use virtual circuits inside.

Disadvantages:

 More potential for congestion.


 Longer header needed.

Tunneling

Tunneling is the transmission of data in such a way that the routing nodes in the network are unaware
that the transmission is from a different network.

How It Works?

Dept. of CSE Page17


 The source sends packets to an intermediate gateway.
 The intermediate gateway puts the whole packet into the payload field (without interpreting it).
 The destination will understand the packet.

Tunneling a car from France to England:

Dept. of CSE Page18


TheIPV4 Protocol:

 Version – The IP version number, 4.


 Header length – The length of the datagram header in 32-bit words.
 Type of service – Contains five subfields that specify the precedence, delay, throughput, reliability, and
cost desired for a packet. (The Internet does not guarantee this request.) This field is not widely used on
the Internet.
 Total length – The length of the datagram in bytes, including the header, options, and the appended
transport protocol segment or packet. The maximum length is 65,535 bytes.
 Identification – An integer that identifies the datagram.
 DF – Don't Fragment.
 MF – More Fragments. All fragments except the last one have this bit set.
 Fragment offset – The relative position of this fragment measured from the beginning of the original
datagram in units of 8 bytes.
 Time to live – The number of routers a datagram can pass through. Each router decrements this value by 1
until it reaches 0, at which point the datagram is discarded. This prevents misrouted datagrams from
remaining on the Internet forever.
 Protocol – The high-level protocol type.
 Header checksum – A number that is computed to ensure the integrity of the header values.
 Source address – The 32-bit IPv4 address of the sending host.
 Destination address – The 32-bit IPv4 address of the receiving host.
 Options – A list of optional specifications for security restrictions, route recording, and source routing.
Not every datagram specifies an options field.
 Padding – Null bytes that are added to make the header length an integral multiple of 32 bytes, as
required by the header length field.

Dept. of CSE Page19


IPAddresses:

IPv6: The Main Features of IPv6

 IPv6 has longer addresses than IPv4.


 Improved header processing with better support for options and enhanced routing functionality.
 Auto-configuration
 Better security support & better support for Quality of Service (QoS)

New in IPv6

Auto-configuration

 Reduced Administrative Overhead


o Much of the administrative load for IPv4 nodes involves allocating and managing their IPv4 addresses.
o IPv6 nodes are able to configure their addresses automatically (Plug and Play).
 Support for renumbering
o Experience has shown that Internet nodes don’t keep the same IP address for their lifetime.
o A network (e.g., an enterprise intranet) will need renumbering based on topology changes (such as
wholesale reconnection to another ISP).
o An IPv6 node discovers the need for configuring a new IPv6 address for itself.

Dept. of CSE Page20


Fig: IPv6 Header Format

 Version (4 bits) – IPv6 version number.


 Traffic Class (8 bits) – Internet traffic priority delivery value.
 Flow Label (20 bits) – Used for specifying special router handling from source to destination(s) for a
sequence of packets.
 Payload Length (16 bits, unsigned) – Specifies the length of the data in the packet. When set to zero, the
option is a hop-by-hop Jumbo payload.
 Next Header (8 bits) – Specifies the next encapsulated protocol. The values are compatible with those
specified for the IPv4 protocol field.
 Hop Limit (8 bits, unsigned) – For each router that forwards the packet, the hop limit is decremented by
1. When the hop limit field reaches zero, the packet is discarded.

 This replaces the TTL field in the IPv4 header that was originally intended to be used as a time-based
hop limit.
 Source Address (16 bytes) – The IPv6 address of the sending node.
 Destination Address (16 bytes) – The IPv6 address of the destination node.

IPv6 Security and Evolution

 The advantage of implementing security at the IP level is that it can be applied without the need for
security-aware implementations of application programs.
 Security in IPv6 is implemented through the authentication and encrypted security payload extension
header types, ensuring data integrity and privacy.
 Instead of an immediate switch, isolated “islands” of IPv6 will be converted initially, communicating via
tunnels. As the IPv6 islands grow, they will merge into bigger islands. Eventually, all the islands will
merge, and the Internet will be fully converted.

Dept. of CSE Page21

You might also like