IP address routing instance resolution

Source: Internet
Author: User

IP address routing instance resolution 1. step 1 of IP address search route table) Search for matched host addresses; 2) Search for matched network addresses; 3) search for default table items (the default table item is generally specified as a network Table item in the routing table, and its network number is 0 ). The matching host address step always takes place before the matching network address step. 2. for a given vro, the route table in Unix can print five different flags (flag): U can be used for this route. G. This route is to a gateway (router ). If this flag is not set, the destination is directly connected. H. The route is to a host, that is, the destination address is a complete host address. If this flag is not set, it indicates that the route is to a network, and the destination address is a network address: a network number, or a combination of the network number and subnet number. D. The route is created by the redirection message. M The route has been modified by the redirection message. Flag is very important because it distinguishes indirect routing from direct routing (for direct routing, flag is not set ). The difference is that the Group sent to the direct route not only has an I P address indicating the destination end, but also has its link layer address. When a group is sent to an indirect route, the I P address specifies the final destination, but the link layer address specifies the gateway (that is, the next stop router ). In this route table example, there is an indirect route (with the flag configured). Therefore, the I P address of the route group is the final destination (1 4 0. 2 5 2. 1 3. 6), but the link layer address must correspond to vro1 1 4 0. 2 5 2. 1 3. 3 5. Here are two examples: 1. Host B s d I has an I P datagram to be sent to host s u n. Both parties are on the same Ethernet. The data transmission process is shown in 3-3. The datagram is sent to the Ethernet driver and then sent to the s u n host as an Ethernet data frame. The destination address in the I p datagram is the I P address of s u n (1 4 0. 2 5 2. 1 3. 3), and the destination address in the Link Layer header is the Ethernet interface address of the 48-bit s u n host. 1. Host B s d I has an I P datagram to be uploaded to f t p. u. on the n e t host, its I P address is 1 9 2. 4 8. 9 6. 9. The first three routers 3-4 are shown. First, the host B s d I searches for the route table, but does not find a table that matches the host address or network address. Therefore, you can only use the default table to send the datagram to the next router, host s u n. After the datagram is transmitted from B s d I to s u n host, the destination I P address is the final host address (1 9 2. 4 8. 9 6. 9), but the link layer address is the Ethernet interface address of the s u n host. Note !!! This is not the link layer address, because we need to continue forwarding. It can also be concluded that the link layer header may not be a physical address. It is important to understand the differences between G and H. The G sign distinguishes between direct and indirect routes, as described above. However, the H mark indicates that the destination address (the first line output by the n e t s t a t command) is a complete host address. If the H flag is not set, the destination address is a network address (the host number is 0 ). When searching a route table for a destination I P address, the host address must exactly match the destination address, and the network address must match the destination address's network number and subnet number. In addition, in most versions, the n e t a t command First prints all the host route table items, and then the network route table items. 3. Unable to reach the destination (ICMP Host and network inaccessible error) What happens if no default item exists in the routing table and no matching item is found? The result depends on whether the I P 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 I C M P host is sent to the original sender. 4. ICMP redirection error when I p datagram should be sent to another vro, the router that receives the datagram will send the I c m p redirection error message to the sender of the I P datagram. 1) assume that the host sends an I P datagram to R 1. This routing decision often happens because R 1 is the default route of the host. 2) R1 receives the datagram and checks its route table. R 2 is the next stop to send the datagram. When it sends A datagram to R 2, R 1 detects that the interface it is sending is the same as the interface for reaching the datagram (that is, the l a n of the host and the two routers ). In this way, the router is sent with a redirection packet to provide clues to the original sender. 3) R1 sends an I C M P redirection packet to the host, telling it to send the datagram to R 2 instead of R 1. The format of ICMP redirect packets is 9-4. There are four different types of redirection packets with different code values, as shown in 9-5. The receiver of the I c m p redirection packet must view three I P addresses: (1) the I p address that causes redirection (that is, the data of the I c m p redirection packet is located in the header of the I P datagram); (2) the I p address of the router that sends the redirection packet (the source address of the I p datagram containing the redirection information; (3) the router I P address (4 ~ 7 bytes ). 5. For ICMP route discovery packets, You can initialize the route table by specifying static routes in the configuration file. This method is often used to set the default route. Another new method is to use the I C M P router to advertise and request packets. Generally, the host needs to broadcast or multicast a router request packet after the boot. One or more routers respond to a router notification message. In addition, routers regularly broadcast or multicast Their router notification packets, allowing each host being monitored to update their route tables accordingly. The router can advertise multiple addresses in one message. The number of addresses refers to the number of addresses contained in the message. The address item size refers to the number of 32 bits for each vro address, which is always 2. The period of survival refers to the effective time (in seconds) of the announcement address ). Next is the one-to-one or multiple-to-I P address and priority. The I P address must be an address of the sender router. The priority is a signed 32-bit integer indicating that the I P address is the priority of the default router address, which is compared with other routers on the subnet. A greater value indicates a higher priority.

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.