What is router ?
An apparatus that links two or more packet-switched networks or subnetworks is called a router. By forwarding data packets to their intended IP addresses, it manages traffic between these networks and let numerous devices to share an Internet connection. These are its two main roles.
Although there are many different kinds of routers, most of them transfer data between WANs (wide area networks) and LANs (local area networks). A LAN is a collection of networked devices that are limited to a certain region. Typically, a LAN needs just one router.
A wide area network (WAN) is a network that is stretched out over a big geographic area. For example, large organizations and businesses with several sites across the nation will require individual LANs for each location, which link to the other LANs to form a WAN. A WAN frequently requires numerous routers and switches* due to its wide distribution.
How does a router work?
Consider a router as an ATC, and consider data packets as planes flying to various airports (or networks). Just as each plane has a unique destination and follows a unique route, each packet needs to be guided to its destination as efficiently as possible. A router assists in directing data packets to their intended IP address, just how an air traffic controller makes sure that planes arrive at their destinations without getting lost or experiencing significant disruptions on route.
A router employs an internal routing table, which is a collection of pathways to different network destinations, to efficiently direct packets. After identifying the destination of a packet by reading its header, the router uses the routing table to calculate the fastest route to that location. The packet is subsequently forwarded to the following network along the path.
What is the difference between a router and a modem?
They are not the same, even though some Internet service providers (ISPs) may combine a router and a modem into one unit. Each has a unique but crucial function in tying networks to the Internet and to one another.
A modem links networks to the Internet, while a router establishes them and controls data flow both within and between them. By transforming signals from an ISP into a digital signal that can be understood by any connected device, modems create a connection to the Internet.
To connect to the Internet, a single device can plug into a modem; alternatively, a router can help spread this signal among numerous devices connected to an established network, enabling all of them to connect to the Internet at once.
Consider it this way: Bob can establish a LAN and transport data between the devices connected to it if he only has a router and no modem. He won't be able to link that network to the Internet, though. In contrast, Alice lacks a router but does have a modem. She will be able to link one device—her work laptop, for instance—to the Internet, but she won't be able to share that connection with other devices—her laptop and her smartphone
Carol on the other hand, has a modem and a router. She can connect her smartphone, tablet, and desktop computer to the Internet simultaneously by forming a LAN with both devices.