Network routers are essential devices in computer networking that serve as the central point of communication between different networks.
They operate at the Network Layer (Layer 3) of the TCP/IP networking model and are responsible for routing data packets between networks based on the source and destination IP address of the packet, enabling data to travel between devices on different subnets or even across the internet.
Home network routers are usually combined devices that also include:
What is the purpose of a router?
Packet Forwarding
Routers are responsible for forwarding data packets between networks. When a router receives a packet, it examines the destination IP address and makes routing decisions to determine the most efficient path for the packet to reach its destination.
Routing is the core function of a router. Routers use routing tables and algorithms to determine the best path for data packets to travel. They maintain these routing tables, which contain information about network destinations and associated next-hop routers or interfaces.
Routers segment larger networks into smaller subnets. This segmentation is crucial for optimizing network performance, enhancing security, and simplifying network management.
Routers enable communication between devices on different networks or subnets. They accomplish this by routing data packets based on destination IP addresses.
Routers can assign IP addresses to devices within a local network, typically using DHCP (Dynamic Host Configuration Protocol).
Routers often perform NAT, which allows multiple devices on a local network to share a single public IP address when communicating with external networks, such as the internet.
Some routers support QoS features, allowing administrators to prioritize certain types of network traffic, such as streaming data or VOIP
Many routers include firewall features to protect the network from unauthorized access and external threats.
What is the purpose of a firewall?
A routing table contains information about network routes and is used to determine the best path for forwarding data packets from the source to the destination within a network.
How a Routing Table Works:
When a router receives a data packet from a connected device, it examines the packet's destination IP address.
The router looks up the destination IP address in its routing table. It searches for the most specific matching route (longest prefix match) in the table.
If a matching route is found in the routing table, the router determines the next hop or gateway to which the data packet should be sent, as well as the outgoing network interface. If no specific matching route is found for the destination IP address, the router may use a default route (0.0.0.0/0) to send the packet to a default gateway or the internet.
The router forwards the data packet to the next hop router or directly to the destination network through the specified network interface.
If the destination is not in the same local network, the process repeats at each hop until the packet reaches its final destination.