Routers - Your Network's Traffic Cop
Routers
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.
Router Animation
In the diagram below 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. To understand how routing occurs in such networks, we will refer to the next animation.
Router Configuration

We would like to emphasize 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 a 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. This difference provides information to the router that the bridge doesn't have access to.
Router responsibilities
Optimizing the routing paths. 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:
Optimality - finding the "best" route depending on the metric weightings used by the specific router (there are several metrics used by routers, each assigns different weights to routing algorithm's parameters such as number of hops, delay) Simplicity and low overhead - router algorithms must be as efficient as possible with minimum utilization overhead. An efficient algorithm is particularly important when using routing software on a limited resources computer.
Robustness and stability - routers are located at network junction points, therefore they must be robust with the ability to handle unusual behavior of hardware and software components.
Rapid convergence - routers must agree on the optimal paths over the net in order to avoid loops. When a network event (computer/router failure, network segment going down etc..) force changes in the router's routing tables, each router must perform recalculations based on the update messages it received from other routers on the net. Flexibility - is the ability to adapt accurately and quickly to network changes and events. For example when the optimal routes are no longer accessible or even optimal, due to some change in the network (segments going down, change in bandwidth, router queue size, network delay, and other variables), the routing algorithms should quickly adjust to the new situation and choose the next best route to replace the old ones which are not accessible any more.
Switching - transport of packets over networks.
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
"Gateway" is a term that once used to refer to a routing device. Today, in the TCP/IP world, the term "router" is used to describe such a device. The term gateway now refers to special-purpose devices, that perform protocol conversions. Gateways implement application layer conversions of information received from various protocols.
Illustration of a Gateway

Computer Tips ~ Tech Secrets
Save energy!!! If you can turn your computer(s) off at night do so, if you need them on at least turn off the monitor. you will be surprised how much you can save on your electric bill.