Rule of routing #3 Longest Match

Consider the network such as the following.

On the back side of the Router4, there are the NW adresses of 10.1.2.0/24 - 10.1.255.0/24. The IP packet from PC#1 destined to these networks is like to through the Router1 - Router2 - Router4. In such a case, it is so efficient setting static route to summarized route 10.1.0.0/16 with NextHop Router2 on Router1 rather than setting one by one /24 network addresses.

On the other hand, the network 10.1.1.0/24 between Router3 and Router4 , is closer to Router3 than Router2, so you would like to set routing for 10.1.1.0/24 with NextHop to Router3.

However, this 10.1.1.0/24 are included in the range of 10.1.0.0/16 of static route with NextHop to Router2 described earlier. Then,which route Router1 selects, Router2 or Router3?

In such a case, by the rule of Longest Match, Router2 is chosen.

This Longest Match, to enable the route information of a finer network preferentially (Longer subnetmask is preferred), that is a rule. Because of the fine more of the network of 10.1.1.0/24 than 10.1.0.0/16, it is given priority, for example, when an IP packet destined for 10.1.1.5 have come that can be transferred to the Router3.

It should be noted that the longest match takes precedence over the AD value.It is the administrative distance value is the AD value .

Default Route

Rule as described in Part 2, when the destination IP of the packet will come not in the routing table, the router will discard the packet, but it does not happen so much in reality.

In most cases, on the routing table are there the Default Route which is applied the previous Longest Match.

The Default Route represents the destination network address as 0.0.0.0/0, and it indicates that all of IP addresses is included.

By setting the Default Route, even though it is hard to find the route in Routing Table Entry according to the Longest Match order, it is inevitable to match to Default Route at last.

In the real world we set the Default Route to the exit of the Internet in most case.

For example, in figure earlier, when the Internet is connected to the previous router 3 it can be configured as shown below.

* of [S*] indicates the Default Route.

To share

  • このエントリーをはてなブックマークに追加

To follow