Routing Table Structure and Stored Data | Generated by AI

Home 2026.01

Question: What does a routing table look like, and what information needs to be stored in a routing table? Specifically, does it include MAC addresses, IP addresses, and information about where to route packets?

Answer:

A routing table is a data structure maintained by routers (and IP-enabled hosts) that determines where to forward IP packets based on their destination IP address.

Typical Appearance of a Routing Table

On most systems, the routing table is displayed using commands like:

A sample routing table (from a Linux system) might look like this:

default via 192.168.1.1 dev eth0 proto dhcp metric 100 
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100 metric 100 
10.0.0.0/24 via 10.0.0.254 dev tun0 
172.16.0.0/16 via 192.168.1.50 dev eth0

Or in the traditional netstat -rn / route format:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 eth0
10.0.0.0        10.0.0.254      255.255.255.0   UG    0      0        0 tun0

Key Information Stored in Each Routing Table Entry

Each entry in the routing table typically contains the following fields:

Does the Routing Table Contain MAC Addresses?

No.
Routing tables operate at Layer 3 (IP layer) of the OSI model and do not store MAC addresses. MAC addresses are Layer 2 (data link layer) information and are handled separately by the ARP table (Address Resolution Protocol cache).

Does the Routing Table Contain IP Addresses?

Yes.

Does It Tell “Which Packet to Route Where”?

Yes.
The primary purpose of the routing table is exactly that: for a given destination IP address in a packet, perform a longest-prefix match against the destination entries to decide:

In summary:

Information Present in Routing Table? Notes
Destination IP network/prefix Yes Core field
Netmask / Prefix length Yes Defines network size
Next-hop / Gateway IP Yes (if not directly connected) IP address of next router
Output interface Yes Local interface to use
Metric / Priority Yes For route selection
MAC addresses No Handled by ARP table (Layer 2)
Source IP (sometimes) Yes For policy-based routing or interface assignment

References:


Back

x-ai/grok-4.1-fast

Donate