gurfin / ENCOR #3 – IP Routing Essentials

Created Mon, 20 Jan 2025 22:08:00 +0100 Modified Wed, 22 Jan 2025 23:03:43 +0000
586 Words

The basics of routing

When traffic needs to traverse different networks it must be routed. This is usually done in a router (hence the name). In order for a router to send a packet correctly, it must know which interface to route the packet out of, and in the case of non point-to-point links it also needs to know which L2 device to send the frame to. In order to do this the router will keep a table of all the currently active routes which will then be used to program the ASICs with. This table is known as the Routing Information Base (RIB) and contains information like prefix, which process the prefix was sourced from, administrative distance, which interface it should be forwarded on, the next hop IP-address and so on.

Once the RIB has been populated with information the router then distils the RIB into the Forwarding Information Base (FIB), which is the low level table used in the ASICs. The FIB is, thus, a very low level, real view of what the ASICs have been instructed to do.

Different types of routes

There are a few different types of routes. This usually refers to what the primary feature of the route is.

  • Directly attached routes
    • These are routes that do not require being routed more hops. The interfaces that are configured and up, will inject a directly attached route in the RIB.
  • Recursive static routes
    • These are routes that have been statically set and need to be routed more hops.
  • Fully specific static route
    • This is a recursive route which also has a outgoing interface statically configured.
  • Floating route
    • This is a route which is not entered into the RIB, but rather lays idle in the background until certain RIB criteria have been achieved. This is, for example, used to allow for secondary routes for redundancy reasons.
  • Null/blackhole routes
    • This is a special type of route which tells the router to drop the packets that match this entry in the RIB. This is done without having a noticeable impact on CPU load.

Where do routes come from?

Routes can originate from may different processes. The simplest are the local, directly connected and static routes but there are also dynamic routes. These originate from dynamic routing protocols, which allows the router to dynamically learn which networks are available via the other routers in the network. There are many pros to using dynamic protocols, even though they usually demand more of the device. Most devices now a days are able to handle quite heavy loads from the routing protocols, except if you are doing big stuff like DFZ.

Regardless of which process is the source of a route, the next-hop address of a recursive route must be reachable. If the next-hop route is not reachable the route will not be placed in the RIB.

Dynamic routing protocols

There are a few different flavors of routing protocols that all have different pros and cons. There are a few general types that the protocols can be split into:

  • Distance vector protocols
    • Example protocols: RIP and EIGRP (ish)
    • Uses hop-count and outgoing interface to determine which routes should be entered into the RIB.
  • Link state protocols
    • Example protocols: OSPF and ISIS
    • Maps the entire network and then uses this map locally on each router to determine which are the optimal routes to enter into the RIB.
  • Path vector protocols
    • Example protocol: BGP
    • This uses a bunch of different attributes passed with each route to calculate the best path.