Tuesday, 20 May 2014

Network Layer Routing

Post By: Hanan Mannan
Contact Number: Pak (+92)-321-59-95-634
-------------------------------------------------------

Network Layer Routing

Introduction

When a device has multiple paths to reach a destination it always selects one path by preferring it over others. This selection process is termed as Routing. Routing is done by special network devices called routers or it can be done by means of software processes, but software based routers have limited functionality and limited scope.
A router is always configured with some default route. A default route tells the router where to forward a packet if there is no route found for specific destination. In case there are multiple path exists to reach the same destination, router can make decision based on the following information:
  • Hop Count
  • Bandwidth
  • Metric
  • Prefix-length
  • Delay
Routes can be statically configured or dynamically learnt. One route can be configured to be preferred over others.

Unicast routing

Most of the traffic on the Internet and Intranets are sent with destination specified, known as unicast data or unicast traffic. Routing unicast data over the internet is called Unicast Routing. It is the simplest form of routing because the destination is already known. So router just have to look up the routing table and forward the packet to next hop.
[Image: Unicast routing]

Broadcast routing

By default a Broadcast packets are not routed and forwarded by the routers on any network. Routers create broadcast domains. But it can be configured to forward broadcasts in some special cases. A broadcast message is destined to all network devices.
Broadcast routing can be done in two ways (algorithm):
  • A router creates a data packet and then sends it to each host one by one. In this scenario router creates multiple copies of single data packet with different destination addresses. All packets are sent as unicast but because they are sent to all, it simulates as if router is broadcasting.
    This method consumes lots of bandwidth and router must destination address of each node.
  • Secondly, when router receives a packet that is to be broadcasted, it simply floods those packets out of all interfaces. All routers are configured that way.
    [Image: Broadcast routing]
    This method is easy on router�s CPU but may cause the problem of duplicate packets received from peer routers.
    Reverse Path Forwarding is a technique, in which router knows in advance about its predecessor from where it should receive broadcast. This technique is used to detect and discard duplicates.

Multicast Routing

Multicast routing is special case of broadcast routing but has significance difference and challenges. In broadcast routing packets are sent to all nodes, even if they do not want it. But in Multicast routing, the data is sent to only nodes which wants to receive the packets.
[Image: Multicast routing]
Router must know that there are nodes who wishes to receive multicast packets (or stream) then only it should forward. Multicast routing works spanning tree protocol to avoid looping.
Multicast routing also uses Reverse Path Forwarding technique, to detect and discard duplicates and loops.

Anycast Routing

Anycast packet forwarding is a mechanism where multiple host can have same logical address. When a packet destined to this logical address is received it is sent to the host which is nearest in routing topology.
[Image: Anycast routing]
Anycast routing is done with help of DNS server. Whenever an Anycast packet is received it is enquired with DNS to where to send it. DNS provides the IP address which is the nearest IP configured on it.

Unicast Routing protocols

There are two kinds of routing protocols available to route Unicast packets:
  • DISTANCE VECTOR ROUTING PROTOCOL

    Distance Vector is simple routing protocol which takes routing decision on the number of hops between source and destination. A route with less number of hops is considered best route. Every router advertises its set best routes to other routers. Ultimately, all routers build up their network topology based on the advertisements of their peer routers.
    Example: Routing Information Protocol (RIP).
  • LINK STATE ROUTING PROTOCOL

    Link State protocol is slightly complicated protocol than Distance Vector. It takes in account the states of links of all the routers in a network. This technique helps routes build a common graph of the entire network. All routers then calculates their best path for routing purposes.
    Example: Open Shortest Path First (OSPF) and Intermediate System to Intermediate System (ISIS).

Multicast Routing Protocols

Unicast routing protocols use graphs while Multicast routing protocols use trees, i.e. spanning tree to avoid loops. The optimal tree is called shortest path spanning tree.
  • DVMRP:  Distance Vector Multicast Routing Protocol
  • MOSPF:  Multicast Open Shortest Path First
  • CBT:  Core Based Tree
  • PIM:  Protocol independent Multicast
Protocol Independent Multicast is commonly used now. It has two flavors:
  • PIM Dense Mode
    This mode uses source-based trees. It is used in dense environment such as LAN.
  • PIM Sparse Mode
    This mode uses shared trees. It is used in sparse environment such as WAN.

Routing Algorithms

FLOODING

Flooding is simplest method packet forwarding. When a packet is received routers send it to all the interfaces except the one on which it was received. This creates too much burden on the network and lots of duplicate packet wandering in the network.
TTL (Time to Live) can be used to avoid infinite looping of packets. There exists another approach for flooding, which is called Selective Flooding to reduce the overhead on the network. In this method router does not flood out on all interfaces, but selective ones.

SHORTEST PATH

Routing decision in networks, are mostly taken on the basis of cost between source and destination. Hop count plays major role here. Shortest path is technique which uses various algorithms to decide a path with minimum number of hops.
Common shortest path algorithms are:
  • Dijkstra's algorithm
  • Bellman Ford algorithm
  • Floyd Warshall algorithm

0 comments: