9th IP Routing

Source: Internet
Author: User
Tags ftp
9th Chapter IP RoutingSeveral steps for IP search routing table:
1) search for the matching host address;
2) Search for matching network address;
3) Search Default table entry (the default table entry is typically specified in the routing table as a network table entry with a network number of 0).

Let's take a quick look at an example:

Flags:U: Indicates that the route can use G: to represent an indirect route, and the setting indicates that the route needs to be routed to the router, otherwise it is directly connected. The flag G is very important because it distinguishes between indirect and direct routing, and the difference is that packets destined for direct routing have an IP address and a link-layer address. When the packet is sent to an indirect route, the IP address indicates the final destination, but the link-layer address indicates the next-station router. And if G is not set, its gateway address is the native address. H: Represents the host address, the setting indicates that the destination address is the full host address, otherwise the route is to a network, the destination address is a network address: A network number or network number and subnet number combination D: The route is created by the redirect message M: The route has been modified by redirected messages refcnt:The (Reference count) column gives the number of active processes that are using routing. Use :Shows the number of packets sent through this route
Routing Table composition:
1) The simplest (and least interesting) scenario is that the host is not connected to any network at all. The TCP/IP protocol can still be used for such a host, but it can only communicate with itself, in which case the routing table contains only one entry for the loopback interface.
2) The next situation is that the host is connected to a local area network and can only access hosts on the LAN. The routing table then contains two items: one is the loopback interface and the other is a local area network (such as Ethernet).
3) If the host is able to access other networks (such as the Internet) through a single router, then the next step is necessary. In general, add a default table entry that points to the router. 4) If you want to add another specific host or network route, then the last step is necessary. In our example, the route to the host slip is routed through the router BSDi is an example of this.
example of a route table entry:
1) Assume that the destination address is the host sun,140.252.13.33. First, the host address is matched. The two host Address table entries (SLIP and Local H OST) in the routing table do not match, followed by network address matching. This time the match succeeds, the table entry 140.252.13.32 (the network number and the subnet number are the same) is found, so the Emd0 interface is used. This is a direct route, so the link-layer address will be the address of the destination.
2) Assume the destination address is host S L I p,1 4 0. 2 5 2. 1 3. 6 5. First the host address is searched in the routing table and a matching address is found. This is an indirect route, so the I-p address of the destination is still 1 4 0. 2 5 2. 1 3. 6 5, but the link-layer address must be Gateway 1 4 0. 2 5 2. 1 3. 6 5 link-layer address with an interface name of E M D 0.
3) This time we pass the i n T e R n e t to the host a W. C o m (1 9 2. 2 0 7. 11 7. 2) Send a copy of the data report. First, the host address is searched in the routing table, and the network address matches after the failure. Finally, the default table entry was successfully found. The route is an indirect route through Gateway 1 4 0. 2 5 2. 1 3. 3 3, and use the interface named E M d 0.
4) In our last example, we send a datagram to this machine. There are four ways to do this, such as using the hostname, host I p address, loopback name, or loopback I P address:
FTP SVR4
FTP 140.252.13.34
FTP localhost
FTP 127.0.0.1
In the first two cases, the 2nd search for the routing table gets a matching network address of 1 4 0. 2 5 2. 1 3. 3 2, and send the I p to the Ethernet driver. The destination address in the I P message is the native I p address, so the message is sent to the loopback driver, which is then placed in the I p output queue by the driver. In the latter two cases, the first search finds a matching host address because the name or I p address of the loopback interface is specified, so the message is sent directly to the loopback driver and the driver sends the message into the I p output queue. All four of these cases are sent to the loopback driver, but the two routing decisions taken are not the same.

To increase the routing method:Route Add destination Address gateway address route metric route add default Sun 1

ICMP Redirect Error

1) We assume that the host sends a copy of the IP datagram to R1. This routing decision often occurs because R1 is the default route for that host.
2) R1 receives the datagram and checks its routing table to find that R2 is the next station to send the datagram. When it sends the datagram to R2, R1 detects that the interface it is sending is the same as the datagram arrival interface (that is, the host and the LAN on which the two routers reside). This sends the redirect message to the router to provide clues to the original sending side.
3) R1 sends an ICMP redirect message to the host, telling it to send the datagram to R2 instead of R1.


Note: This ICMP message can only be generated by the router, and the recipient can only be the host. The host can use the ICMP Redirect message to refine its routing table.
ICMP router Discovery message

The method of initializing the host routing table is to configure a static route in the configuration file,/etc/sysconfig/networking/device/the host to broadcast or multicast a router request message after booting, or one or more routers to respond to Router Advertisement messages, Or the router periodically sends router Advertisement messages, by the host Update period routing table.




number of addresses: refers to the number of addresses of Korean in the message.

Address Entry Size: The number of 32bit words on the router, always 2

life cycle: address valid time in seconds


The amount ..... This ICMP router discovery message in addition to update the default route, what is the use of it, he just told the router IP address, and did not tell the direction of the route, how to update the routing table, Strange ... Which person knows the hope to inform ....

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.