Prerequisite – Network Devices
A Router is a networking device that forwards data packets between computer network.
Let us understand this by a very general example, suppose you search for www.google.com in your web browser then this will be a request which will be sent from your system to the google`s server to serve that webpage, now your request which is nothing but a stream of packets don`t just go the google`s server straightaway they go through a series of networking devices known as router which accepts this packets and forwards them to correct path and hence it reaches to the destination server.
A router has a number of interfaces by which it can connect to a number of host systems.
Functions of a Router:
The router basically performs two major functions:
- Forwarding –
Router receives the packets from its input ports, checks it header, performs some basic functions like checking checksum and then looks upto the routing table to find the appropriate output port to dump the packets onto, and forwards the packets onto that output port.
- Routing –
Routing is the process by which the router ascertains what is the best path for the packet to reach the destination, It maintains a routing table which is made using different algorithms by the router only.
Architecture of a Router:
A Generic router consist of the following components:
- Input Port –
This is the interface by which packets are admitted into the router, it performs sevral key functions as terminating the physical link at router, this is done by the leftmost part in the below diagram, the middle part does the work of interoperating with the link layer like decapsulation, in the last part of the input port the forwarding table is looked up and is used to determine the appropriate output port based on the destination address.
- Switching Fabric –
This is the heart of the Router, It connects the input ports with the output ports. It is kind of a network inside a networking device. The switching fabric can be implemented in a number of ways some of the prominent ones are:
- Switching via memory: In this we have a processor which copies the packet from input ports and sends it to the appropriate output port. It works as a traditional cpu with input and output ports acting as input and output devices
- Switching via bus: In this implementation we have a bus which connects all the input ports to all the output ports.On receiving a packet and determining which ouput port it must be delivered to, the input port puts a particular token on the packet and transfers it to the bus. All output ports are able to see the packets but it will be delivered to the output port whose token has been put in, the token is then scrapped off by that output port and the packet is forwarded
- Switching via interconnection network: This is a more sophisticated network, here instead of a single bus we use 2N bus to connect n input ports to n output ports.
- Output Port –
This is the segment from which packets are transmitted out of the router. The output port looks at its queuing buffers (when more than one packets have to be transmitted through the same output port queuing buffers are formed) and takes packets, does link layer functions and finally transmits the packets to outgoing link
- Routing Processor –
It executes the routing protocols, it works like a tradition cpu. It employs various routing algorithm like link-state algorithm, distance-vector algorithm etc. to prepare the forwarding table, which is looked up to determine the forwarding table.
- Introduction of Virtual Router Redundancy Protocol (VRRP) and its configuration
- Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP)
- Difference between Modem and Router
- Configuration of Router on a stick
- Cisco Router modes
- Difference between Bridge and Router
- Difference between Router and Switch
- Hot Standby Router Protocol (HSRP)
- Difference between Router and Layer-3 Switch
- Backing up Cisco IOS Router image
- Cisco Router basic commands
- Open shortest path first (OSPF) router roles and configuration
- Network Devices (Hub, Repeater, Bridge, Switch, Router, Gateways and Brouter)
- p5.js | Introduction
- Introduction of B+ Tree
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.