Article title: Linux soft route performance testing and analysis. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
This article introduces the working principle of Linux soft routing, and uses a common PC computer as a hardware device. it tests and discusses the performance of Linux soft routing in the actual network environment. Experiments show that in a mb Ethernet environment, the speed of packet forwarding for Linux soft routing depends on the actual speed of the network card, and decreases with the increase of application layer services of the soft routing system. This result provides a basis for the application and popularization of Linux soft routing.
0. Introduction
With the development of open-source software, more and more people begin to understand, use and study Linux. Currently, there are many soft routing designs and application cases in Linux. However, there is still a lack of tests and discussions on the load performance of Linux soft routing in actual network environments. This article discusses the Linux soft routing framework and experiment, and gives a conclusion.
1. Netfilter framework
The Netfilter framework is the operating system of the Linux soft route, and is the stream operating system for the Linux kernel to process data packets. It can be used in IPv4, IPv6, Decnet, and other network stacks. The concept of the Netfilter framework is proposed and the main implementer is Rusty Russell.
Netfilter framework:
Figure xxx. Requires a heading
(1) Netfilter defines a set of hook functions for each network protocol. the following five hook functions are defined for IPv4:
[1] NF_IP_PRE_ROUTING.
[2] NF_IP_LOCAL_IN
[3] NF_IP_FORWARD
[4] NF_IP_POST_ROUTING
[5] NF_IP_LOCAL_OUT
(2) These hook functions are registered and attached to the Linux kernel module. When the datagram enters the network layer of the framework, the kernel module [1] receives the datagram at the Hook function of the framework, check, forward, discard, or instruct Netfilter to pass the datagram to the user space queue through [2.
(3) If the datagram is passed to the user space, it will be processed asynchronously at the application layer. After the user Process at this layer performs a more precise check, modification, and assembly on the Datagram, it is re-submitted to the network layer through the hook function [4.
Netfilter greatly reduces the latency of data packet forwarding and improves the accuracy of data packet control, improving the processing efficiency of data packets goes beyond the routing software working on the Windows platform.
2. Iptables command system
If the Netfilter framework is a datagram pipeline, we need a command system that can control pipeline operations. this command system is called Iptables in Linux2.4 kernel and later versions. Iptables commands are composed of tables and rules. it directly controls the hook function and the Linux kernel module to filter, forward, and modify data packets.
(1) Packet Filter: the filter table in Iptables checks the datagram and decides to allow or discard the data report according to the rule. it works in the Local Process of the Netfilter framework.
(2) NAT: Network Address Translation: The NAT table in Iptables converts the source Address and destination Address of the datagram to be forwarded. A nat table is different from a filter table. it only traverses the table of the first newly connected Datagram, and subsequent data reports perform the same conversion based on the results of the first datagram. This enables the NAT table to forward data packets at a high speed at the network layer.
(3) Packet Mangling: The mangle table in Iptables can modify the datagram or attach some additional data to the data report. With the upgrade of Iptables, this operation will become more accurate.
[1] [2] [3] [4] Next page