Routing matching principles

Source: Internet
Author: User

 

Use a classless route: the router first matches the primary network number. If the primary network number exists, it continues to match the subnet number without considering the default route. If the subnet cannot match, discard data packets (in a classiclink, the router determines that all subnets under all the primary networks are known) and return an unattainable response using ICMP. If the primary network number does not exist, use the default route ).

 

The above situation occurs in some earlier versions of IOS (earlier than 12.0). By default, these earlier versions do not enable ip classless.

 

When ip classless is enabled, the router's routing behavior will be changed. At this time, the router will perform the longest and most accurate match or use the default route for matching.

 

Classless routing is used. If no matching is found, the default route is used.

 

The ip classless command is mainly used to change the behavior of querying the route table of the classless routing protocol.

 

Example 1: the routing protocol running on a vro is RIP (classless Routing). The route table is as follows:

 

 

 

R 10.1.0.0/16 via 1.1.1.1

R 10.2.0.0/26 via 1.1.1.2

R * 0.0.0.0/0 via 1.1.1.3

 

 

 

 

Assume that there are three IP packets. The destination IP address of packet A is 10.1.1.1, the destination IP address of packet B is 10.3.1.1, And the destination IP address of packet C is 11.11.1.1.

 

The behavior of querying a route table using a similar routing protocol is as follows:

 

First, find the primary network where the target IP is located. If the route table contains any subnet route of the primary network, you must precisely match the subnet route. If no exactly matched subnet route is found, it does not select the last default route, but discards the packet. If the routing table does not contain any subnet route of the master network, the default route is selected.

 

Packet A: the destination IP address is 10.1.1.1, and the main network is 10.0.0.0. The current route table contains A subnet route of 10.0.0.0. In this case, the router needs to further find the subnet route to see if exact match is possible, we can see that 10.1.0.0/16 matches our target address, so packet A is forwarded based on this route.

 

Packet B: the destination IP address is 10.3.1.1, and the main network is 10.0.0.0. The current route table contains a subnet route of 10.0.0.0. In this case, the router needs to further find the subnet route to see if it can match exactly, we can see that the two subnet routes 10.1.0.0/16 and 10.2.0.0/16 in the route table do not match our target address. According to the principle of classless routing, it does not select the default route, therefore, packet B is discarded by the router.

 

Packet C: The target IP address is 11.1.1.1, and the main network is 11.0.0.0. The current route table does not have a subnet route of 11.0.0.0. In this case, the router uses the default route directly, therefore, the router uses the default route to forward packet C.

 

The above result shows the behavior of querying routes through the classless protocol. The purpose of configuring ip classless is to change this behavior, after this command is configured, the Routing Query behavior is based on the longest matching principle. In the preceding example, packet B can be forwarded through the default route.

 

Note: This command does not make any sense for a classless routing protocol, because the classless routing protocol searches for routes in a way that is the principle of longest matching.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.