Why do we need the Routing Protocol?

How do the IP packets traveling through the Internet, like cars on the highway, get to their destination? Everyone is familiar with cars. Even if we don’t know the destination, there is an electronic navigator that can lead us to the destination. Does the IP packet need similar navigation information? Yes, at the moment when IP packets enter the Internet, the navigation information is already on the way, quietly waiting for the arrival of IP packets. On every router leading to the destination, you can look up the navigation information (routing table) to determine the shortest route and hop by hop to reach the destination.

What is the Routing table?

Now that you’ve read so far, you must have a question: How is the routing table of each router generated? I won’t answer this question first, but I’ll analyze it with the electronic navigator. When you enter destination information, the electronic navigation system relies on its own map database to calculate the shortest route. This map database is pre-loaded in the navigation system, and you may need to upgrade this map database every once in a while because the global roads are developing very fast, and if you don’t update it, it may lead you into rivers or the sea …

If each router can have link information similar to the map database, it can also use the shortest algorithm to complete navigation. A protocol for exchanging link information between each router is called: routing protocol. This article just wants to bring you to speed up the so-called routing protocol. So far, you should understand what routing is, but what about the protocol? The protocol is to specify how to express this link information, how much it costs to pass through this link, and what node routers are at both ends of this link. With this information, routers can dynamically draw a map (topological diagram) of the whole network. For each destination, a routing entry is dynamically generated according to the shortest path algorithm and put into a table, which we call the routing table.

The ones who are familiar with routing protocols can easily expect that the routing protocols I talked about are OSPF and IS-IS. They are very similar. They are all link-state protocols. They first collect link information between routers, such as cost, nodes connected at both ends, and types of links, and then run an algorithm similar to the shortest path to generate routing table information.

Which routing protocol to choose?

So similar, why? ! These are two agreements developed in parallel by two different organizations. No one has an absolute advantage to win, so let the market test them! IS-IS has more advantages in terms of protocol development and scalability, and OSPF may be marginalized.

Today, instead of discussing who will win, let’s face the first question. If OSPF and IS-IS run on the same router, and they both generate routing tables for the same destination (same network address and same network mask), whose one is used? This is a difficult priority choice. Each manufacturer has its own choice. cisco uses a name that sounds strange: Administration Distance AD(Administration Distance) to distinguish everyone’s priority. Priority 0 is the highest priority, while priority 255 is the lowest. OSPF defaults to priority bit 110, while IS-IS defaults to priority 115. Obviously, OSPF routing information wins. Take an example to illustrate:

OSPF route: 10.1.1.0/24 next-hop a.a.a.a AD 110

IS-IS route: 10.1.1.0/24 next-hop b.b.b.b AD 115

Then what enters the routing table is:

OSPF route: 10.1.1.0/24 next-hop a.a.a.a AD 110

Don’t be under the illusion that OSPF has a high AD priority and IS-IS has a low AD priority. If OSPF and IS-IS are run at the same time, all routing entries of IS-IS will not enter the routing table. This is wrong! It must be noted that only equivalent routing entries can use the priority of AD value to decide whether to stay or not. If they are not equivalent routing entries, the priority of AD will not be compared at all.

Of course, there are other protocols that can compete for entry into the routing table: RIP(120), EIGRP(90), BGP (20,200), as well as the directly connected route (0) and static route (1), with their AD priority and external BGP in brackets.

20, and internal BGP is 200. At present, the AD priority of common routing protocols is:

Direct route > static route > EBGP > EIGRP > OSPF> ISIS > RIP > IBGP

Which is the best next-hop?

After talking about the routing table, let’s talk about how IP packets arrive at the router, and how to find the routing table and complete the navigation task of IP packets. How to find the next-hop with the highest efficiency and accuracy?
If the routing table has the following five entries and the destination address of IP packet is 10.1.1.1, which entry will the routing table choose? According to the Longest Prefix Matching rule, 10.1.1.1/32 will be selected because it is an exact match, that is, a 32-bit match.
If the IP packet destination address is: 10.1.1.100, 10.1.1.0/24 will be selected, which is the longest match and matches 24 bits.
If the IP packet destination address is: 10.1.2.100, 10.1.0.0/16 will be selected, which is the longest match, with 16 bits matched.
If the IP packet destination address is: 10.2.1.100, 10.0.0/8 will be selected, which is the longest match, with 8 bits matched.
If the IP packet destination address is: 192.168.1.1, 0.0.0/0 will be selected, which is the default route and can match any IP destination address.
10.1.1.1/32
10.1.1.0/24
10.1.0.0/16
10.0.0.0/8
0.0.0.0/0
We have a brief understanding of what routing protocol, routing protocol AD, and the longest Prefix Matching rule of routing lookup are, and the next article will introduce the link-state protocol OSPF.