Recent from talks
Contribute something
Nothing was collected or created yet.
Routing table
View on Wikipedia
In computer networking, a routing table, or routing information base (RIB), is a data table stored in a router or a network host that lists the routes to particular network destinations, and in some cases, metrics (distances) associated with those routes. The routing table contains information about the topology of the network immediately around it.
The construction of routing tables is the primary goal of routing protocols. Static routes are entries that are fixed, rather than resulting from routing protocols and network topology discovery procedures.
Overview
[edit]A routing table is analogous to a distribution map in package delivery. Whenever a node needs to send data to another node on a network, it must first know where to send it. If the node cannot directly connect to the destination node, it has to send it via other nodes along a route to the destination node. Each node needs to keep track of which way to deliver various packages of data, and for this it uses a routing table. A routing table is a database that keeps track of paths, like a map, and uses these to determine which way to forward traffic. A routing table is a data file in RAM that is used to store route information about directly connected and remote networks. Nodes can also share the contents of their routing table with other nodes.
The primary function of a router is to forward a packet toward its destination network, which is the destination IP address of the packet. To do this, a router needs to search the routing information stored in its routing table. The routing table contains network/next hop associations. These associations tell a router that a particular destination can be optimally reached by sending the packet to a specific router that represents the next hop on the way to the final destination. The next hop association can also be the outgoing or exit interface to the final destination.
With hop-by-hop routing, each routing table lists, for all reachable destinations, the address of the next device along the path to that destination: the next hop. Assuming that the routing tables are consistent, the simple algorithm of relaying packets to their destination's next hop thus suffices to deliver data anywhere in a network. Hop-by-hop is the fundamental characteristic of the IP Internet layer[1] and the OSI Network Layer.
When a router interface is configured with an IP address and subnet mask, the interface becomes a host on that attached network. A directly connected network is a network that is directly attached to one of the router interfaces. The network address and subnet mask of the interface, along with the interface type and number, are entered into the routing table as a directly connected network.
A remote network is a network that can only be reached by sending the packet to another router. Routing table entries to remote networks may be either dynamic or static. Dynamic routes are routes to remote networks that were learned automatically by the router through a dynamic routing protocol. Static routes are routes that a network administrator manually configured.
Routing tables are also a key aspect of certain security operations, such as unicast reverse path forwarding (uRPF).[2] In this technique, which has several variants, the router also looks up, in the routing table, the source address of the packet. If there exists no route back to the source address, the packet is assumed to be malformed or involved in a network attack and is dropped.
Difficulties
[edit]The need to record routes to large numbers of devices using limited storage space represents a major challenge in routing table construction. In the Internet, the currently dominant address aggregation technology is a bitwise prefix matching scheme called Classless Inter-Domain Routing (CIDR). Supernetworks can also be used to help control routing table size.
Contents
[edit]The routing table consists of at least three information fields:
- network identifier: The destination subnet and netmask
- metric: The routing metric of the path through which the packet is to be sent. The route will go in the direction of the gateway with the lowest metric.
- next hop: The next hop, or gateway, is the address of the next station to which the packet is to be sent on the way to its final destination
Depending on the application and implementation, it can also contain additional values that refine path selection:
- quality of service associated with the route. For example, the U flag indicates that an IP route is up.
- filtering criteria: Access-control lists associated with the route
- interface: Such as eth0 for the first Ethernet card, eth1 for the second Ethernet card, etc.
Shown below is an example of what the table above could look like on a computer connected to the internet via a home router:
| Network destination | Netmask | Gateway | Interface | Metric |
|---|---|---|---|---|
| 0.0.0.0 | 0.0.0.0 | 192.168.0.1 | 192.168.0.100 | 10 |
| 127.0.0.0 | 255.0.0.0 | 127.0.0.1 | 127.0.0.1 | 1 |
| 192.168.0.0 | 255.255.255.0 | 192.168.0.100 | 192.168.0.100 | 10 |
| 192.168.0.100 | 255.255.255.255 | 127.0.0.1 | 127.0.0.1 | 10 |
| 192.168.0.1 | 255.255.255.255 | 192.168.0.100 | 192.168.0.100 | 10 |
- The columns Network destination and Netmask together describe the Network identifier as mentioned earlier. For example, destination 192.168.0.0 and netmask 255.255.255.0 can be written as 192.168.0.0/24.
- The Gateway column contains the same information as the Next hop, i.e. it points to the gateway through which the network can be reached.
- The Interface indicates what locally available interface is responsible for reaching the gateway. In this example, gateway 192.168.0.1 (the internet router) can be reached through the local network card with address 192.168.0.100.
- Finally, the Metric indicates the associated cost of using the indicated route. This is useful for determining the efficiency of a certain route from two points in a network. In this example, it is more efficient to communicate with the computer itself through the use of address 127.0.0.1 (called localhost) than it would be through 192.168.0.100 (the IP address of the local network card).
Forwarding table
[edit]Routing tables are generally not used directly for packet forwarding in modern router architectures; instead, they are used to generate the information for a simpler forwarding table. This forwarding table contains only the routes which are chosen by the routing algorithm as preferred routes for packet forwarding. It is often in a compressed or pre-compiled format that is optimized for hardware storage and lookup.
This router architecture separates the control plane function of the routing table from the forwarding plane function of the forwarding table.[3] This separation of control and forwarding provides uninterrupted high-performance forwarding.
See also
[edit]References
[edit]- ^ F. Baker (June 1995). Requirements for IPv4 Routers]. RFC 1812.
- ^ F. Baker & P. Savola (March 2004). Ingress Filtering for Multihomed Networks. doi:10.17487/RFC3704. RFC 3704.
- ^ Forwarding and Control Element Separation (ForCES) Framework, L. Yang et al., RFC3746, April 2004.
External links
[edit]- IP Routing from the Linux Network Administrators Guide
Routing table
View on GrokipediaFundamentals
Definition and Purpose
A routing table is a data structure, typically comprising the routing information base (RIB), that stores rules and entries used by routers and Layer 3 switches to determine the next-hop address or outgoing interface for IP packets based on their destination addresses.[5][6] It holds information about reachable networks, including prefixes and associated metrics, derived from static configurations or dynamic routing protocols, and serves as the core component for making forwarding decisions in IP networks.[7] The primary purpose of a routing table is to enable efficient and scalable packet forwarding across interconnected networks by mapping destination IP prefixes to specific next-hop routers or interfaces, thereby facilitating reliable internetwork communication in IP-based systems.[8] This mapping supports the core functionality of the Internet Protocol (IP), where routers consult the table to select optimal paths, often using longest prefix matching to resolve ambiguities in address lookups.[9] Without a routing table, devices could not dynamically route traffic beyond local segments, limiting networks to isolated operation. For instance, in an IPv4 network, a basic routing table entry might specify the destination prefix 192.168.1.0/24 with a next-hop interface such as eth0, directing all packets destined for that subnet to the appropriate local port. The concept of routing tables originated with the ARPANET in the late 1960s and 1970s, where Interface Message Processors (IMPs) maintained dynamic tables for packet switching across the initial four-node network, evolving into the sophisticated distributed systems that underpin today's global Internet.[10]Historical Development
The development of routing tables began in the late 1960s with the ARPANET, the precursor to the modern Internet, where Interface Message Processors (IMPs) implemented the first distributed routing algorithms to forward packets across the network.[11] The original ARPANET routing algorithm, deployed in 1969, was a distributed adaptation of the Bellman-Ford method that measured link costs based on instantaneous queue lengths plus a constant, with each IMP exchanging its entire routing table with neighbors every 2/3 of a second to compute shortest paths dynamically.[11] This approach marked a shift from purely manual configurations in earlier computer networks to automated table updates, though it suffered from instabilities like routing loops due to volatile metrics.[11] By the early 1970s, as ARPANET expanded, the algorithm evolved to use averaged delays over 10-second intervals and adopted a shortest-path-first (SPF) computation in 1979, reducing update frequency to every 50 seconds for greater stability.[11] In the 1980s, the rise of IP-based networks necessitated standardized protocols for populating routing tables across diverse systems, leading to the introduction of distance-vector routing via the Routing Information Protocol (RIP). RIP, first implemented in BSD Unix in 1982 and formally specified in RFC 1058 in 1988, enabled routers to periodically broadcast their full routing tables to neighbors, using hop count as the primary metric to select paths up to 15 hops away. This protocol addressed the needs of growing local area networks but highlighted limitations in scalability for larger topologies. To overcome these, link-state routing emerged with Open Shortest Path First (OSPF) in 1989, as defined in RFC 1131, where routers flood link-state advertisements to build a complete topology map and compute paths using Dijkstra's algorithm, allowing more efficient table maintenance in hierarchical networks. Concurrently, the Border Gateway Protocol (BGP), introduced in RFC 1105 that same year, adapted routing tables for inter-domain use by exchanging path attributes rather than metrics, supporting policy-based decisions essential for the Internet's explosive growth.[12] The early 1990s brought challenges from IPv4 address exhaustion and exploding routing table sizes, prompting the adoption of Classless Inter-Domain Routing (CIDR) in 1993 through RFC 1519.[13] CIDR introduced variable-length subnet masking and prefix aggregation, enabling routers to summarize multiple networks into single entries, which dramatically reduced global BGP tables from approximately 20,000 entries in the early 1990s to more manageable sizes by consolidating routes.[13] This adaptation was crucial for sustaining Internet scalability without widespread address renumbering. In the 2010s, routing tables integrated with Software-Defined Networking (SDN) paradigms, shifting from distributed protocols to centralized control planes that programmatically install forwarding rules.[14] OpenFlow, proposed in a 2008 ACM SIGCOMM paper and standardized in version 1.0 by the Open Networking Foundation in 2009, separated control from data planes, allowing SDN controllers to compute and push optimized routing tables to switches dynamically.[14] This evolution addressed the rigidity of traditional protocols in data centers and clouds, enabling rapid adaptation to traffic patterns and security needs.Structure and Entries
Key Fields in Entries
A routing table entry typically consists of several core fields that collectively determine how packets are forwarded toward a destination. The destination prefix identifies the target network or subnet, expressed in Classless Inter-Domain Routing (CIDR) notation, such as an IPv4 subnet like 192.168.1.0/24 or an IPv6 prefix like 2001:db8::/32; this field defines the range of addresses matched by the entry.[15] The next-hop address specifies the IP address of the adjacent router or device to which packets matching the prefix should be forwarded, enabling the chain of hops across the network.[15] The outgoing interface indicates the local network interface (e.g., Ethernet0/1) through which the packet exits the router, which is crucial for link-specific forwarding decisions.[15] The metric represents a numerical cost associated with the path to the destination, calculated based on protocol-specific factors like hop count in RIP or bandwidth-derived cost in OSPF; lower metrics indicate preferable paths within routes from the same source.[16] The administrative distance (AD) provides a measure of the route source's trustworthiness, ranging from 0 to 255, with lower values prioritized when multiple sources advertise the same prefix; for instance, directly connected routes have an AD of 0, static routes have 1, OSPF routes have 110, and external BGP routes have 20.[16] Optional fields enhance flexibility in route management. The protocol source denotes the origin of the entry, such as "static" for manually configured routes, "OSPF" for those learned via the Open Shortest Path First protocol, or "BGP" for Border Gateway Protocol advertisements, aiding in troubleshooting and policy application.[15] A route tag is a 32-bit identifier attached to routes, often used in policy routing or redistribution scenarios to filter or manipulate specific paths without altering core attributes.[17] For dynamic entries, a validity timer tracks the route's expiration, such as the 180-second invalid timer in RIP, after which the entry is marked invalid if no update is received, ensuring timely removal of obsolete paths.[18] An illustrative IPv4 routing table entry might appear as: destination prefix 10.0.0.0/8, next-hop 192.168.1.1, outgoing interface eth1, metric 2, administrative distance 110, protocol OSPF; this indicates an OSPF-learned path to the 10.0.0.0 network via the specified next hop and interface.[15] These fields interact to facilitate robust path selection: administrative distance first resolves conflicts between sources, then metric refines choices within a protocol, with equal metrics enabling equal-cost multipath (ECMP) load balancing across multiple next hops or interfaces to optimize bandwidth utilization.[19] For IPv6, the fields mirror those for IPv4 but incorporate IPv6-specific prefixes and addresses, maintaining compatibility in dual-stack environments.[20]Entry Types and Formats
Routing table entries are categorized into three primary types based on their origin and scope. Connected routes represent directly attached networks or subnets to the router's interfaces, automatically populated with a metric of zero for immediate forwarding without intermediate hops. Local routes pertain to the router's own IP addresses on its interfaces, enabling the device to process packets destined for itself, such as management traffic or loopback addresses. Indirect routes, also known as remote routes, cover destinations learned from neighboring routers via protocols or static configuration, specifying a next-hop address beyond the local interfaces.[21] The format of routing table entries varies depending on the router's scale and implementation requirements. In small-scale routers, entries are often stored as flat lists or simple arrays, allowing straightforward linear searches suitable for networks with limited routes. For large-scale deployments, such as those handling BGP tables, hierarchical structures like tries (prefix trees) are employed to optimize storage and enable efficient longest prefix matching during lookups, reducing memory access times by organizing entries based on common prefix bits.[22] IPv4 and IPv6 routing table formats differ primarily in address length and prefix granularity. IPv4 entries use 32-bit addresses with prefix lengths up to /32, supporting variable-length subnet masking for flexible aggregation. In contrast, IPv6 employs 128-bit addresses with longer typical prefixes, such as /64 for subnets, allowing for hierarchical allocation but requiring expanded storage for the larger address space and extended prefix matching.[23] Protocol-specific variations introduce additional attributes to entry formats for enhanced decision-making. In BGP, entries within the Routing Information Base (RIB) include the AS-path attribute, a sequence of Autonomous System numbers tracing the route's traversal path to prevent loops and inform policy-based selection. OSPF routing table entries incorporate link-state identifiers, such as the originating router ID or network LSA details, which reference the underlying link-state database for intra-domain path computation. These attributes, like metrics, may be referenced briefly within entries but are detailed in protocol specifications. Routing tables are typically stored in high-speed memory as arrays, hash tables, or databases to facilitate rapid access. Enterprise routers commonly hold hundreds to a few thousand entries for internal networks, while core Internet routers manage millions, with the global BGP IPv4 table reaching 1,038,923 entries as of November 2025 due to ongoing prefix growth.[24]Population and Maintenance
Static Population Methods
Static population methods for routing tables involve manually entering and maintaining route entries through administrative configuration, bypassing automated discovery mechanisms provided by routing protocols. This approach establishes fixed paths for traffic forwarding, ensuring consistent behavior in stable network environments. Administrators typically use command-line interfaces (CLI) or configuration files to define these routes, specifying destination prefixes, masks, and next-hop details.[4] A primary method is direct manual configuration via CLI commands on network devices. In Cisco IOS, theip route command adds a static route by denoting the target network, subnet mask, and either the next-hop IP address or outgoing interface. For example, the command ip route 172.16.0.0 255.255.0.0 10.1.1.1 installs a route directing all traffic destined for the 172.16.0.0/16 subnet to the next-hop router at 10.1.1.1, populating the routing table with this fixed entry. Similar syntax exists in other platforms, such as Juniper's set routing-options static route for defining destination prefixes and next hops.[4][25]
Default routes provide a simplified static entry for handling unspecified destinations, using the prefix 0.0.0.0/0 to match all traffic and forward it to a designated gateway, such as an ISP router. This method reduces the need for exhaustive route listings in peripheral devices by relying on upstream routers for further resolution.[26]
Static route summarization, or aggregation, consolidates multiple contiguous subnets into a single broader entry to optimize table efficiency. For instance, individual routes for 10.1.1.0/24 and 10.1.2.0/24 can be replaced by a summary route of 10.1.0.0/16 pointing to a common next hop, minimizing entry count while preserving reachability for the covered ranges. This technique is manually configured similarly to standard static routes but requires careful prefix alignment to avoid coverage gaps.[27]
These methods offer advantages such as straightforward implementation without requiring routing protocol software, resulting in negligible CPU, memory, or bandwidth overhead from updates. They provide predictable forwarding paths, enhancing security by limiting route advertisement exposure and avoiding convergence delays.[28]
Drawbacks include the manual effort required for entry creation and maintenance, which scales poorly in expansive networks and demands thorough topology knowledge to prevent errors. Additionally, static routes lack inherent fault tolerance, failing to reroute around link or device failures without administrator intervention.[28]
Static population finds application in edge networks connecting to service providers, stub autonomous systems with single egress points, and as backup configurations for critical paths. For example, a stub router might use a default static route to forward all outbound traffic to its ISP gateway, simplifying management in low-complexity setups.[25][26]
