Application layer part 2

The application layer is the top layer of both the TCP/IP and OSI models. It’s the layer that provides network services to applications. In simpler terms, it’s the layer that users interact with directly when they use applications that need to communicate over a network.

1. Supernetting (Application layer)

Purpose
Supernetting is used to combine multiple smaller networks (subnets) into a single larger network. This helps:

  • Reduce the size of routing tables.
  • Make routing more efficient.
  • Save IP address space.

Example
Suppose you have four subnets: (Application layer)

  • 192.168.0.0/26
  • 192.168.0.64/26
  • 192.168.0.128/26
  • 192.168.0.192/26

All these can be merged into a single supernet:
192.168.0.0/24
This allows a router to use just one route instead of four.


2. Classless Addressing (CIDR – Classless Inter-Domain Routing)

What is CIDR?
CIDR replaces class-based addressing with variable-length subnet masks. It allows flexible allocation of IP addresses based on need rather than fixed blocks (Class A, B, C). (Application layer)

Format
CIDR uses a format like:
IP_address/prefix_length
Example: 192.168.1.0/24
Here, the first 24 bits are the network portion, and the remaining are for hosts.

Advantages

  • Saves IP addresses by allocating only as many as needed.
  • Supports supernetting and subnetting.
  • Reduces routing table size.
  • Efficient IP management.

3. Network Address Translation (NAT)

What is NAT?
NAT is a process where a router modifies IP addresses in packets as they pass through, allowing multiple devices in a private network to access the internet using a single public IP. (Application layer)

Application layer

Purpose

  • Conserves IPv4 addresses.
  • Hides internal IP addresses (security).
  • Allows private networks to access public networks.

Types of NAT

PAT (Port Address Translation): Many-to-one mapping using different ports. Common in homes and offices.

Static NAT: One-to-one mapping of a private IP to a public IP.

Dynamic NAT: Private IPs are assigned any available public IP from a pool.

(Application layer)

Routing Algorithm: Distance-Vector Routing Algorithm

Routing Algorithm

Routing algorithms are used to determine the optimal path for data to travel from source to destination in a network. These algorithms help routers make decisions about where to forward packets.


Distance-Vector Routing Algorithm

Distance-Vector Routing is a dynamic routing protocol where routers share information with their immediate neighbors and update their routing tables based on the shortest path (least cost).


Definition

In this algorithm, each router maintains a table (called a vector) showing the best-known distance to each destination and which direction (neighbor) to send the packet.


Key Features

  • Based on the Bellman-Ford algorithm.
  • Routers exchange routing tables with neighbors periodically.
  • Updates are simple and distributed.
  • Slower convergence.
  • Vulnerable to count-to-infinity problems.

How It Works

  1. Each router initializes its table with direct neighbors’ distances.
  2. Routers send their table to directly connected neighbors.
  3. On receiving updates, a router recalculates the shortest paths.
  4. The process continues until no changes occur in any table.

Numerical Based on Distance-Vector Routing Algorithm

Example Network Topology

Consider 4 routers: A, B, C, D
Connections:

  • A–B: 1
  • A–C: 4
  • B–C: 2
  • B–D: 5
  • C–D: 1

Step 1: Initial Distance Tables

Each router only knows its direct neighbors.

RouterTo ATo BTo CTo D
A014
B1025
C4201
D510

Step 2: Exchange and Update

Routers share tables with neighbors.
Example: A learns from B that C can be reached with cost 1+2=3, which is better than 4.
A also learns D can be reached via B: 1+5=6.

Updated A’s table:

To ATo BTo CTo D
0136

This process continues until all routers reach a stable state.

Link-State Routing Algorithm

Definition

Link-State Routing is a dynamic routing algorithm where each router has a complete map (topology) of the entire network and independently calculates the shortest path to every other router using Dijkstra’s algorithm.


Key Features

  • Each router discovers its neighbors and learns their link costs.
  • Routers generate (LSAs) to share link info.
  • All routers build the same topology map.
  • Shortest paths are computed
  • Faster convergence and more scalable than Distance-Vector.

Steps Involved

  1. Discover neighbors and learn their link costs.
  2. Build LSA and send it to all routers in the network.
  3. Receive LSAs from other routers.
  4. Construct the complete network topology.
  5. Use Dijkstra’s algorithm to compute shortest paths.

Numerical Based on Link-State Routing Algorithm

Example Network Topology

Consider routers A, B, C, D, and E with the following link costs:

    A
/ \
B C
| \ |
E D--/

Link costs:

  • A–B: 2
  • A–C: 5
  • B–D: 1
  • C–D: 3
  • B–E: 3
  • D–E: 2

Step 1: Build Topology Map

Each router receives LSAs from others and constructs the full network graph with all link costs.


Step 2: Apply Dijkstra’s Algorithm (from Router A)

Initialize:

  • Distance to A = 0
  • All others = ∞

Progressively update shortest distances and previous nodes:

NodeDistance from APrevious Node
A0
B2A
C5A
D3 (A→B→D)B
E5 (A→B→E)B

Similar Posts