0% found this document useful (0 votes)
15 views42 pages

Cnunit 4

Uploaded by

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

Cnunit 4

Uploaded by

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

UNIT IV

Network Layer:
Design issues in Network Layer
Virtual circuit and Datagram
subnets-Routing algorithm:
Shortest path routing
Flooding
distance vector routing, Link state routing
Hierarchical routing
Broad casting, Multi casting
Routing for mobile hosts.
Internetworking
Concatenated Virtual Circuits
Connectionless internetworking
Tunneling, Internetwork routing
12/17/24 CN_UNIT-IV 1
Fragmentation
Network Layer

● Builds on the link layer


● Routers send packets over multiple networks

Network Layer Design Issues

• Services Provided to the Transport Layer

• Implementation of Connectionless Service

• Implementation of Connection-Oriented Service

• Store-and-Forward Packet Switching

• Comparison of Virtual-Circuit and Datagram Subnets

CN_UNIT-IV 2 12/17/24
Services Provided to the Transport Layer

• The network layer services have been designed with the following goals
in mind:

1. The services should be independent of the subnet technology.

2. The transport layer should be shielded from the number, type, and
topology of the subnets present.

3. The network addresses made available to the transport layer should use
a uniform numbering plan, even across LANs and WANs.

1. Connection-oriented services
2. Connectionless services
– Telephone System View
– Send, Receive
– Setup
– No error checking or flow control
– Transfer reliable packet stream
– Disconnect

CN_UNIT-IV 3 12/17/24
Store-and-Forward Packet Switching

Both models are implemented with store-and-forward packet


switching
– Routers receive a complete packet, storing it temporarily if
necessary before forwarding it onwards
– It uses statistical multiplexing to share link bandwidth over time
• Switching element has internal buffering for contention
• Simplified view with per port output buffering
– Buffer is typically a FIFO (First In First Out) queue
– If full, packets are discarded

CN_UNIT-IV 4 12/17/24
Virtual Circuits
Implementation of Connection-Oriented Service
Three phases:
1. Connection establishment, circuit is set up
• Path is chosen, circuit information stored in routers
2. Data transfer, circuit is used
• Packets are forwarded along the path
3. Connection teardown, circuit is deleted
• Circuit information is removed from routers
• Just like a telephone circuit, but virtual in the sense that no
bandwidth need be reserved; statistical sharing of links
•Packets only contain a short label to identify the circuit
– Labels don’t have any global meaning, only unique for a link
• Each router has a forwarding table keyed by circuit
– Gives
12/17/24
output line and next label to place on packet
CN_UNIT-IV
Routing within a virtual-circuit subnet.

CN_UNIT-IV 6 12/17/24
Implementation of Connectionless Service
Datagram Model
• Packets contain a destination address; each router uses it to
forward each packet, possibly on different paths
• Each router has a forwarding table keyed by address
– Gives next hop for each destination address; may change

CN_UNIT-IV
Routing within a7 diagram subnet 12/17/24
Comparison of Virtual Circuit and Datagram Subnets

CN_UNIT-IV 8 12/17/24
Routing Algorithms
• Routing algorithm: determine the route and maintain the routing table
• Desired properties for a routing algorithm:
1. correctness
2. simplicity
3. robustness with respect to failures and changing conditions
4. stability of the routing decisions
5. fairness of the resource allocation
6. optimality of the packet travel times
Routing Algorithms Classification
• Static (non adaptive) Routing: The routing table is not changed
according to network conditions
– Static routers
– Downloaded to routers when network is booted
• Dynamic (adaptive routing):
– Reflect change in topology
–CN_UNIT-IV
Get information locally from adjacent
9 routers 12/17/24
Rules of Routing Algorithms

• Decentralized, distributed setting


– All nodes are alike; no controller
– Nodes only know what they learn by exchanging messages with neighbors
– Nodes operate concurrently
– May be node/link/message failures

Routing Algorithms
• Shortest Path Routing
• Flooding
• Distance Vector Routing
• Hierarchical Routing
• Broadcast Routing
• Multicast Routing

CN_UNIT-IV 10 12/17/24
Shortest Path Routing
• Also known as Dijkstra’s algorithm which is static in nature

• The algorithm builds a graph of the subnet where each node represents
a router and each arc represents a link between two routers.
• Step 1: Plot the subnet, assign weights to all the edges
• Step 2: Using the given metrics to calculate the shortest path from the
given source to destination.
• Step 3: Initially mark all the paths from source as infinity.
• Step 4: Starting with the source node check the adjacent nodes for
shortest path, and mark them as tentative nodes.
• Step 5: From this tentative nodes, select one which is having short
distance from source, and mark as permanent.
• Step 6: Record the distance from source to the tentative node
• Step 7: Consider this as source node and repeat the steps from 3 to 6.
• Step 8: Repeat the steps along the path with the distances being
added throughout the path to reach11the destination.
CN_UNIT-IV 12/17/24
Shortest Path Routing (Dijkstra)

• 5 steps used in computing the shortest path from


A to D. The arrows indicate the working node

CN_UNIT-IV 12 12/17/24
initialise_single_source( Graph g, Node s )
for each vertex v in Vertices( g )
g.d[v] := infinity
g.pi[v] := nil g.d[s] := 0;

relax( Node u, Node v, double w[][] ) if


d[v] > d[u] + w[u,v] then
d[v] := d[u] + w[u,v]
pi[v] := u

shortest_paths( Graph g, Node s )


initialise_single_source( g, s )
S := { 0 } /* Make S empty */
Q := Vertices( g ) /* Put the vertices in a PQ */
while not Empty(Q)
u := ExtractCheapest( Q );
AddNode( S, u ); /* Add u to S */
for each vertex v in Adjacent( u )
relax( u, v, w )
12/17/24 CN_UNIT-IV
Flooding
• Rule used at each node:
– Sends an incoming message on to all other neighbors
– Remember the message so that it is only flood once
P
P
P P

•advantages: simple, broadcasting, discovery


•disadvantages: use too much resource and flooding obviously
generates vast number of duplicate packets.

How to curb the flooding:

1. hop count
2. Source & Sequence Number
CN_UNIT-IV 14 12/17/24
12/17/24 CN_UNIT-IV
Distance Vector Routing

Each node maintains a vector of distances (and next hops) to all


destinations
1. Initialize vector with 0 (zero) cost to self, ∞ (infinity) to other
destinations
2. Periodically send vector to neighbors
3. Update vector for each destination by selecting the shortest
distance heard, after adding cost of neighbor link
– Use the best neighbor for forwarding

Adding routes: – News travels one hop per exchange


• Removing routes – When a node fails, no more exchanges, other
nodes forget
• But partitions (unreachable nodes in divided network) are a problem
– “Count to infinity” scenario
12/17/24 CN_UNIT-IV
Distance Vector Routing

CN_UNIT-IV 17 12/17/24
Distance Vector Routing
• Good news travels quickly, bad news slowly (inferred)

• Various heuristics to address


– e.g., “Split horizon, poison reverse”
(Don’t send route back to where you learned it from.)
• But none are very effective
– Link state now favored in practice
12/17/24 CN_UNIT-IV
Distance Vector Example
• Consider a simple network. Each node runs on its own
– E.g., node A can only talk to nodes B and D

• First exchange, A hears from B, D and finds 1-hop routes


– A always learns min(B+3, D+7)

12/17/24 CN_UNIT-IV
• First exchange for all nodes to find best 1-hop routes
– E.g., B learns min(A+3, C+6, D+3)

•Second exchange for all nodes to find best 2-hop routes

12/17/24 CN_UNIT-IV
• Third exchange for all nodes to find best 3-hop routes

Fourth and subsequent exchanges; converged

12/17/24 CN_UNIT-IV
Link State Routing

Proceeds in two phases:


1. Nodes flood topology in the form of link state packets
– Each node learns full topology
2. Each node computes its own forwarding table
– By running Dijkstra (or equivalent)

The link state routing is stated as five parts. Each router must:
1. Discover its neighbors and learn their network addresses.
2. Measure the delay or cost to each of its neighbors.
3. Construct a packet telling all it has just learned.
4. Send this packet to all other routers.
5. Compute the shortest path to every other router

CN_UNIT-IV 22 12/17/24
Link State Routing

• Learning about the Neighbors


• When a router is booted, It learns about its neighbors by
sending HELLO packets
• When two or more routers are connected to a LAN, it is
considered as node itself.

An artificial node
CN_UNIT-IV 23 12/17/24
Link State Routing
• Measuring Line Cost
• A ECHO packet is sent to the neighbor to calculate the round
trip time and to get the reasonable estimate of delay.

Building Link State Packets

CN_UNIT-IV 24 12/17/24
Link State Routing
• Distributing the Link State Packets
• Use flooding to distribute the link state packets
• To keep the flood in check, each packet contains a sequence
number that is incremented for each new packet sent. Routers
keep track of all the (source router, sequence) pairs they see.
• When a new link state packet comes in, it is checked against
the list of packets already seen.
1. If new: forward on all lines except the one it arrived on
2. If duplicate or old packet: discard

Things that can go wrong:


– Seq. number reaches max, or is corrupted
– Node crashes and loses seq. number
– Network partitions then heals
CN_UNIT-IV 25 12/17/24
Link State Routing
To guard against errors on the router-router lines, all link
state packets are acknowledged.
Packet buffer for router B

• Once a router has accumulated a full set of link state packets, it runs
Dijkstra’s algorithm to construct the shortest path to all possible
destinations.
CN_UNIT-IV 26 12/17/24
Hierarchical Routing
• Scale routing with hierarchy in the form of regions
– Route to regions, not individual nodes
• At least a billion Internet hosts and growing
• Internet growth translates into routing table growth (even using

Impact of Routing Growth


prefixes)

1. Forwarding tables grow


– Larger router memories, may increase lookup time
2. Routing messages grow
– Need to keeps all nodes informed of larger topology
3. Routing computation grows
– Shortest path calculations grow faster than the size of the
network
12/17/24 CN_UNIT-IV
CN_UNIT-IV 28 12/17/24
Broadcast Routing
Sending a packet to all destinations simultaneously is called broadcasting.

• source to simply send a distinct packet to each destination.

- Waste of bandwidth
• Multi destination routing
- Each packet contains a list or a bit map of the desired destinations.
- Router generates a new copy of the packet for each output line
• Flooding

- generates too many packets and consumes too much bandwidth

CN_UNIT-IV 29 12/17/24
• Reverse Path Forwarding

• It makes explicit use of the sink tree for the router initiating the
broadcast, or any other convenient spanning tree for that matter
• Makes excellent use of bandwidth, generating the absolute
minimum number of packets necessary to do the job.
• The router must have knowledge of some spanning tree for it to
be applicable
• When a broadcast packet arrives at a router, the router checks to
see if the packet arrived on the line that is normally used for
sending packets to the source of the broadcast. If so, forward it.

CN_UNIT-IV 30 12/17/24
Multicast Routing
• Group management is required
• Routers should have the knowledge of the groups
• Each router computes a spanning tree covering all other routers in
the subnet

CN_UNIT-IV 31 12/17/24
Multicast Routing
• Prune the spanning tree to remove the nodes that are not part of the
group.
• With distance vector routing, Prune the message if the router has no
interested nodes.
• source-specific multicast trees: scales poorly to large networks n groups,
m members: a total of nm trees
• core-based tree approach: each group has only one multicast tree n
groups: n trees

12/17/24 CN_UNIT-IV
Routing for Mobile Hosts
• When a mobile host changers its location, it registers with the foreign
agent and follows the following steps:
1. Periodically, it sends its care of address to home agent.
2. Sender sends a data packet to the mobile host to its permanent address.
3. Home agent sends the packet to care of address using tunneling.
4. The mobile host receives the packet and replies directly to the sender.
5. Subsequent packets from the sender can be routed directly to the mobile
host.

CN_UNIT-IV 33 12/17/24
How do we connectInternetworking
different networks together?
How Networks May Differ?

Internetworking hides the differences with a common protocol.


12/17/24 CN_UNIT-IV
How Networks can be connected?

12/17/24 CN_UNIT-IV
Tunneling
work,
Used when source and destination are the same type of net
but there is a different network in between.

• The packets cannot escape in the middle of the tunnel.

12/17/24 CN_UNIT-IV
Internetwork routing

A two-level routing algorithm is followed:


- intradomain or interior gateway protocol

- interdomain or exterior gateway protocol


BGP (Border Gateway Protocol)

ISP network as AS (Autonomous System)

12/17/24 CN_UNIT-IV
Fragmentation
How do we connect networks with different maximum packet sizes?
– Need to split up packets, or discover the largest size to use
Packet Size Problem
Different networks have different maximum packet sizes
– Or MTU (Maximum Transmission Unit)
– E.g., Ethernet 1.5K, WiFi 2.3K
• Prefer large packets for efficiency
– But what size is too large?
– Difficult because node does not know complete network path
Packet Size Solutions
Fragmentation
– Split up large packets in the network if they are too big to send
– Classic method, dated
• Discovery
– Find the largest packet that fits on the network path and use it
– 12/17/24
IP uses today instead ofCN_UNIT-IV
fragmentation
Fragmentation

• Routers fragment packets that are too large to forward


• Receiving host reassembles to reduce load on routers

Fragmentation Procedure

• Routers split a packet that is too large:


– Typically break into large pieces
– Copy IP header to pieces
– Adjust length on pieces
– Set offset to indicate position
– Set MF (More Fragments) on all pieces except last
• Receiving hosts reassembles the pieces:
– Identification field links pieces together,
MF tells receiver when it has all pieces

12/17/24 CN_UNIT-IV
12/17/24 CN_UNIT-IV
12/17/24 CN_UNIT-IV
Path MTU Discovery

• Discover the MTU that will fit


– So we can avoid fragmentation
– The method in use today
• Host tests path with large packet
– Routers provide feedback if too large;
they tell host what size would have fit

12/17/24 CN_UNIT-IV

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy