Cnunit 4
Cnunit 4
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
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:
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
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
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)
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;
1. hop count
2. Source & Sequence Number
CN_UNIT-IV 14 12/17/24
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)
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)
12/17/24 CN_UNIT-IV
• Third exchange for all nodes to find best 3-hop routes
12/17/24 CN_UNIT-IV
Link State Routing
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
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.
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
• 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
- 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
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?
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.
12/17/24 CN_UNIT-IV
Internetwork routing
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
Fragmentation Procedure
12/17/24 CN_UNIT-IV
12/17/24 CN_UNIT-IV
12/17/24 CN_UNIT-IV
Path MTU Discovery
12/17/24 CN_UNIT-IV