WHAT IS A ROUTER

A router is a device that acts as a medium for interconnecting several PCs. If a PC named compA wants to send data to compB, the router will choose the best path within the network and send data. This is one of the main advantages of using a router to connect several PCs since other devices like hubs simply accept data from a PC and broadcast it to all machines on the network.

Routers basically operate in two planes, one of which is the Control plane where the router grasps the outgoing interface to determine how to forward a packet to a destination. Nowadays Wi-Fi routers are used to avoid cabling issues. Below is an image of a Wi-Fi router.

WHAT DOES IT CONTAIN

Routers contain an operating system, RAM, NVRAM and flash memory. For parallel processing, some high-end routers also contain application-specific integrated circuits and multiple processors. Other high-end routers even include multiple ASICs to allow connectivity of LAN, MAN, WAN or different connections.

Considering a scenario where less terminals would be connected and traffic would be less, a simple router can be used to cut down expenditure. For a much cheaper option, use of software like XORP or Quagga, you can turn an ordinary PC into a router.

HOW DOES IT WORK
The router is known as an intelligent switch since it's the only device that monitors packets sent from PC to PC on the same network and selects the best path for transferring data.

For example, if compA sends a file to compB, the router takes note of compA's address and vice versa. All addresses are stored in a table known as the routing table. This table also stores information such as connection priority and rules for handling traffic. Thus the router ensures that a packet reaches its proper destination.

Another job of a router is that it joins two networks and performs translations of various protocols between the networks. It also makes sure that packets from one network are not sent across another network. As more and more PCs are attached to the router, it immediately saves their address into its routing table. This is done only once for each Pc.

For costs saving purposes, multiple PCs can be connected to a single switch and thereafter the switch can be connected to a router using straight cables.