Routing table principle and overlapping routing settings

Source: Internet
Author: User

The principle of the route table and the overlapping route settings are shown in the following question and answer topic about the principle of the route table. I hope to cover all questions about the principle of using the route table and the overlapping route settings. Please leave a message to add this question.

Routing table principle. If a host has multiple network interfaces, how does one decide which interface to use when sending a group to a specific IP address? The answer is in the routing table. Let's look at the following example:
◆ Purpose, subnet mask, gateway, flag, and interface
◆ 201.66.37000000000000255.0201.66.37.74ueth0
◆ 201.66.3920.255.255.255.0201.66.39.21ueth1

The host sends data from all hosts destined for 201.66.37.0 (201.66.37.1-201.66.37.254) through the eth0 interface (IP Address: 201.66.37.74, all host data destined for 201.66.39.0 is sent through eth1 (IP Address: 201.66.39.21. Indicates that the status of the route is "up" or "activation" in the utable ). For a directly connected network, some software does not provide the IP address of the interface as in the previous example, but only lists the interfaces.

Routing table principle this example only involves directly connected hosts. What is the target host in the remote network? If you connect to the network 73.0.0.0 through the gateway with the IP address 201.66.37.254, you can add the following in the routing table:
◆ 73.0.0.020.0.0.0201.66.37.254ugeth0

This item indicates that all the host groups destined for network 73.0.0.0 are routed over 201.66.37.254. G (gateway) indicates that this option directs the group to an external gateway. Similarly, you can define the route to reach a specific host through the gateway, and add the flag H (host ):
◆ 91.32.74.21255.20.255201.66.37.254ugheth0

The following describes the routing table principle, except for the special table items:
◆ 127.0.0.1255.20.255127.0.0.1uhlo0
◆ Default0.0.0201.66.37.254ugeth1

The first principle of the route table is the loopback interface, which is used by the host to send data to itself. It is usually used for testing and running on an IP address but requires local communication. This is the host route to the specific address 127.0.0.1 (the lo0 interface is a "fake" Nic inside the IP protocol stack ).

The second item of the routing table principle is very interesting. To prevent the host from defining every route that may reach the network on the Internet, you can define a default route, if no entry matches the destination address in the routing table, the group is sent to the default gateway. Most hosts simply connect to the network through a network adapter, so only one vro is connected to other networks. In this way, there are only three items in the routing table: loopback, local subnet, and default entry pointing to the vro ).

Overlapping routing. It is assumed that there are the following overlapping items in the route table:
◆ 1.2.3.20.5.20.255.255201.66.37.253ugheth0
◆ 1.2.3.020.255.0201.66.37.254ugeth0
◆ 1.2.0.0000000000.0201.66.37.253ugeth1
◆ Default0.0.0201.66.39.254ugeth1

These routes overlap because these four routes contain the address 1.2.3.4. Which route will be selected if you send data to 1.2.3.4? In this case, the first route is selected through the gateway 201.66.37.253. The principle is to select the longest (most accurate) subnet mask. Similarly, select the second route for the data sent to 1.2.3.5.

Note: This principle applies only to indirect routing (via gateway ). Defining two interfaces in the same subnet is illegal in many software implementations. For example, the following settings are generally invalid, but some software will try to balance the load on two interfaces ):
◆ Eth0201.66.37.1255.20.255.0
◆ Eth1201.66.37.22.16255.255.0

It is very useful for overlapping routing policies. It allows the default routing to work as a route for the purpose of 0.0.0.0 and the subnet mask is 0.0.0.0, it does not need to be implemented as a special situation of routing software. Looking back at CIDR, we still use the above example: a service provider is assigned 256 Class C networks, from 213.79.0.0 to 213.79.255.0. The external route table of the service provider only learns about all these routes in one table entry: 213.79.0.0, And the subnet mask is 255.255.0.0.

Assume that a user has moved to another service provider and has a network address of 213.79.61.0. Do he have to get a new network address from the new service provider? If yes, it means that he must reconfigure the IP address of each host, change the DNS settings, and so on. Fortunately, the solution is very simple. The original service provider maintains the route 213.79.0.0 (the subnet mask is 255.255.0.0), and the new service provider broadcasts the route 213.79.61.0 (the subnet mask is 255.255.255.0 ), because the subnet mask of the new route is long, it will overwrite the original route.

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.