Routers

Router Animation
An illustration of a router in operation

General

In an heterogeneous environment, such as networks, a need of connection devices which would inter-connect two different technologies is essential. In this environment the router is that device.
As it's name implies, the router also serves as a routing switch-board.  Routers connect two or more networks and forward data packets between them.  When data arrives from one of the segments, the router decides, according to it's routing table, to which segment to forward that data.
Even though each of the routers' connections is to one physical network, that one network could connect to other networks through the use of other routers.  This way, many networks can interconnect.  To understand how routing occurs in such networks, we'll refer to the following diagram:
 

Four networks with five routers

In the above configuration, router B's table would say, for instance, that data going to network 4 should go to router C.  Packets going from network 1 to network 4 would go through router B into network 2 and so on, till they reache their destination.
 

We would like to emphesize that routers "know" only about networks, and not about hosts.  In IP networks, routers utilize the fact that each host's IP address contains two parts: the host's network address, and the host's number on that network.  Routers examine the data destination address, extract, from it, the target network address, and decide, based on this network address, where to transfer the data.

A router is actually a special computer which is dedicated to the task of interconnecting networks.  It moves information from its source to its destination regardless of the middleware.

Note: A router resembles a bridge (they both have conventional processor, memory and few different I/O interfaces, each for another network it connects), but while bridging occurs at the link layer, routing occurs at the network layer (see: protocols). This difference provides information to the router that the bridge doesn't have access to.

Router responsibilities

Routers have two major responsibilities

  1. Optimizing the routing paths.

  2. A router uses a routing algorithm to determine the optimal path to the destination. These algorithms maintain routing tables which contain route information such as destination/next hop association. Routing algorithms has several goals:  
  3. Switching - transport of packets over networks.

  4. When computer wants to send a packet over the net, it formats a packet with the router's physical address and the destination address (protocol address) of the target host.  The router searches it's routing tables for the destination host. If there is no entry for the destination host the router usually drops the packet, otherwise (there is an entry for the destination host) it replaces the physical address with the next hop's address and retransmits the packet.
    The next hop isn't  necessarily the ultimate destination host, it may be another router which performs the same routine again. A packet may "visit" few routers / hosts on its route, each time it's destination physical address changes.
     
Related Topics See Also