Basic road knowledge: How to quickly understand route table information

Source: Internet
Author: User

Reading route table information is very important and can help us quickly solve router faults. We have never said how these route table information was created. When an interface is initialized, The ifconfig command is often used to set the interface address), a direct route is automatically created for the interface. For point-to-point links and loop interfaces, routes are routed to the host, for example, H flag is set ). For broadcast interfaces, such as Ethernet, routes are routed to the network.

If the route to the host or network is not directly connected, the route table must be added. A common method is to explicitly run the route command in the initialization file during system boot. 3rd parameters default and slip) represent the destination, 4th parameters represent the Gateway Router), and the last parameter represents the metric of the route ). When the measurement value of the route command is greater than 0, the G flag must be set for the route. Otherwise, the G flag is not set when the consumption value is 0. Unfortunately, almost no system is willing to include the route command in the startup file. In the 4.4BSD and BSD/386 systems, the startup file is/etc/netstart. In the SVR4 system, the startup file is/etc/inet/rc. inet; In Solaris2.x, the startup file is/etc/rc2.d/S69inet; In SunOS4.1.x, the startup file is/etc/rc. local, while AIX3.2.2 uses the file/etc/rc.net. Some systems allow you to specify the default vro in a file, such as/etc/defaultrouter. Therefore, you must add the default vro to the route table information every time you restart the system. Other methods to initialize route table information are to run the routing daemon or use a newer Router Discovery protocol.

Complicated route table

On our subnet, host sun is the default router for all hosts, because it has a dial-up SLIP link connecting to the first two items of the Internet and the first two items of the host svr4 are consistent: the route of a specific host to reach the slip through vrobbsdi and the loopback route. Row 3 is newly added. This is a route directly to the host without G flag, but with H flag configured), corresponds to the point-to-point link, that is, the SLIP interface. If we compare it with the output of the ifconfig command: sun % ifconfigsl0sl0: flags = 1051inet140. 252.1.29 --> 140.252.1.183netmaskffff00 you can find that the destination address in the route table information is the other end of the point-to-point link (vro netb), and the gateway address is the local IP address of the outbound interface 140.252.1.29, the gateway address printed by netstat for the direct route is the IP address used by the local interface ).

The default route table item is an indirect route entry that reaches the network with the G flag, but the H flag is not set), which is exactly what we want. The gateway address is the router address 140.252.1.183, the other end of the SLIP link), rather than the local IP address 140.252.1.29 of the SLIP link ). This is because it is an indirect route rather than a direct route. It should also be noted that the interfaces 3rd and 4th output by netstat are named sl0) created by the SLIP software at startup and deleted when it is disabled.

No route to the destination

All of our examples assume that the matching table items can be found in the search of the route table information, even if the matching is the default item. What happens if no default item exists in the route table and no matching item is found? The result depends on whether the IP datagram is generated by the host or forwarded. For example, we act as a router ). If a datagram is generated by a local host, an error is returned for the application that sends the datagram, the host is not reachable, or the network is not reachable ". If the packet is forwarded, an error message that is inaccessible to the ICMP Host is sent to the original sender.
 

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.