A load balancing device NAT log collection method and load balancing device

By HASH transformation of NAT connection information and local log storage in the load balancing device, UDP messages are generated only when specific conditions are met, which solves the problem of high pressure for sending NAT connection information in the load balancing system and improves system performance and logs. Record efficiency.

CN116170301BActive Publication Date: 2024-10-29上海弘积信息科技有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310197561.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-02
Publication Date
2024-10-29
Estimated Expiration
2043-03-02

AI Technical Summary

Technical Problem

The load balancing system increases network pressure when sending UDP packets for each NAT connection, affects system performance, and reduces network security.

Method used

Local log storage of NAT connection information is performed in the load balancing device, and the log information is stored in the HASH table through HASH transformation. When the set conditions are met, a UDP message is generated and sent to avoid generating a UDP for each NAT connection information. message.

Benefits of technology

This reduces the business pressure on load balancing equipment, ensures the accuracy and timeliness of NAT log messages, and improves local logging performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116170301B_ABST
    Figure CN116170301B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for collecting NAT logs of a load balancing device and a load balancing device, and relates to the field of NAT log processing. The method comprises storing NAT connection information in the load balancing device in a local log; performing HASH transformation on the NAT connection information according to the source IP address in the NAT connection information, and storing the transformed log information in a HASH table; when the log information in the HASH table meets the set conditions, generating a UDP message for the log information in the HASH table that meets the set conditions; and sending the UDP message to a log server. The present invention reduces the business pressure of the load balancing device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of NAT log processing, and in particular to a load balancing device NAT log collection method and a load balancing device. Background Art

[0002] Network Address Translation (NAT), also known as address proxy, is a widely used network technology. It enables private networks to access shared networks, solves the problems that may be caused by IP address shortages, and can effectively avoid attacks from outside the network, hiding and protecting computers within the network.

[0003] For users accessing through NAT devices, it is difficult to accurately locate the host or user that initiated a network access operation because the source IP address has been translated, which reduces the security of the network. NAT user logs are implemented to solve this security problem.

[0004] Currently, the load balancing system counts each NAT flow connection, generates a UDP message with the statistical information and sends it out for the log server to receive and process. Although the load balancing system can send NAT logs, each NAT connection created will send a UDP message, which will increase the system network pressure, affect normal business, and reduce system performance. Summary of the invention

[0005] The purpose of the present invention is to provide a load balancing device NAT log collection method and a load balancing device, so as to reduce the business pressure of the load balancing device.

[0006] To achieve the above object, the present invention provides the following solutions:

[0007] A method for collecting NAT logs of a load balancing device, comprising:

[0008] Locally log and store NAT connection information in the load balancing device;

[0009] Performing HASH transformation on the NAT connection information according to the source IP address in the NAT connection information, and storing the transformed log information in a HASH table;

[0010] When the log information in the HASH table meets the set conditions, a UDP message is generated from the log information in the HASH table that meets the set conditions;

[0011] The UDP message is sent to the log server.

[0012] Optionally, the NAT connection information includes a source IP address, a source port, a destination IP address, a destination port, and an IP address after NAT address conversion.

[0013] Optionally, when the log information in the HASH table meets the set conditions, generating a UDP message from the log information in the HASH table that meets the set conditions specifically includes:

[0014] When the number of log information recorded in the HASH table reaches the set number, the log information in the HASH table is generated into a UDP message.

[0015] Optionally, when the log information in the HASH table meets the set conditions, generating a UDP message from the log information in the HASH table that meets the set conditions specifically includes:

[0016] At set intervals, the log information in the HASH table is converted into a UDP message.

[0017] Optionally, the UDP message includes a message header and multiple pieces of NAT connection information.

[0018] The present invention discloses a load balancing device, which is used for:

[0019] Store NAT connection information in local logs;

[0020] Performing HASH transformation on the NAT connection information according to the source IP address in the NAT connection information, and storing the transformed log information in a HASH table;

[0021] When the log information in the HASH table meets the set conditions, a UDP message is generated from the log information in the HASH table that meets the set conditions;

[0022] The UDP message is sent to the log server.

[0023] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0024] The present invention performs HASH transformation on NAT connection information according to the source IP address in the NAT connection information, and stores the transformed log information in a HASH table; when the log information in the HASH table meets the set conditions, a UDP message is generated for the log information in the HASH table that meets the set conditions, thereby avoiding the generation of a UDP message for each NAT connection information, ensuring the accuracy and timeliness of the NAT log message sending service, and reducing the service pressure of the load balancing device at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0026] Figure 1 A schematic diagram of a load balancing device NAT log collection method provided by an embodiment of the present invention;

[0027] Figure 2 A schematic diagram of a process for generating a UDP message corresponding to a first setting condition provided in an embodiment of the present invention;

[0028] Figure 3 A schematic diagram of a process for generating a UDP message corresponding to the second setting condition provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0030] The purpose of the present invention is to provide a load balancing device NAT log collection method and a load balancing device, so as to reduce the business pressure of the load balancing device.

[0031] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0032] Example 1

[0033] like Figure 1 As shown, a method for collecting NAT logs of a load balancing device of the present invention includes the following steps.

[0034] Step 101: Locally log and store NAT connection information in the load balancing device.

[0035] The NAT connection information includes a source IP address, a source port, a destination IP address, a destination port, and an IP address after NAT address conversion.

[0036] Step 102: Perform HASH transformation on the NAT connection information according to the source IP address in the NAT connection information, and store the transformed log information in a HASH table.

[0037] Wherein, step 102 specifically includes: using the classic hash algorithm __jash__max in the Linux kernel to perform HASH transformation on the NAT connection information, and storing the transformed log information in a HASH table.

[0038] Among them, __jhash_mix(a,b,c) is expressed as:

[0039] #define__jhash_mix(a,b,c)\

[0040] {\

[0041] a-=b; a-=c; a^=(c>>13);\

[0042] b-=c; b-=a; b^=(a<<8);\

[0043] c-=a;c-=b;c^=(b>>13);\

[0044] a-=b; a-=c; a^=(c>>12);\

[0045] b-=c; b-=a; b^=(a<<16);\

[0046] c-=a; c-=b; c^=(b>>5);\

[0047] a-=b; a-=c; a^=(c>>3);\

[0048] b-=c; b-=a; b^=(a<<10);\

[0049] c-=a;c-=b;c^=(b>>15);\

[0050] }.

[0051] Among them, parameter a is the source IP address, b can be any fixed value, and c is the calculated value used as the stored value.

[0052] Step 103: When the log information in the HASH table meets the set conditions, a UDP message is generated from the log information in the HASH table that meets the set conditions.

[0053] The UDP message includes a message header and multiple pieces of NAT connection information (original information of multiple NAT data flows).

[0054] Among them, Figure 2 As shown, step 103 specifically includes:

[0055] When the number of log information recorded in the HASH table reaches the set number, the log information in the HASH table is generated into a UDP message.

[0056] Or, if Figure 3 As shown, step 103 specifically includes:

[0057] At set intervals, the log information in the HASH table is converted into a UDP message.

[0058] After the UDP message is sent, the corresponding log information of the generated UDP message in the HASH table is deleted.

[0059] Step 104: Send the UDP message to a log server.

[0060] The present invention discloses a method for collecting NAT logs of a load balancing device, which reduces the original service pressure, ensures the accuracy and timeliness of the NAT log message sending service, and improves the local log recording performance.

[0061] Example 2

[0062] The present invention also discloses a load balancing device, which is used for:

[0063] Store NAT connection information in local logs.

[0064] The NAT connection information is subjected to HASH transformation according to the source IP address in the NAT connection information, and the transformed log information is stored in a HASH table.

[0065] When the log information in the HASH table meets the set conditions, a UDP message is generated for the log information in the HASH table that meets the set conditions.

[0066] The UDP message is sent to the log server.

[0067] The workflow of the load balancing device includes:

[0068] 1. Enable the NAT log function.

[0069] 2. Set the IP address and UDP port number of the log server.

[0070] 3. Set the log type and level.

[0071] Log types include email logs (mail), scheduled task logs (cron), logs generated during user authentication (auth), messages generated by the Network News Transfer Protocol (nntp) (news), user processes (user), system kernel messages (kern), and daemon processes (daemon).

[0072] Log levels include those that will cause the host system to be unavailable (Emergency), problems that must be solved immediately (Alert), more serious situations (Critical), errors in operation (Error), events that may affect system functions (Warning), events that will not affect the system but are worth noting (Notice), general information (Informational), and program or system debugging information (Debug).

[0073] 4. Set the NAT log generation conditions, you can select session creation, session creation and session deletion. That is, NAT logs are generated through session creation and session creation and deletion.

[0074] 5. Set whether to enable local logging and syslog mode.

[0075] When the log information in the HASH table meets the set conditions, a UDP message is generated for the log information in the HASH table that meets the set conditions, specifically including: when the flow in the HASH table ages, the log information in the HASH table is output, or when the flow in the HASH table reaches a certain number, the log information in the HASH table is output.

[0076] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0077] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A method for collecting NAT logs of a load balancing device, characterized in that: include: Locally log and store NAT connection information in the load balancing device; Performing HASH transformation on the NAT connection information according to the source IP address in the NAT connection information, and storing the transformed log information in a HASH table, specifically comprising: using the hash algorithm __jash__max in the Linux kernel to perform HASH transformation on the NAT connection information, and storing the transformed log information in the HASH table; When the log information in the HASH table meets the set conditions, a UDP message is generated from the log information in the HASH table that meets the set conditions; Sending the UDP message to a log server; When the log information in the HASH table meets the set conditions, the log information in the HASH table that meets the set conditions generates a UDP message, specifically including: when the log information recorded in the HASH table reaches a set number, the log information in the HASH table generates a UDP message; Alternatively, when the log information in the HASH table meets the set conditions, generating a UDP message from the log information in the HASH table that meets the set conditions specifically includes: generating a UDP message from the log information in the HASH table at set time intervals; After the UDP message is sent, the corresponding log information of the generated UDP message in the HASH table is deleted.

2. The method for collecting NAT logs of a load balancing device according to claim 1, characterized in that: The NAT connection information includes a source IP address, a source port, a destination IP address, a destination port, and an IP address after NAT address conversion.

3. The method for collecting NAT logs of a load balancing device according to claim 1, characterized in that: The UDP message includes a message header and multiple pieces of NAT connection information.

4. A load balancing device, characterized in that: The load balancing device is used for: Store NAT connection information in local logs; Performing HASH transformation on the NAT connection information according to the source IP address in the NAT connection information, and storing the transformed log information in a HASH table, specifically comprising: using the hash algorithm __jash__max in the Linux kernel to perform HASH transformation on the NAT connection information, and storing the transformed log information in the HASH table; When the log information in the HASH table meets the set conditions, a UDP message is generated from the log information in the HASH table that meets the set conditions; Sending the UDP message to a log server; When the log information in the HASH table meets the set conditions, the log information in the HASH table that meets the set conditions generates a UDP message, specifically including: when the log information recorded in the HASH table reaches a set number, the log information in the HASH table generates a UDP message; Alternatively, when the log information in the HASH table meets the set conditions, generating a UDP message from the log information in the HASH table that meets the set conditions specifically includes: generating a UDP message from the log information in the HASH table at set time intervals; After the UDP message is sent, the corresponding log information of the generated UDP message in the HASH table is deleted.

Citation Information

Patent Citations

  • WEB log NAT (Network Address Translation) front and back association method and system

    CN114389792A