A router is a device which works at OSI layer 3 (Network layer) level and is responsible for transferring data packets from one network to another.The objective of the router is to reduce the amount of broadcast domains in a network as a router does not forward broadcast domains

Router determines where to send the packet based on the destination ip address of the packet and refer its routing table to determine the best path to reach a specific network

IPV4 Packet header format

There are different type of router as mentioned below:

Home Router

This router is responsible for transferring data from our computer to the router which then allows us to talk to our ISP and connect to the internet.This router can provide wireless or wired connection for our home devices and transfer all the request to visit sites or resources to the internet using our router

Distribution Router

They are mainly used in corporate enterprise networks and are responsible for transferring data from local LAN to another LAN network. So if a device on 192.168.1.0/24 network wants to talk to a device on 192.168.2.0/24 network they have to pass through a distribution router to send traffic between each other

Edge Router

Edge routers are also called boundary routers and run BGP routing protocols to talk to other networks externally or ISP and exchange the required routes between each other . All distribution routers connect to the core router to send data to the outside network.

Simple packet communication process:

When a PC on 172.16.1.0/24 network wants to send a packet to a computer on network 192.168.1.0/24 it sends it to the router. The router will look at the destination address and check if that address is there in its routing table. In our case, the routing table has information which states that 192.168.1.0/24 network goes from port eth0/2 in its routing table

The packet exits from port eth0/2 and reaches the destination on the other end.