Brendan Ang

Search

Search IconIcon to open search

Network Layer

Last updated Jan 21, 2023 Edit Source

# Network Layer

The network layer offers logical communication between hosts, which is distinct from the logical communication from the Transport Layer, which is within the host itself. The network layer provides 2 important functions:

# Forwarding Table

In the case of a 32 bit IP address, a brute force implementation of the forwarding table would have 1 entry for each of the 4 billion possible addresses. To make things scale, forwarding tables use ranges instead and match based on the longest prefix for which interface to forward to:

# Internet Protocol (IP)

The Internet Protocol handles addressing conventions, datagram format and packet handling conventions.

# Network Address Translation (NAT)

Network Address Translation allows local home subnets to grow bigger without having to request for additional address blocks from the ISP.

# Internet Control Message Protocol (ICMP)

# Routing Algorithms

The goal of the routing algorithm is to determine the least cost path to be populated in the forwarding table. What is the “least cost”?:

# Classifications

Each node is able to have the identical and complete view of the network by broadcasting link-state packets to all other nodes in the network. With this, Dijkstra’s Algorithm can be used to find the least cost paths.

# Distance Vector Algorithm

Let $d_x(y)$ be the cost of the least-cost path from node x to node y. Then the least costs are related by the Bellman-Ford equation, namely, $dx(y) = min_v {c(x, v) + dv( y)}$, which takes the minimum across all neighbours v of x, of the sum of x to v and v to y. Bellman-Ford Algorithm Each node x begins with $D_x(y)$, an estimate of the cost of the least-cost path from itself to node y, for all nodes, y, in N. Let Dx = [Dx(y): y in N] be node x’s distance vector, which is the vector of cost estimates from x to all other nodes, y, in N. Each node x maintains the following routing information:

a. “Good news travels fast”:

# Poisoned reverse

If z routes through y to get to destination x, then z will advertise to y that its distance to x is infinity, that is, z will advertise to y that Dz(x) = ∞ (even though z knows Dz(x) = 5 in truth). z will continue telling this little white lie to y as long as it routes to x via y. Since y believes that z has no path to x, y will never attempt to route to x via z, as long as z continues to route to x via y (and lies about doing so).

Loops involving 3 or more nodes will not be detected by this technique

# Intra-AS: Open Shortest Path First (OPSF)

# Autonomous Systems

In above routing algorithms, the model of the network of routers was too simplistic

# Routing Information Protocol (RIP)

RIP uses the distance vector algorithm with its metric being the number of hop counts.

# OSPF

OSPF uses IP directly, without UDP or TCP, meaning it has to implement functionality such as reliable message transfer. Each router

  1. Actively test the status of all neighbours/links
  2. Build a Link State Advertisement (LSA) from this information and propagate it to all other routers within an area.
  3. Using LSAs from all other routers, compute a shortest path delivery tree, typically using Dijkstra shortest path algorithm.

# Inter-AS: Border Gateway Protocol (BGP)

To route a packet across multiple ASs, we need an inter-autonomous system routing protocol. Since an inter-AS routing protocol involves coordination among multiple ASs, communicating ASs must run the same inter-AS routing protocol. In the Internet, all ASs run the same inter-AS routing protocol, the BGP. Each router sends messages over these connections. For example, when a new subnet x appears in AS3, the gateway router in AS3 sends a message to AS2 “AS3 x”. AS2 then uses iBGP to advertise the existence of x amongst internal AS2 routers before sending a message over eBGP “AS2 AS3 x” to AS1.