ArticleDirectory
- 1. overhead of querying a route table
- 3. 1. Contact
- 3. 2. Differences
1. Route table
Route information is stored on the host or professional router used for the router. The route table is used to store the information. It contains three elements: target address, mask, and next hop.
1. overhead of querying a route table
Some people think that querying a route table is the same as querying a MAC address on a vswitch. querying a MAC address/port pair is a fixed data query, the MAC address is a fixed 48-byte address, and the IP address, since the emergence of CIDR, the address becomes "unclassically", so the mask of any bit can become the correct mask. In addition, intelligent administrators have come up with route aggregation. These guys pass the burden to the real-time users of the system, so that the system real-time users must implement "Longest mask" Matching. Since the mask is not fixed, therefore, the query is not fixed, which is very troublesome.
2. Forwarding Table
When a data packet arrives at the vro, you need to go to the specific port according to the "instructions". Similar to the address information table of the vswitch, the place where the "indication" is stored on the vro is called a forwarding table.
3. Relationship between two tables 3. 1. Contact
The forwarding table directly acts on data packets, while the route table is the basis for generating the forwarding table. The forwarding table is generated through the route table. A specific process can be integrated by using the information in the route table and adding its own host information, such as NIC and other information, to obtain a forwarding table. The routing information has nothing to do with the host. It only describes the status and direction of the network link.
3. 2. Differences
The information stored in the two tables is different. The route table stores only the three elements-destination, mask, and next hop, while the forwarding table stores more detailed information, such as output port information, such as tag information. The forwarding table describes the host information. Inside the host, a data packet is directed from one port to another, while the route table describes the network information and directs the data packet from one machine to another.
4. misunderstandings
At present, many people understand the implementation of a system. These people are similar to three categories. The first type is proficient in Linux kernel, the second type is proficient in the configuration of Cisco devices, and the third type is proficient in Windows Network Programming and NDIS. The three types have very few common intersections, so most people familiar with the Linux kernel will not distinguish the route table and the forwarding table, because the Linux kernel itself does not distinguish the two tables, the route table is queried every time a packet is sent... but this is not a forwarding table). So the guy familiar with Cisco will think that the two tables must be differentiated. Otherwise, how can MPLS be implemented? Who are familiar with Windows core? Windows is rarely used as a router.
5. Differentiate the benefits of two tables
MPLS is an obvious example of distinguishing route tables and forwarding tables. First, it declares that MPLS is a network rather than a node running a specific protocol. In MPLS, data packets are forwarded completely through tags. Before the MPLS network can be used for data services (the Label Distribution Protocol can also be dynamically adjusted in the middle), the MPLS Forwarding Table is created, its table items contain three elements: the source data comes with labels, the port to which the data is forwarded, And the labels to which the data is forwarded. This table item is created through the route table. We regard it as a forwarding table. To Implement MPLS, you need to add a label to the data packet on the ingress router so that the data packet can be quickly forwarded after going out of the MPLS network, saving the overhead of directly querying the route table.
6. Configure forwarding tables based on Nat principles in Linux
If the administrator can "get through one path" in advance, you can configure DNAT on each router entry and configure SNAT at its exit to implement a standard point-to-point IP link, each node thinks that the data is sent to the next hop instead of the next hop ". Because Nat is based on the connection, it adds a direction to the undirected IP network. Therefore, you do not need to configure reverse routing After configuring SNAT.
In view of the above method, if we can identify the tag information in the DNAT information and then directly determine the output port, and encapsulate the new egress tag in the SNAT of the output port, we do not need to enter the routing module, this is an MPLS implementation. However, the current standard Linux kernel netfilter is not implemented in this way.
7. Advantages
In addition to specific dedicated line networks such as MPLS, the primary benefit of forwarding table and route table separation is that it can use hardware to implement forwarding table, so as to achieve high-speed link layer forwarding, however, the route table is hard to be implemented by hardware because it is not exactly matched, but is matched with the "Longest prefix", which is filled with variables.