You are on page 1of 38

UNIT 3

THE NETWORK LAYER


CHAPTER 1
-SHRUTHI K ANCHAN
NETWORK LAYER DESIGN ISSUES:
• Store & forward packet switching
• Services provided to the transport layer
• Implementation of Connectionless service
• Implementation of Connection-Oriented service
• Comparison of Virtual-Circuit & Datagram Networks
STORE & FORWARD PACKET SWITCHING:
Think of a network as a system with two main parts: the ISP's equipment and the customers' equipment.
• ISP's equipment: This includes routers and communication lines, which are like the "roadways" of the
internet.
• Customers' equipment: This is where your devices, like computers and routers, are located.

Now, when one of your devices wants to send information over the internet, it works like this:
Your device sends the information to a nearby router (it could be your home router or a router provided
by your ISP). This router temporarily holds onto the information.
The router checks if the information is correct and error-free, like making sure there are no mistakes in
the data.
If everything looks good, the router sends the information to another router (like passing a baton in a
relay race). This router does the same checks and then passes it along to the next one.
This process continues until the information reaches its final destination (like the finish line in a race).
At the destination, the information is delivered to the intended device.
This whole process of passing data from one router to another until it reaches the destination is called
"store-and-forward packet switching." It's like a relay race, where each router is like a runner
passing the information baton to the next runner until it reaches the finish line.
SERVICES PROVIDED TO THE TRANSPORT LAYER:
• The network layer provides services to the transport layer, and the key question is what kind of
services it should offer. This decision is influenced by several goals:
1. Independence from Router Technology: The network layer's services should not depend on the
specific technology used in routers.
2. Transport Layer Shielding: The transport layer should be shielded from the details of the number,
type, and arrangement of routers in the network.
3. Uniform Addressing: Network addresses provided to the transport layer should use a consistent
numbering plan, whether you're on a local area network (LAN) or a wide area network (WAN).
• There's a fundamental debate between two factions regarding the nature of these services:
1. Connectionless Service (Internet Community): This camp, largely represented by the Internet,
argues that routers should focus solely on moving packets and should not try to provide reliability.
They see the network as inherently unreliable and believe hosts should handle error control and flow
control. This leads to a connectionless service with basic primitives like sending and receiving
packets without addressing packet ordering or flow control in the network.
2. Connection-Oriented Service (Telephone Companies): On the other side, there's the argument that
the network should provide a reliable, connection-oriented service. Advocates, often influenced by
the success of the traditional telephone system, emphasize the importance of quality of service. They
believe that the network needs to establish connections to guarantee this quality, especially for real-
time applications like voice and video.
This debate has continued for many years, and the choice of network service can vary based on
different needs and technologies. Connection-oriented services were prominent in early data networks
like X.25 and Frame Relay. However, connectionless network layers, notably exemplified by the
Internet's IP protocol, have become widely popular. The IP protocol succeeded even in the face of
connection-oriented technologies like ATM. Interestingly, the Internet is evolving to incorporate
connection-oriented features to support quality of service. Technologies like MPLS (MultiProtocol
Label Switching) and VLANs are examples of this trend, offering connection-oriented capabilities
while maintaining the flexibility of connectionless networking.
IMPLEMENTATION OF CONNECTIONLESS SERVICE:
This passage explains how network layers work, depending on whether they offer connectionless or connection-
oriented services.
Connectionless (Datagram) Networks: In a connectionless network, packets (often called datagrams) are sent
individually and independently of each other. No advance setup is required. For example, in the Internet, the IP
(Internet Protocol) follows this model. When a sender has a message for a receiver, it hands the message to the
transport layer, which adds a transport header and then passes it to the network layer. The network layer, often
implemented within the operating system, sends these packets to the nearest router, typically using point-to-point
protocols like PPP. Routers use internal tables to determine where to forward each packet based on its destination.
This is the basic operation of connectionless networks.
Connection-Oriented (Virtual Circuit) Networks: In a connection-oriented network, a path (virtual circuit)
between the source and destination routers must be established before sending data packets. This model is
analogous to the physical circuits set up by the traditional telephone system. The routers involved in the path have
to agree on the circuit setup before any data can be transmitted. This approach is primarily used in telephone
networks and some other specialized systems.
IP (Internet Protocol) is given as a prime example of a connectionless network service. Each packet in
IP contains a destination IP address, which routers use to independently route packets. IPv4 packets
have 32-bit addresses, while IPv6 packets use 128-bit addresses.
• Certainly, let's break down the example provided in the above passage:
1. Connectionless (Datagram) Network Example (IP - Internet Protocol): This example illustrates
how data is transmitted in a connectionless network.
• Suppose there are two hosts, H1 and H2, and they want to exchange a long message.
• H1, the sender, hands the message to the transport layer (usually part of the operating system), which adds a
transport header to the message.
• The transport layer then forwards this prepared data packet to the network layer, which is also typically part
of the operating system.
• The network layer sends the packet to the nearest router (Router A) using a point-to-point protocol like PPP.
• Router A decides how to forward the packet based on its destination IP address, and it does this by referring
to an internal routing table that specifies where to send packets for each possible destination.
• In this example, Router A sends the packet on its way to Router C. The packet continues its journey from
Router C to Router E, then to Router F, and finally, over the LAN to reach its destination, Host H2.
• However, one packet, Packet 4, takes a different path. When it reaches Router A, it is sent to Router B
instead of following the same path as the first three packets. This change in routing may happen if Router A
learns of a traffic issue along the original route and updates its routing table.
• The algorithm responsible for managing these tables and making routing decisions is called the routing
algorithm. Different types of routing algorithms exist, and they are essential in determining how packets are
directed within a network.
• The Internet Protocol (IP), which is fundamental to the Internet's operation, is cited as a prime example of a
connectionless network service. In IP, each packet contains a destination IP address, and routers use this
address to make independent routing decisions for each packet.

This example demonstrates how connectionless (datagram) networks like the Internet operate, with
each packet being treated separately and routed to its destination based on its IP address.
IMPLEMENTATION OF CONNECTION-ORIENTED SERVICE:
In a connection-oriented network, a virtual-circuit network is used to establish and maintain
connections between source and destination machines. The primary idea is to pre-determine a route
from the source to the destination and store it in tables within the routers, eliminating the need to select
a new route for each individual packet. This approach is akin to how the traditional telephone system
operates. When a connection is established, it is assigned a unique identifier, and this identifier is
included in each packet to associate it with a specific connection.
• Virtual Circuit: A virtual circuit is a logical connection established within a network to allow
communication between two hosts. Think of it like a dedicated path that packets of data can follow
from the source host to the destination host.
• Routing Tables: Routing tables are used by routers in a network to determine the path that packets
should take to reach their destination. These tables include entries that specify how to forward
packets based on their destination address and other attributes.
Now, let's break down the example you provided:
Host H1 establishes a connection (Connection 1) with Host H2. When this connection is set up, the routers along
the path (in this case, routers A, C, and E) record the information about how to route packets for Connection 1.
So, these routers know that packets for Connection 1 should go from H1 to C and then to E.
Now, if Host H3 also wants to connect to Host H2 using the same Connection 1, it needs to instruct the network to
create a virtual circuit. This means that H3 wants to use the same path that H1 is using to communicate with H2.
To handle this situation and distinguish packets from H1 and H3 with Connection 1, routers A, C, and E need to
update their routing tables. They need to accommodate both H1 and H3 using Connection 1, and here's how they
do it:
Router A, as the entry point for both H1 and H3, needs to differentiate the outgoing traffic for these two connections. It
assigns a different connection identifier to the outgoing traffic for H3. So, when H3's packets arrive at Router A, they
are marked with a distinct identifier to distinguish them from H1's packets.

Router C, which is in the middle of the path, doesn't need to distinguish between H1 and H3 packets because it only
cares about routing based on the connection identifier. However, Router A has already marked H3's packets differently,
so Router C simply follows the routing table based on the connection identifier.

Router E, the final router, follows the routing table's instructions for Connection 1 to forward packets to Host H2.

The key point here is that routers A, C, and E are aware of the virtual circuit they need to use for Connection 1, and
they differentiate packets from H1 and H3 by assigning unique identifiers. This ensures that both H1 and H3 can use
the same logical path (virtual circuit) to communicate with H2 without conflicts.
COMPARISON OF VIRTUAL-CIRCUIT & DATAGRAM NETWORKS:
The passage highlights several trade-offs between virtual circuits and datagrams within a network:
1. Setup Time vs. Address Parsing Time:
Virtual circuits require a setup phase, which takes time and resources to establish connections. However, once set
up, routing data packets is straightforward using circuit numbers.
Datagram networks, in contrast, do not require a setup phase but involve a more complex lookup process to find
the destination's entry.

2. Address Length:
Datagram networks use longer destination addresses because they have global significance. For short packets,
including a full destination address in each packet can introduce significant overhead, potentially wasting
bandwidth.

3. Router Memory Usage:


Datagram networks require an entry for every possible destination, whereas virtual-circuit networks only need an
entry for each virtual circuit. However, virtual-circuit networks still need to route connection setup packets with
destination addresses.
4.Quality of Service and Congestion Management:
Virtual circuits offer advantages in ensuring quality of service and congestion avoidance. Resources can be reserved
when establishing a connection, guaranteeing the necessary bandwidth and router capacity when packets start
arriving.
Congestion management is more challenging in datagram networks.

5.Use Case Considerations:


For transaction processing systems (e.g., credit card verification), the overhead of setting up and clearing virtual
circuits may outweigh the actual use of the circuit. In such cases, virtual circuits may not be practical.
In scenarios like long-running VPN connections between corporate offices, permanent virtual circuits that are
manually set up and last for extended periods can be valuable.

6.Vulnerability:
Virtual circuits face vulnerability issues. If a router crashes and loses its memory, all the virtual circuits passing
through it need to be aborted.
Datagram routers, in contrast, only affect users whose packets were in the router's queue at the time of the crash, and
even then, these packets may be retransmitted shortly.
7.Communication Line Loss:
Virtual circuits can be more significantly affected by the loss of a communication line, whereas datagram-
based networks can adapt more easily to route changes and balance traffic throughout the network.
FLOODING:
Flooding, is a simple routing technique where every incoming packet is forwarded to every outgoing
network link except the one it arrived on. This method ensures that the packet is broadcasted to all
reachable parts of the network, but it can result in the generation of multiple duplicate packets,
potentially leading to inefficiency and network congestion. Flooding is often used for broadcasting
information or when robustness in network connectivity is required, although it's not suitable for most
routing scenarios due to its inefficiency.
In flooding, every incoming packet is broadcast on all outgoing network lines, except the one it arrived
on. However, flooding generates numerous duplicate packets, leading to inefficiency and network
congestion. To address this issue, several measures are introduced:
1. Hop Count: A hop counter is included in the header of each packet, which is decremented at each
router hop. When the counter reaches zero, the packet is discarded. The counter should ideally be
initialized to the estimated length of the path from source to destination.
2. Duplicate Packet Avoidance: Routers maintain lists of packets they have seen before to prevent
retransmitting them. Source routers may include sequence numbers in their packets. Each router
maintains a list per source router, indicating which sequence numbers have already been processed.
Packets that have sequence numbers present in these lists are not flooded.
3. Bounding the List: To prevent the list from growing infinitely, a counter, denoted as 'k', is
introduced. It signifies that all sequence numbers up to 'k' have been received. This counter
effectively summarizes the list of seen sequence numbers below 'k'.
While flooding is not suitable for most routing scenarios due to its inefficiency and risk of congestion,
it has practical uses:
1. Broadcasting Information: Flooding ensures that a packet is delivered to every node in the network,
making it effective for broadcasting information or updates to all network nodes.
2. Robustness: Flooding is robust in that it can find a path to deliver a packet even in adverse
conditions where routers may fail or the network is disrupted. It provides a basic level of connectivity
in challenging situations.
3. Minimal Setup: Flooding requires minimal initial setup since routers only need to know their
immediate neighbors. This makes flooding a useful building block for more efficient routing
algorithms that require more setup.
4. Benchmark for Comparison: Flooding serves as a benchmark against which other routing
algorithms can be compared. It always chooses the shortest path because it considers all possible
paths simultaneously.
DISTANCE VECTOR ROUTING:
• The distance vector routing algorithm is a dynamic routing technique used in computer networks. In
this algorithm, each router maintains a routing table that provides information about the best-
known distance to each destination in the network and the preferred outgoing link to reach that
destination. These tables are continually updated by exchanging information with neighboring
routers, ultimately allowing every router in the network to determine the best link for each
destination.
• This algorithm is often referred to as the distributed Bellman-Ford routing algorithm, named after the
researchers who developed it. Distance vector routing was the original routing algorithm used in the
ARPANET and was also known as RIP in the early Internet.
In this algorithm:
• Each router's routing table contains entries for every router in the network, consisting of the preferred
outgoing link and an estimate of the distance to that destination.
• The metric used for distance measurement can be the number of hops or another metric, such as
propagation delay.
• Routers are assumed to know the distance to their neighboring routers, and this information is utilized
to update the routing tables.
https://youtu.be/5ZuP5qjbKSI?
si=JxYWwHPaaeBMsa66
Certainly, let's break down the example provided to understand how the distance vector routing
algorithm works:
Scenario:
• In this network, there are multiple routers denoted as A, I, H, J, and K. These routers are
interconnected in a network (as shown in Fig. 5-9).
Distance Vectors:
• Each router periodically exchanges distance vectors with its neighboring routers. A distance vector
contains information about the estimated delay to reach each destination router in the network.
Router J's Calculation:
• Let's focus on router J and how it calculates its new routes to various destinations, particularly router G.
• Router J receives distance vectors from its neighboring routers: A, I, H, and K. These vectors contain the estimated delays for each
destination.
• For example, A's vector claims that the delay to reach router B is 12 msec. Similarly, it provides delay estimates for other
destinations.
• Router J also knows the delays to its neighbors, including A (8 msec), I (10 msec), H (12 msec), and K (6 msec).
• Now, Router J uses this information to calculate the best route to reach router G. It considers each neighbor as a potential path to G.
• If it forwards packets to A, it knows that it can reach A in 8 msec. A's vector indicates that A can reach G in 18 msec. So, if J
forwards packets to A, it estimates a delay of 26 msec (8 msec to A + 18 msec via A) to reach G.
• Similarly, Router J performs similar calculations for other neighbors (I, H, and K) to determine the estimated delays to reach G via
those routes.
• After considering all these calculations, Router J chooses the path with the shortest estimated delay. In this case, it selects the route
via neighbor H with an estimated delay of 18 msec.
• Router J updates its routing table to indicate that the delay to reach G is 18 msec, and it should use the link via H to reach G.
• This process is repeated for all destinations, resulting in a new routing table for Router J.
Convergence:
• Through this process of distance vector exchange and calculation, routers in the network converge to
determine the best routes to each destination based on the available information from their neighbors.
• The final routing table for Router J contains the preferred routes and estimated delays to reach all
destinations in the network.
THE COUNT TO INFINITY PROBLEM:
• The process of routers in a network reaching a consensus on the best paths to destinations is called
"convergence." In distance vector routing, while it's a straightforward technique for collectively
computing shortest paths, it has a significant drawback: it can be slow to react to changes in
network conditions.
• The key issue is that distance vector routing quickly incorporates good news (favorable changes in
routes) but reacts slowly to bad news (unfavorable changes in routes). To illustrate this, consider a
simple linear network with five nodes. Suppose one of the routers (let's call it A) is initially down,
and all other routers record the delay to A as infinity.

https://youtu.be/UYASPR4jEkk?si=gwDe_MEF24EF55Mi
• When A comes back up, the other routers learn about it through periodic vector exchanges. However,
the spread of this "good news" is limited by the number of exchanges it takes for all routers to update
their routing tables. In a network with the longest path of N hops, it takes N exchanges for everyone to
know about the revived links and routers.
• Conversely, when a router goes down or a link is severed (as in Fig. 5-10(b)), the bad news propagates
slowly. For example, if router A goes down, its neighbors initially don't hear from A, and this lack of
communication can result in incorrect assumptions. Routers gradually update their entries for A, but the
process is inherently slow because no router ever has a value more than one higher than the minimum of
all its neighbors.
• This problem is known as the "count-to-infinity problem." Various attempts have been made to solve it,
including heuristics like the "split horizon with poisoned reverse" rule, but none work well in practice
due to the inherent challenges of determining the status of remote paths. To address this, setting infinity
to a value greater than the longest path in the network plus 1 can help expedite the convergence process.
Scenario:
• The example considers two network situations, each illustrating how distance vector routing
processes good news and bad news.
Good News (A Comes Up):
• In the first scenario, initially, router A is down, and all other routers record the delay to A as infinity. This
means they believe A is not reachable.
• When A comes back up, a periodic vector exchange occurs, allowing routers to update their routing tables
based on the new information.
• Router B, being A's neighbor, receives the first piece of good news. It learns that A is reachable with a
delay of 1 hop (via its direct link to A).
• B updates its routing table, reflecting that it can reach A with a delay of 1 hop.
• However, the other routers (C, D, and E) do not hear this good news until the next exchange. So, initially,
they still believe A is unreachable.
• With each subsequent exchange, the routers incrementally learn about the improved route to A. In the
end, all routers update their routing tables to reflect the shortest path to A, and this good news propagates
through the network.
Bad News (A Goes Down or Link is Cut):
• In the second scenario, initially, all links and routers are up. Routers B, C, D, and E have varying delays to reach A.
• Suddenly, either A goes down or the link between A and B is cut. This is treated as "bad news" because it disrupts the
existing routes.
• During the first packet exchange, router B does not receive any information from A because it is down. B is left
unaware of the issue.
• Router C, on the other hand, reports that it has a path to A with a delay of 2 hops. But B is uncertain about C's path,
and it doesn't know if there are multiple paths.
• So, B conservatively assumes a route to A via C with a delay of 3 hops. D and E don't immediately update their entries
for A either.
• In subsequent exchanges, C also learns about the problem, and it updates its routing table accordingly. However, it
may not have the full picture of the network topology.
• The process continues as bad news gradually propagates through the network. Routers incrementally update their
routing tables based on the information they receive from their neighbors.
Slow Convergence:
• The example highlights why distance vector routing can exhibit slow convergence, especially when
reacting to bad news. Routers can take time to reach a consensus on the updated routes due to the
way the algorithm operates.
• The "count-to-infinity problem" refers to this issue where routers never have values more than one
higher than the minimum of their neighbors, and this can result in slow convergence.

You might also like