Routing and routers in-depth analysis of the principle of Operation 2: Routing principle

Source: Internet
Author: User


Log "Routing and router working principle in-depth analysis 1"http://user.qzone.qq.com/2756567163/blog/1438322342 introduced the"Why to use a router"and"the segmentation principle of TCP/IP V4 protocol network"2 questions, this article will continuethe specific working principle of routing is analyzed.
3. Routing principle
    when one host in an IP subnet sends an IP packet to another host on the same IP subnet, it will send the IP packet directly to the network, and the other party can receive it. In order to send a host to a different IP subnet, it chooses a router that can reach the destination subnet, groups the IP packets to the router, and the router is responsible for sending the IP packets to the destination. If such a router is not found, the host groups the IP to a router called the default gateway. The default gateway is a configuration parameter on each host that is the IP address of a router port that is connected to the same network.  when routers forward IP packets, the IP packets are only selected according to the network number portion of IP address of IP packet and the appropriate port is chosen. Like the host, the router also to determine whether the port is connected to the destination subnet, if so, directly to the packet through the port to the network, otherwise, also choose the next router to transfer the packet. The router also has its default gateway, which is used to send IP packets that do not know where to send. In this way, through the router to know how to transmit the IP packet correctly forwarded out, do not know the IP packet sent to the "default gateway" router, so that the level of transmission, IP packets will eventually be sent to the destination, the IP packet is not sent to the destination is discarded by the network. At present, the TCP/IP network is interconnected by routers, and the Internet is an international network of thousands of IP subnets interconnected by routers. This network, known as router-based networks (router based network), forms a "network network" with routers as nodes. In the "Network Network", the router is not only responsible for the IP packet forwarding, but also responsible for contact with other routers, together to determine the "network Network" Routing and Maintenance routing table.

4. Routing protocols typically have two routing options: static Routing and dynamic routing. Static routing is a fixed routing table that is set up in the router. Static routes do not change unless the network administrator intervenes. Because the static route cannot reflect the change of the network, it is usually used in networks with small network size and fixed topology structure. The advantages of static routing are simple, efficient and reliable. In all routes, static routes have the highest precedence.     When dynamic routing conflicts with static routes, static routes prevail. Dynamic routing is the process of communicating with each other in the network, passing routing information, and updating the router table with the received routing information. It can adapt to the changes of network structure in real time. If the routing update information indicates that a network change has occurred, the routing software will recalculate the route and issue a new routing update information. This information, through each network, causes the routers to restart their routing algorithms and update their respective routing tables to dynamically reflect network topology changes. Dynamic routing is suitable for networks with large network size and complex network topology. Of course, various dynamic routing protocols can occupy network bandwidth and CPU resources to varying degrees.static routes and dynamic routes have their own characteristics and scope of application, so dynamic routing is often supplemented as static routes in the network. When a packet is found in the router, the router first looks for a static route, and if it does, forwards the packet according to the corresponding static route, otherwise finds the dynamic route.

5. Process Realization
as shown in the 2 segmented networks, we want to realize the interconnection of the host in the 201.66.37.0 network segment with the host in the 201.66.39.0 network segment, through the router how to implement the answer in the routing table.  indicates the routing table for the router, which indicatesall data destined for the network 201.66.37.0 host (201.66.37.1-201.66.37.254) is sent via the interface eth0 (IP address is 201.66.37.74). All data destined for the host in the network 201.66.39.0 is sent via the interface eth1 (IP address is 201.66.39.21). The flag u indicates that the route status is "up" (that is, the active state).  now we want to connect to the remote network 73.0.0.0 via a gateway with an IP address of 201.66.37.254 , and we can add an item to the router to implement it.  the entry informs all host destinations that a packet of 73.0.0.0 hosts is passed through 201.66.37.254, and the flag G "Gateway" indicates that the packet is directed to an external gateway with a network topology as shown in the following:Similarly, you can define a route that reaches a specific host through the gateway, increasing the flag H"Host", as shown in its network routing table and topology diagram.
let's go over the default entries for the routing table 127.0.0.1 and default,The 1th item is the loopback interface, which is used by the host to send itself data, typically for applications that test and run on IP but require local communication. This is the host route to the specific address 127.0.0.1 (the interface Lo0 is the "fake" network card inside the IP stack). The 2nd item is very interesting, in order to prevent on the host defined on the Internet every possible route to reach the network, you can define a default route, if there is no match to the destination address in the routing table, the packet is sent to the default gateway. Most hosts simply connect to the network through one NIC, so only one router to the other network, so there are only three items in the routing table: loopback, local subnet entry, and default (pointing to the router). The routing table that joins the above two items, as shown,Thus, a relatively complete network is built.
In this paper, the principle of routing is introduced, and the implementation process of routing is deeply analyzed with the implementation of a concrete example. It is also important to note that there are 1 other key concepts in the router or the TCP/IP protocol: ports. We compare the IP to the house, we can think of the port as the door, we can restrict the door to turn off in the router, we can also specify the door from which to enter the data, from which door, which requires the port. "Routing and routers in-depth resolution 3: Routing and port "the specific workings of the port will be resolved."

Note 1: This article in the process of writing access to a large number of online information, the citation of the source could not be one by one marked, special apology.

original articles, reproduced please specify the source http://user.qzone.qq.com/2756567163.  

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Routing and routers in-depth analysis of the principle of Operation 2: Routing principle

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.