4 Routing and Internetworking

Learn how routers forward IP packets, how routes are selected and exchanged, and how routing information can be secured.

How routers forward packets

A connects two or more networks. When a packet arrives, it examines the packet’s IP header, consults its forwarding information, and chooses an outgoing interface and, when needed, a next-hop . It then sends the packet using the link-layer framing appropriate to that network.

Each makes its own forwarding decision, so a packet may cross several routers before reaching its destination. For example, a laptop sending data to a server on another IP network first forwards the packet to its local . That may pass it to another , which forwards it onward. The destination IP address guides these decisions; the link-layer address used to deliver a frame is relevant to the current local link.

Routing tables and forwarding information

A holds routes a can use to reach destination networks. A route commonly includes a destination network prefix, a next hop or an indication that the network is directly connected, an outgoing interface, and a or other information used to compare candidate routes.

Routers may learn routes from directly connected interfaces, from manual configuration as static routes, or from routing protocols. The table used for route selection is often called the . The selected forwarding entries are installed in a for packet lookups.

How routers select routes

When more than one destination prefix matches a packet, IP forwarding generally uses : it chooses the matching route with the most specific prefix. For example, given routes for 10.0.0.0/8 and 10.2.0.0/16, a packet addressed to 10.2.4.7 uses the /16 route because it matches more leading address bits.

A default route, such as 0.0.0.0/0 for IPv4, is the least-specific route and can be used when no more-specific route matches. Prefix specificity is not the only consideration: when candidate routes have the same destination prefix, the applies selection rules and policy, such as preferring one source of routing information or a better .

A is a protocol’s measure of route cost. Its meaning depends on the protocol. A lower might represent fewer hops or a lower configured link cost, but does not necessarily mean the path is faster in every real-world condition.

Routing protocols and administrative scope

A routing protocol lets routers exchange information about reachable networks and paths. This allows routing to adapt when network links or routers change. A static route is configured manually and does not automatically learn a replacement path unless additional configuration provides one. Routing protocols calculate and share routes; routers then use selected routes to forward packets.

Networks under a common administrative organization are often described as an . Routing protocols are commonly grouped according to where they operate:

  • Interior Gateway Protocols (IGPs) exchange routes within an AS; RIP and OSPF are examples.

  • Exterior gateway routing exchanges routes between ASes. BGP is the Internet’s principal inter-domain routing protocol.

Distance-vector, link-state, and path-vector routing

Routing protocols use different approaches to share and select routes.

  • : A shares route distances and next-hop information with neighbors. RIP is an example. Its is hop-based: a value of 1616 means unreachable, and 1515 is the largest usable . This makes RIP intended for relatively small networks.

  • : Routers distribute information about their local links. Each builds a topology database and calculates shortest paths from itself. OSPF is a link-state IGP; it uses link costs and can support equal-cost paths.

  • : Routers advertise reachable prefixes along with path information and attributes used for policy-based selection. BGP exchanges routes between ASes. Its decisions reflect routing policy as well as path attributes, rather than simply choosing the fewest physical links.

Routing

After a network change, routing updates take time to spread and routers take time to recalculate routes. This process is called . During , routers may temporarily have different route information, which can lead to packet loss or loops. Routing protocols use mechanisms to limit or resolve these problems, but their behavior and scale differ.

Basic routing security

Routing information affects where traffic travels, so routers should not accept or redistribute it indiscriminately. Basic practices include accepting updates only from expected neighbors, filtering invalid or unauthorized prefixes, and applying explicit policies to routes exchanged with other networks.

Protocol features such as authentication can help verify routing messages, but they do not replace careful route filtering and policy.