A routing table is the data structure in which a router or host stores known destination networks and the next hop or interface used to reach each of them. In routing it is the decision base for IP forwarding: for every packet, the device looks up the destination address in the table and sends the packet toward the most specific matching route.
Every IP-capable device has one, from a laptop with three entries to an Internet backbone router carrying the full global BGP table of roughly one million IPv4 prefixes and over 200,000 IPv6 prefixes. Routes enter the table from directly connected interfaces, manual configuration and dynamic routing protocols such as OSPF and BGP.
What a routing table entry contains
Each entry describes one destination prefix and how to reach it. The exact columns vary by operating system, but the same core fields appear on routers, servers and workstations.
| Field | Example | Meaning |
|---|---|---|
| Destination prefix | 10.20.0.0/16 | The network the route covers |
| Next hop | 192.0.2.1 | Neighbor router that receives the packet |
| Outgoing interface | eth1 or GigabitEthernet0/1 | Port used to send the packet |
| Route source | Connected, static, OSPF, BGP | How the route was learned |
| Administrative distance | 0 to 255 | Trust ranking between sources |
| Metric | Cost, hop count, path attributes | Preference among routes from one source |
A default route, written 0.0.0.0/0 for IPv4 or ::/0 for IPv6, matches every destination. It points to the default gateway and catches all traffic that no more specific entry covers, which is why most hosts need only a few entries.
How the lookup selects a route
Route selection follows the longest prefix match rule: among all entries that contain the destination address, the one with the longest prefix length wins. A packet to 10.20.5.9 therefore uses a 10.20.5.0/24 route rather than 10.20.0.0/16 or the default route.
When several sources offer the same prefix, the router first prefers the source with the lowest administrative distance, and then the route with the best metric within that source. If metrics tie, many routers install several paths and use equal-cost multipath (ECMP) to spread flows across them.
| Route source | Typical distance | Interpretation |
|---|---|---|
| Directly connected | 0 | Most trusted |
| Static route | 1 | Preferred over dynamic protocols |
| External BGP | 20 | Routes from other autonomous systems |
| OSPF | 110 | Interior link-state routing |
| RIP | 120 | Legacy distance-vector routing |
| Internal BGP | 200 | Routes learned inside the own AS |
These values are vendor defaults and can be changed, for example to create a floating static route with a distance of 250 that takes over only when the dynamic route disappears.
Routing table compared with related structures
On a router, the routing table is not the only table involved in forwarding. The routing information base (RIB) holds the best routes chosen by the control plane, while the forwarding information base (FIB) is the optimized copy that hardware uses for every packet.
| Structure | Contents | Used by |
|---|---|---|
| Protocol tables | All routes learned by one protocol, such as the BGP table | Protocol best-path selection |
| Routing table (RIB) | Best route per prefix across all sources | Control plane |
| FIB | Prefixes with resolved next hops and interfaces | Data plane forwarding |
| ARP or neighbor cache | IP-to-MAC mappings for next hops | Frame construction |
| MAC address table | MAC-to-port mappings on switches | Layer 2 forwarding |
Large routers implement the FIB in TCAM or specialized memory for line-rate lookups. Because that memory is finite, the growth of the global table is a real hardware lifecycle concern for operators of older equipment.
Reading and troubleshooting a routing table
Administrators inspect the table with commands such as ip route on Linux, route print on Windows or show ip route on network operating systems. Most connectivity problems become visible once the actual chosen route for a destination is checked.
| Symptom | Likely cause | Check or fix |
|---|---|---|
| Traffic leaves the wrong interface | More specific route overrides intent | Look up the exact destination |
| Destination unreachable | No matching route and no default | Add a route or default gateway |
| Routing loop, TTL expired | Two routers point at each other | Trace the path, fix static routes |
| Asymmetric paths | Return route differs from forward route | Align policies, check stateful firewalls |
| VPN breaks Internet access | Tunnel installs a default route | Use split tunneling where policy allows |
A common pitfall is a static route left behind after a network change; it keeps winning because of its low administrative distance. Documenting static routes and monitoring table changes prevents such silent misrouting.
The simple explanation
A routing table is like a list of road signs stored inside a router. For each destination area, it says which exit to take next.
When data arrives, the router reads the destination, finds the most precise sign that fits and sends the data that way. If no sign matches, it uses a general direction for everything else, much like a sign that says all other destinations.
How it is used in practice
A company connects its head office to a cloud provider through a private link and also has a normal Internet connection. The edge router learns the cloud prefix 172.16.0.0/16 through BGP over the private link, while a default route points to the Internet provider.
When the private link fails, the BGP route disappears and traffic would follow the default route over the Internet, where the cloud addresses are not reachable. The network team adds a floating static route toward a backup VPN tunnel with a distance of 250. The next time the link fails, the routing table switches to the tunnel within seconds, and applications stay reachable without manual action.