How a router works
Author |
Date |
Revision |
Samuel Knoppe | 4/12/2024 | 1.0 |
Related product (if any): |
N/A |
Description: | Describes what a network router is, how it works, and some basic concepts relating to its functions. |
Symptoms: |
N/A |
Cause: |
N/A |
Files Needed: |
N/A |
Steps to Correct: |
What is a router? A router is a Layer 3 network device which routes IP packets. Without it, network devices will not be able to talk to each other. It facilitates communication by creating a local area network (LAN) which devices join, and it uses a routing table to route traffic to the Internet, and other remote networks.
Routers differ from modems in that modems connect your home and business to Internet access via your ISP, whilst your router is the device which you actually connect to on your network--which your modem also connects to.
How does a router work? A router figures out the fastest path between devices connected on a network, and sends data to those paths. To do this, routers use what's called a metric value or preference number. So if a router has to choose between two routes to the same location, it will choose the one with the lowest metric. Metrics are stored and shown in the routing table. P.S., there are different ways in which a router learns routes. Routes can be learned either statically or dynamically and generally speaking, static routes tend to have a higher preference when compared to a dynamic route. How a router chooses a route to a network via static route versus a route learned via a dynamic routing protocol, is via its administrative distance (AD). So the flow is Choose lowest AD route type/protocol > Choose route with lowest metric.
The routing table is a list of all possible paths in your network. When a router receives IP packets that need to be routed to another network, the router looks at the packet's IP address and then searches the routing table for routing information. Learning about routing tables is crucial for managing networks regardless of what protocols are being used.
Managing routers involves making changes when necessary. This involves logging into your router via software, webpage, or through a terminal session. For example, you may need to change login passwords, encrypt the network, create port forwarding rules, or update the router's firmware.
NOTE: Traffic destined for another host on the same network will almost never go to the router. The network switch will used its forwarding information base (FIB) to send Layer 2 frames to the host instead.
ARP and the routing table Address Resolution Protocol (ARP) is a Layer 2 protocol that routers use to create a table that binds IP addresses to MAC addresses. Or in other words, it binds an IP address to the hardware device on the network. This is important since routers are normally Layer 3 devices on the OSI model. A router needs to know how an IP address relates to a Layer 2 MAC address, and ARP is how it figures this out.
If a host wants to send a packet to another host via it's IP address, the router will send an ARP request broadcast from which it will receive a reply with the MAC address the host needs for Layer 2 communication to be possible. From there, the router uses its own forwarding information base (FIB) to send Layer 2 frames down to downstream switches, or straight to the host machine (if directly connected to the router).
Static routes and routing protocols In order for a router to send traffic, it must use its routing table. If the router has network interfaces configured either by DHCP or manually, it implicitly knows the routes to that network and populates the routing table.
You can also configure a static route, which is where you manually define the route to a network.
There are also dynamic routes learned via routing protocols. Routing protocols dynamically discover and populate the routing table without you having to manually add routes. This can create better flexibility and scalability for larger networks. Some examples of dynamic routing protocols include:
The specifics of how each routing protocol works differs per protocol and is beyond the scope of this document, but each one has its own configuration and discovery process.
Distinguishing between metrics and administrative distance (AD) I want to distinguish this again since we know more about routing protocols.
The hierarchy of choice is to choose the route with the lowest AD. If there are multiples of routes with the same AD, it will choose the route with the lowest metric value, assuming there are multiple routes going to the same network.
Metric values are calculated based on numerous factors like the amount of hops, to more complex factors like bandwidth usage depending on the routing protocol. Another thing is that dynamic routing protocols will use their algorithms to determine the fastest possible route in order to come up with the lowest metric value route to a specific network. |
No Comments