A router is a networking device that moves data between different networks, helping computers, phones, servers, and other connected devices communicate with one another. In a typical home, a router connects the local network to the internet and directs data between devices inside the home and destinations beyond it.
Although routers are often associated with Wi-Fi, wireless connectivity is only one part of the picture. A router’s primary job is to determine where data needs to go and forward it toward the appropriate destination. It does this by examining information in network packets, consulting routing information, and selecting a suitable path through interconnected networks.
Routers form an essential part of modern communication. They connect home networks to internet service providers, link networks across businesses and data centers, and help carry information across the global internet.
What a router does in a network
Devices communicate over networks by exchanging data in small units called packets. A packet contains a portion of the information being transmitted, along with addressing and control information that helps networking equipment deliver it correctly.
A router examines the destination address in each packet and decides where to forward it. If the destination belongs to a network directly connected to the router, the packet may be sent there. If the destination lies elsewhere, the router forwards it toward another router or network that can bring it closer to its destination.
Consider a laptop loading a website hosted on a remote server. The laptop sends packets toward the server’s internet protocol address, commonly called an IP address. The home router receives those packets and forwards them toward the internet service provider’s network. Additional routers carry them across other networks until they reach the destination network.
The server’s responses travel back through the network, potentially following a different route. The home router then helps deliver the returning traffic to the appropriate device on the local network.
This process happens rapidly and repeatedly. A single online activity may involve many packets, each of which must be forwarded through the network as efficiently and reliably as possible.
A router does not normally need to understand the meaning of the information inside each packet. It primarily uses network-level addressing and routing information to make forwarding decisions. This separation allows the same networking infrastructure to carry many kinds of traffic, including web pages, video, voice calls, file transfers, and online game data.
How routers decide where to send data
The central task of a router is to select an appropriate next step for each packet. To do this, it uses a collection of rules and information known as a routing table.
A routing table records which destination networks are reachable through particular next hops or network interfaces. A next hop is the next router or network device to which a packet should be sent on its way toward the destination.
When a router receives a packet, it examines the destination IP address and compares it with the entries in its routing table. The table may contain routes to specific networks, routes to larger groups of networks, and a default route for destinations that have no more specific match.
Routers generally use a method called longest-prefix matching to select among applicable IP routes. An IP address can be divided into a network prefix and a remaining portion used to identify an address within that range. A longer prefix identifies a smaller, more specific range of addresses.
If several routing entries match a packet’s destination, the router generally chooses the matching route with the longest prefix. This helps it direct traffic to a specific destination network when a more general route is also available.
For example, a router might have a route for a broad range of internet addresses and another route for a smaller network within that range. Traffic addressed to the smaller network follows the more specific route, while other matching destinations use the broader one.
If no more specific route matches, the router may use its default route. On a home network, that route typically points toward the internet service provider. The router does not need to store a separate destination entry for every website in order to forward traffic toward the wider internet.
A routing table is not necessarily a complete map of the internet. Instead, it contains the information the router needs to make forwarding decisions within its role in the network. The router usually determines only the next step, leaving subsequent routers to make their own decisions.
How routing tables are created and updated
Routers can learn routes in several ways. In a small home network, much of the routing information is configured automatically when the router establishes its local network and connects to the internet service provider.
A router typically knows which networks are directly connected to its interfaces. It may also have a manually configured route or receive a default route from its provider. These routes can be sufficient for a relatively simple network.
Larger networks often use dynamic routing protocols. These protocols allow routers to exchange information about network reachability and, depending on the protocol, the costs or preferences associated with different paths.
For example, an organization may operate several interconnected networks. If a connection fails, routers can exchange updated information and recalculate which paths remain available. Traffic can then be redirected through an alternative route, provided the network has one and the routing system successfully converges on the new information.
Different routing protocols solve different problems. Some are designed to find paths within an organization’s network, while others coordinate reachability between independently operated networks.
The Border Gateway Protocol, or BGP, is especially important on the public internet. Networks operated by internet service providers, companies, universities, and other organizations use BGP to advertise which IP address ranges they can reach and to exchange routing information across organizational boundaries.
BGP route selection involves policy as well as technical path attributes. The chosen route is not necessarily the physically shortest path or the one with the lowest delay. Network operators may prefer certain routes because of business agreements, security requirements, traffic engineering, or the structure of their connections.
Routing information can change as networks grow, links fail, or operators alter their policies. Routers must respond to these changes so that traffic continues to move through available paths. The exact behavior depends on the routing protocol, network configuration, and circumstances of the change.
What happens when a router forwards a packet
Routing is a decision-making process, while forwarding is the act of moving a packet toward its next destination. Although the terms are closely related, they describe different functions.
When a packet arrives at a router, the router first receives it through a network interface. It examines the packet’s headers, which contain information such as the source and destination IP addresses and the protocol used to carry the data.
The router then determines which forwarding rule applies. In many systems, routing information is used to build a forwarding table that allows packets to be processed efficiently. Specialized hardware may perform these lookups at very high speeds.
After selecting an outgoing interface and next hop, the router prepares the packet for transmission over the next network link. Because different network technologies use different methods of delivering data across a local link, the router may place the IP packet inside a new link-layer frame.
For example, when a packet travels from a home computer to a router over Ethernet, it is carried inside an Ethernet frame. When the router forwards the packet over another Ethernet connection, it generally creates a new frame appropriate for that outgoing link. The underlying IP packet is forwarded, with certain fields updated as required by the protocol.
One important field is the IP time-to-live value in IPv4, or the hop limit in IPv6. Routers reduce this value as packets pass through them. If it reaches zero, the packet is discarded. This mechanism prevents packets caught in persistent routing loops from circulating indefinitely.
A router also checks whether the packet can be transmitted over the next link. If a packet is too large for that link, the router’s response depends on the IP version, the packet size, and the applicable network conditions. IPv4 and IPv6 handle these situations differently, and successful communication may require the sender to adjust packet sizes.
Once the packet is ready, the router transmits it through the selected interface. The next router repeats the process, using its own routing information to decide where the packet should go next.
The process continues until the packet reaches its destination network or encounters a condition that prevents further delivery. Routing therefore works as a series of local forwarding decisions rather than a single end-to-end command issued by one central device.
How a home router connects local devices to the internet
A typical home router performs several related functions that are often combined in one physical device. Understanding these functions helps explain why the word router is sometimes used to describe equipment that does more than routing alone.
The routing function connects the home network to other networks. Inside the home, devices usually receive private IP addresses, such as addresses from the ranges reserved for private networks. These addresses allow devices to communicate locally without requiring each one to have a publicly reachable internet address.
The router’s local interface serves as a gateway for devices that need to reach destinations outside their own network. A gateway is a device that provides a path from one network to another. When a laptop sends traffic to a remote website, it generally forwards that traffic to the router’s local IP address.
Many home routers also perform network address translation, or NAT. NAT modifies address information as packets pass between networks. In the common IPv4 configuration used in homes, the router translates traffic from multiple private local addresses to a public address assigned to the internet connection. It keeps track of the relevant translations so returning traffic can be associated with the correct local device and connection.
NAT is useful because private IPv4 addresses are not directly routable across the public internet, and the public IPv4 address space is limited. However, NAT is not the same thing as routing. Routing determines where packets should go, while NAT changes selected address information as packets pass between network boundaries.
Home routers commonly provide Dynamic Host Configuration Protocol (DHCP), which automatically assigns local IP configuration to devices. This usually includes an IP address, a subnet mask or prefix length, and a default gateway. A router may also act as a DNS forwarder, passing domain name lookup requests to another DNS resolver so devices can translate names such as website addresses into IP addresses.
Wi-Fi is another frequently integrated function. A wireless access point allows devices to connect to the local network over radio signals rather than physical cables. The access point handles the wireless link, while the router determines how IP traffic moves between the local network and other networks.
In many households, the modem or optical network terminal that connects to the internet service provider is a separate device. In other setups, several functions are integrated into one unit. The exact arrangement varies, but the underlying networking roles remain distinct even when they share the same enclosure.
How routers differ from switches, modems, and access points
Routers are often confused with other networking devices because these devices work together to deliver connectivity. Their functions, however, are different.
A network switch primarily connects devices within a local network. It commonly uses Ethernet hardware addresses, also called MAC addresses, to forward frames to the appropriate local ports. A switch can support communication among computers, printers, servers, and other devices without routing their traffic to another IP network.
A router forwards IP packets between networks. When a computer communicates with another device on the same local IP network, the traffic may remain within that network and pass through a switch or wireless access point without requiring a router to forward it between networks. When the destination is outside the local network, the device generally sends the traffic to its default gateway.
A modem connects equipment to a particular type of communications service by converting or adapting signals according to the technology used by that service. Cable and DSL modems, for example, use different methods to communicate over their respective access networks. Fiber connections often use an optical network terminal rather than a conventional modem. These devices do not necessarily perform the same routing functions as a home router.
A wireless access point provides Wi-Fi connectivity to a local network. It bridges wireless devices into that network but does not inherently need to perform the broader task of routing traffic between separate IP networks. A wireless access point can operate alongside a dedicated router or be built into the same device.
These distinctions matter when troubleshooting connectivity. A device may be able to connect to Wi-Fi but still lack internet access because the router’s upstream connection has failed. Alternatively, the internet connection may be working while a local wireless problem prevents a device from joining the network.
Because manufacturers frequently combine routing, switching, Wi-Fi, firewall, DHCP, and NAT functions in a single product, the physical device alone does not reveal which component is responsible for a particular problem.
How routers help traffic reach its destination efficiently
The internet is a network of networks. It has no single router that directs every packet, and no individual router needs a complete picture of every connection along a packet’s journey.
Instead, each router makes decisions using the information available to it. A packet may cross networks belonging to several internet service providers, large technology companies, research institutions, and other organizations before reaching its destination.
The efficiency of this system depends partly on how routers select paths and how networks connect to one another. A route must be reachable, but it may also be preferred or avoided for reasons involving capacity, policy, reliability, and cost.
Some routing systems calculate routes using metrics such as link cost, hop count, or other measures defined by the routing protocol. Other systems, particularly interdomain routing on the public internet, place substantial emphasis on administrative policy. As a result, the route selected by a router is not always the one that appears shortest on a map.
Routing also differs from congestion management. A router may know which outgoing path is preferred without having a complete view of the traffic conditions across the entire network. When packets arrive faster than a router can transmit them, they may wait in a queue. If the queue fills, additional packets may be dropped.
Network performance therefore depends on more than routing decisions. Available bandwidth, delay, packet loss, processing capacity, congestion, and the performance of the destination server can all affect the user experience. A well-chosen route cannot guarantee a fast connection if a link along the way is overloaded or the destination is slow to respond.
Networks also use techniques beyond ordinary routing to improve performance and reliability. Traffic can be distributed across multiple links, important traffic can receive preferential treatment under configured quality-of-service policies, and some services can deliver content from servers located closer to users. These techniques complement routing but are not identical to it.
What happens when a route fails
Network connections are not permanent. A cable can be disconnected, a router can lose power, a fiber link can be damaged, or an operator can take equipment offline for maintenance. Routing systems must accommodate such changes if traffic is to continue flowing.
When a failure affects a known path, a router may stop using the affected route and select an alternative. Dynamic routing protocols help participating routers communicate changes in reachability and update their routing tables. In networks with suitable redundancy, traffic can then move through another available connection.
This recovery is not always immediate. Routers may need time to detect a failure, exchange routing information, and recalculate paths. During that interval, packets can be delayed or lost. The duration and impact depend on the network design, the type of failure, and the routing mechanisms in use.
Some failures are harder to detect than a complete link outage. A connection may remain electrically active while silently dropping packets or delivering them unreliably. Routing protocols and network monitoring systems use different mechanisms to detect and respond to such conditions, but no single mechanism identifies every possible failure perfectly.
Routing loops are another potential problem. A loop occurs when routers repeatedly forward packets among one another without making progress toward the destination. Routing protocols are designed to limit or prevent these situations, while IP’s time-to-live and hop-limit mechanisms ensure that individual packets cannot circulate indefinitely.
Redundant links and alternative routes improve resilience, but redundancy alone is not enough. A network must be configured so that its routing system can recognize failures and use alternatives correctly. Two seemingly separate connections may also share infrastructure, leaving both vulnerable to the same physical disruption.
How routing relates to network security
Because routers connect networks, they occupy an important position in network security. Their configuration can influence which traffic enters or leaves a network, which devices can communicate, and how the network responds to unwanted or unexpected traffic.
Many routers include firewall functions that apply rules to packets and connections. These rules can permit, block, or restrict traffic based on factors such as addresses, protocols, ports, and connection state. A firewall is a security function, not the same thing as routing, although both may operate on the same device.
Network address translation in a home router can make unsolicited inbound connections more difficult when no suitable translation or forwarding rule exists. However, NAT should not be treated as a complete security system. It does not replace firewall rules, secure device configurations, software updates, or careful control of remote access.
Routers themselves must also be protected. Weak administrative passwords, outdated firmware, exposed management interfaces, and insecure configurations can create opportunities for unauthorized access. On larger networks, incorrect routing information can misdirect traffic, interrupt connectivity, or expose data to unintended paths.
Secure routing depends on the environment. Home users generally benefit from keeping router software updated, changing default administrative credentials, using modern Wi-Fi security, and disabling management features they do not need. Organizations may also use network segmentation, access controls, route filtering, and additional validation mechanisms to reduce risk.
Routing does not ordinarily guarantee that data is confidential or authentic. Those properties are generally provided by security protocols such as Transport Layer Security, which protects many web connections, and by other mechanisms designed for encrypted communication and identity verification.
Why routers are essential to the internet
The internet works because independently operated networks can exchange data using common protocols and agreed methods of addressing and routing. Routers make that interconnection practical by forwarding packets from one network toward another without requiring every network to use the same internal equipment or structure.
The system is distributed. Each router makes decisions based on its own interfaces, forwarding information, and routing policies, while routing protocols help networks learn which destinations are reachable. This allows the internet to expand, adapt to changing connections, and continue operating despite many localized failures.
That flexibility also creates complexity. Routes can change, links can become congested, and administrative policies can influence how traffic moves. The path between two devices may vary over time, and packets belonging to the same communication do not necessarily follow identical routes.
A router’s essential task remains straightforward: inspect the destination information in a packet, determine the appropriate next step, and forward the packet toward its destination. The sophistication lies in coordinating these decisions across enormous numbers of devices and independently managed networks.
From a home video call to communication between distant data centers, routers provide the mechanisms that allow separate networks to function as parts of a larger connected system.