# Routing
Last edited: 2026-02-05
The process of routing is delivering a packet to the network associated with its IP address . To do this all routers store a routing table which maps the tuple of an IP address and a network mask to either an interface or an IP address.
There are two types of routing: intradomain routing , how routers exchange information within the same Autonomous System (AS) , and interdomain routing , how routes get shared between Autonomous System (AS) .
There are three ways a router can populate its routing table:
- Directly connected: This is for networks directly connected to the router. It adds an entry for that network and the interface of the router it is connected to.
- Static route: This is a route that has been manually configured on a router. Instead of an interface it will have an IP address to forward that packet on to.
- Dynamic routing: This is the same in structure as the static route but instead of being manually added this gets populated by routers sharing known addresses with one another.
This table might grow very large but routers use route summarization to keep the tables shorter.
Once a router has been configured, when it receives a packet it looks at its layer 3 header containing the destination IP address. It compares that against the known addresses, using the network mask and finds the most precise match (matching on the longest network mask ) then forwards it to that interface or IP address.