Transparent proxy method, device, electronic device and computer-readable storage medium

The method addresses high resource consumption and maintenance costs in traditional proxy methods by establishing a mapping table for VLAN identifiers and performing security detection, reducing proxy server resource needs and maintenance complexity.

CN115866038BActive Publication Date: 2024-12-06BEIJING KNOWNSEC INFORMATION TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211512875.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-28
Publication Date
2024-12-06
Estimated Expiration
2042-11-28

AI Technical Summary

Technical Problem

Traditional transparent proxy methods consume large amounts of proxy server resources and incur high maintenance costs due to the need to store VLAN sub-interface configurations for each VLAN, especially when the number of VLANs is large.

Method used

A method that extracts key fields and VLAN identifiers from data packets, establishes a mapping relationship in a table, removes VLAN identifiers, and performs security detection before adding target VLAN identifiers to the packets, eliminating the need for proxy server configurations of individual VLAN sub-interfaces.

Benefits of technology

Reduces resource overhead and maintenance difficulty by avoiding the need for VLAN sub-interface configurations, thereby lowering proxy server resource consumption and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115866038B_ABST
    Figure CN115866038B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention proposes a transparent proxy method, device, electronic device and computer-readable storage medium, which belong to the field of network communication technology. When a proxy server receives a first source data packet sent by a first device, it extracts the key field and VLAN identifier of the first source data packet to establish a mapping relationship in a mapping table, removes the VLAN identifier of the first source data packet, and then detects and processes the first source data packet to obtain a first response data packet, and then queries the target VLAN identifier from the mapping table according to the key field of the first response data packet, and adds the target VLAN identifier to the first response data packet and sends it to the first device or the second device, so that the proxy server does not need to configure a corresponding VLAN sub-interface for each VLAN to process the source data packet with VLAN, which greatly reduces the resource overhead of the proxy server and can reduce the maintenance difficulty and maintenance cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, and in particular to a transparent proxy method, device, electronic device and computer-readable storage medium. Background Art

[0002] In order to isolate broadcast domains, save resources and facilitate management, enterprise networks are usually divided into multiple virtual local area networks (VLANs). Hosts between networks communicate with each other through virtual local area network relay technology (VLANTrunk). At the same time, in order to enhance network security, enterprises will deploy corresponding security devices or network devices, such as application firewalls.

[0003] In order not to change the original network topology, most security devices or network devices are connected to the virtual local area network in a transparent proxy manner. The proxy server is located between the client and the server, and the client first establishes a connection with the proxy server for communication. However, in the current transparent proxy method, the proxy server needs to store the VLAN sub-interface configuration corresponding to all VLANs in the network. When the number of VLANs is large, a large amount of proxy server resources need to be consumed, and the maintenance cost is high. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a transparent proxy method, device, electronic device and computer-readable storage medium, which can improve the problem that traditional transparent proxy methods need to consume a large amount of proxy server resources and have high maintenance costs.

[0005] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:

[0006] In a first aspect, an embodiment of the present invention provides a transparent proxy method, which is applied to a proxy server, and the method includes:

[0007] When receiving a first source data packet sent by a first device, extracting a key field and a VLAN identifier of the first source data packet, and establishing a mapping relationship between the key field and the VLAN identifier in a mapping table;

[0008] Removing the VLAN identifier of the first source data packet, and performing detection processing on the first source data packet after the VLAN identifier is removed to obtain a first response data packet;

[0009] Extracting a key field of the first response data packet, querying the mapping table according to the key field, obtaining a target VLAN identifier of the first response data packet, and adding the target VLAN identifier to the first response data packet and sending it to the first device or the second device;

[0010] The second device is a target device of the next hop of the first source data packet, and the first device and / or the second device are network devices in a virtual local area network.

[0011] Further, the first device is connected to an uplink interface of the proxy server, and the second device is connected to a downlink interface of the proxy server, and the method further includes:

[0012] receiving a second source data packet sent by the second device; wherein the second source data packet is response data of the first source data packet;

[0013] Removing the VLAN identifier in the second source data packet, and performing detection processing on the second source data packet after the VLAN identifier is removed to obtain a second response data packet;

[0014] Extract the key field of the second response data packet, query the mapping table according to the key field, obtain the target VLAN identifier of the second response data packet, and add the target VLAN identifier to the second response data packet and send it to the first device.

[0015] Furthermore, the step of extracting the key field of the first source data packet includes:

[0016] Parsing the first source data packet to extract the destination IP and source IP of the first source data packet;

[0017] The step of establishing a mapping relationship between the key field and the VLAN identifier in the mapping table includes:

[0018] A mapping relationship between the target IP and the VLAN ID, and a mapping relationship between the source IP and the VLAN ID are established in a mapping table.

[0019] Further, the step of extracting the key field of the first response data packet, querying the mapping table according to the key field, and obtaining the target VLAN identifier of the first response data packet includes:

[0020] Parsing the first response data packet to extract the destination IP or source IP of the first response data packet;

[0021] A VLAN identifier having a mapping relationship with the target IP or the source IP is determined from the mapping table as the target VLAN identifier.

[0022] Further, the step of extracting the key field of the second response data packet includes:

[0023] If the second response data packet is a data packet including the ARP protocol, extracting the source IP from the source data packet;

[0024] If the second response data packet is not a data packet including the ARP protocol, the destination IP is extracted from the source data packet.

[0025] Furthermore, the step of detecting and processing the first source data packet after removing the VLAN identifier to obtain a first response data packet includes:

[0026] Based on a preset security detection rule, a security detection is performed on the first source data packet after the VLAN identifier is removed to obtain a detection result;

[0027] If the detection result is safe, taking the first source data packet as the first response data packet;

[0028] If the detection result is unsafe, adding the key field of the first source data packet to the intercepted data as the first response data packet;

[0029] The step of sending the first response data to the first device or the second device includes:

[0030] If the detection result is safe, the first response data after adding the VLAN identifier is sent to the second device;

[0031] If the detection result is unsafe, the second response data with the VLAN identifier added is returned to the first device.

[0032] Further, when the second source data packet is not response data of the first source data packet, before the step of removing the VLAN identifier in the second source data packet, the method further includes:

[0033] Extract the key field and VLAN identifier of the second source data packet, and establish a mapping relationship between the key field and the VLAN identifier in a mapping table.

[0034] In a second aspect, an embodiment of the present invention provides a transparent proxy device, which is applied to a proxy server, and the transparent proxy device includes a first processing module and a second processing module;

[0035] The first processing module is used to extract the key field and VLAN identifier of the first source data packet when receiving the first source data packet sent by the first device, and establish a mapping relationship between the key field and the VLAN identifier in a mapping table;

[0036] The second processing module is used to remove the VLAN identifier of the first source data packet, and perform detection processing on the first source data packet after the VLAN identifier is removed to obtain a first response data packet;

[0037] The first processing module is further configured to extract a key field of the first response data packet, query the mapping table according to the key field, obtain a target VLAN identifier of the first response data packet, and add the target VLAN identifier to the first response data packet before sending it to the first device or the second device;

[0038] The second device is a target device of the next hop of the first source data packet, and the first device and / or the second device are network devices in a virtual local area network.

[0039] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the transparent proxy method as described in the first aspect.

[0040] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the transparent proxy method as described in the first aspect.

[0041] According to the transparent proxy method, device, electronic device and computer-readable storage medium provided by the embodiments of the present invention, when the proxy server receives the first source data packet sent by the first device, it extracts the key fields and VLAN identifier of the first source data packet to establish a mapping relationship in the mapping table, removes the VLAN identifier of the first source data packet, and then detects and processes the first source data packet to obtain a first response data packet, and then queries the target VLAN identifier from the mapping table according to the key fields of the first response data packet, and adds the target VLAN identifier to the first response data packet and sends it to the first device or the second device, so that the proxy server does not need to configure the corresponding VLAN sub-interface for each VLAN to process the source data packet with VLAN, which greatly reduces the resource overhead of the proxy server and can reduce the maintenance difficulty and maintenance cost.

[0042] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0044] Figure 1 A schematic diagram of the structure of a transparent proxy system provided by an embodiment of the present invention is shown.

[0045] Figure 2 A block diagram of a first proxy server or a second proxy server provided by an embodiment of the present invention is shown.

[0046] Figure 3 One of the flow charts of the transparent proxy method provided by the embodiment of the present invention is shown.

[0047] Figure 4 The second flowchart of the transparent proxy method provided by the embodiment of the present invention is shown.

[0048] Figure 5 Shows Figure 3 Schematic diagram of the process of some sub-steps of step S12.

[0049] Figure 6 Shows Figure 3 Schematic diagram of the flow chart of some sub-steps of step S13.

[0050] Figure 7 A block diagram of a transparent proxy device provided by an embodiment of the present invention is shown.

[0051] Figure 8 A block diagram of an electronic device provided by an embodiment of the present invention is shown.

[0052] Figure numerals: 100 - transparent proxy system; 110 - server; 120 - first proxy server; 130 - second proxy server; 140 - network device; 150 - host; 160 - transparent proxy apparatus; 170 - first processing module; 180 - second processing module; 190 - electronic device. DETAILED DESCRIPTION

[0053] The following will be combined with the accompanying 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. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0054] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0055] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0056] In a virtual local area network, in order to enhance the security of the network, corresponding security devices or network devices, such as application firewalls, are deployed. In order not to change the original network topology, most security devices or network devices use transparent proxy to enter the virtual local area network. As a proxy server, it is located between the client and the server. The client first establishes a connection with the proxy server for communication. However, the proxy server is generally a 64-bit system and cannot process VLAN tags.

[0057] At present, a common transparent proxy method is: when a local VLAN is created, a VLAN sub-interface needs to be configured on the proxy server and the VLAN needs to be identified. After obtaining the VLAN identification of the client data packet, the proxy server searches for the VLAN sub-interface corresponding to the VLAN identification to process the data packet. In this transparent proxy method, the proxy server needs to store the VLAN sub-interface configuration corresponding to all VLANs in the virtual local area. When the number of VLANs is large, a large amount of proxy server resources need to be consumed, and the maintenance cost is high.

[0058] Another common transparent proxy method is to pre-set a virtual VLAN ID, a virtual VLAN sub-interface, and a virtual gateway corresponding to the local VLAN ID on the proxy server. After receiving the client data packet, the proxy server modifies the VLAN ID to the preset virtual VLAN ID. After generating the target data packet, the target data packet VLAN ID is changed to the source VLAN ID and sent to the virtual gateway for processing. In this transparent proxy method, the proxy server needs to preset a virtual VLAN ID, sub-interface, and virtual gateway. Compared with the previous transparent proxy method, although it does not rely on the number of local VLANs and reduces the resource consumption of the proxy server, the maintenance cost of the virtual VLAN is still very high.

[0059] Based on the above considerations, an embodiment of the present invention provides a transparent proxy method, which can improve the problems of large resource consumption and high maintenance cost of the proxy server in the current transparent proxy method. The transparent proxy method is introduced below.

[0060] The transparent proxy method provided by the embodiment of the present invention can be applied to Figure 1 In the transparent proxy system 100 shown, the transparent proxy system 100 includes a server 110, multiple network devices 140, a first proxy server 120 and multiple second proxy servers 130, each network device is communicatively connected to multiple hosts 150 via a VLAN network, every two network devices 140 are communicatively connected via a second proxy server 130, and each network device 140 is communicatively connected to the server 110 via the first proxy server 120.

[0061] The network device 140 may be, but is not limited to, a router and a switch.

[0062] The first proxy server 120 and the second proxy server 130 can both implement the transparent proxy method provided in the embodiment of the present invention.

[0063] The first proxy server 120 and the second proxy server 130 both include an uplink interface and a downlink interface. Referring to the figure, Figure 2 The server 110 is connected to the downlink interface of the first proxy server 120, and each network device 140 is connected to the uplink interface of the first proxy server 120. For the first proxy server 120, the network device 140 can be connected to the uplink interface or the downlink interface of the first proxy server 120 according to the requirements.

[0064] It should be noted that both the first proxy server 120 and the second proxy server 130 run proxy service programs, and the proxy service programs can perform security detection on data packets based on preset security detection rules to obtain detection results.

[0065] In a possible implementation, a transparent proxy method is provided, referring to Figure 3 , including the following steps.

[0066] S11, when receiving a first source data packet sent by a first device, extracting key fields and VLAN identifiers of the first source data packet, and establishing a mapping relationship between the key fields and the VLAN identifiers in a mapping table.

[0067] It should be noted that the first source data packet has at least two key fields.

[0068] S12, removing the VLAN identifier of the first source data packet, and performing detection processing on the first source data packet after the VLAN identifier is removed to obtain a first response data packet.

[0069] S13, extracting the key field of the first response data packet, querying the mapping table according to the key field, obtaining the target VLAN identifier of the first response data packet, and adding the target VLAN identifier to the first response data packet and sending it to the first device or the second device.

[0070] The second device is a target device of the next hop of the first source data packet, and the first device and / or the second device is a network device 140 in a virtual local area network.

[0071] It should be understood that the key fields of the first response data packet are the key fields of the first source data packet.

[0072] The above transparent proxy method is applied to Figure 1 Taking the first proxy server 120 in FIG. 1 as an example, in this case, the server 110 is the second device and the network device 140 is the first device. The network device 140 receives a data packet sent from any host 150 connected to the downstream and sends the data packet to the upstream interface of the first proxy server 120 as the first source data packet (which may be any access request).

[0073] When the first proxy server 120 receives the first source data packet, it extracts the key fields and VLAN identifiers of the first source data packet and establishes a mapping relationship in the mapping table, removes the VLAN identifier of the first source data packet and hands it over to the first proxy server 120 program for detection and processing, and obtains the first response data (the first response data packet may be intercepted data or the first source data packet). Find the target VLAN identifier that has a mapping relationship with the key fields of the first response data packet from the mapping table, add the target VLAN identifier to the first response data packet, and then send the first response data packet to the server 110, or send the first response data packet to the network device 140.

[0074] It should be noted that when the above transparent proxy method is applied to Figure 1 When the second proxy device is used, the network device 140 connected to the uplink interface of the second proxy server 130 is the second device, and the network device 140 connected to the downlink interface of the second proxy server 130 is the first device, and the processing process is the same as the logic applied to the first proxy server 120, which will not be repeated in this embodiment.

[0075] Compared with the traditional transparent proxy method, the transparent proxy method provided by the embodiment of the present invention enables the proxy server to not need to configure a corresponding VLAN sub-interface for each VLAN to process source data packets with VLAN, which greatly reduces the resource overhead of the proxy server. At the same time, the proxy server does not need to set up virtual VLAN representation, sub-interface and virtual gateway, which can greatly reduce the difficulty and cost of maintenance.

[0076] Considering that when the first source data packet is sent to the second device, the second device will return the response data (access data) of the first source data packet (access request). Therefore, in order to further reduce resource overhead and improve the security of data transmission, refer to Figure 4 The transparent proxy method provided by the embodiment of the present invention also includes the following steps.

[0077] S14, receiving a second source data packet sent by the second device.

[0078] In this embodiment, the second source data packet is the real response data of the first source data packet, and the key field of the second source data packet is at least one of the key fields of the first source data packet.

[0079] S15, remove the VLAN identifier in the second source data packet, and perform detection processing on the second source data packet after the VLAN identifier is removed to obtain a second response data packet.

[0080] S16, extracting the key field of the second response data packet, querying the mapping table according to the key field, obtaining the target VLAN identifier of the second response data packet, and adding the target VLAN identifier to the second response data packet and sending it to the first device.

[0081] It should be noted that when the VLAN identifier of the second source data packet is consistent with the VLAN identifier of the first source data packet, and the proxy service program detects that the second source data packet is safe, the second response data packet is the second source data packet. If the detection result is unsafe, the second response data packet includes but is not limited to: access failure data.

[0082] After receiving the second source data packet, the first proxy server 120 uses the proxy service program to detect and process the second source data packet after removing the VLAN identifier. If the detection result is safe, the second source data packet is used as the second response data packet. Otherwise, the access failure data is added to the key field of the second source data packet as the second response data packet. Then, the target VLAN identifier with a mapping relationship with the key field of the second response data packet is found in the mapping table, and the target VLAN identifier is added to the second response data packet and sent to the first device.

[0083] It should be understood that, since the key field of the second source data packet is at least one of the key fields of the first source data packet. Therefore, on the basis of the mapping relationship between the key field of the first source data packet and the VLAN identification, it is not necessary to establish the mapping relationship between the key field of the second source data packet and the VLAN identification again. But based on the consideration of smooth data transmission, it is also possible to extract the VLAN identification and key field of the second source data packet to establish a mapping relationship before the second source data packet is detected.

[0084] Taking into account that the second source data packet may not be the response data of the first source data packet, therefore, when the second source data packet is not the response data of the first source data packet, before removing the response data of the second source data packet, the transparent proxy method provided by the embodiment of the present invention may also include: extracting the key fields and VLAN identifiers of the second source data packet, and establishing a mapping relationship between the key fields and the VLAN identifiers in a mapping table.

[0085] The selection of the key field can be flexibly set, for example, it can be characteristic information common to the first source data packet or the second source data packet, or it can be an IP address. In this embodiment, there is no specific limitation.

[0086] In order to enable both the first source data packet and the second source data packet to be transmitted smoothly, in a possible implementation, the key fields of the first source data packet include the destination IP and the source IP, and the key fields of the second source data packet and the second response data include the destination IP and / or the source IP. It should be understood that the destination IP of the second response data packet and the second source data packet is the source IP of the first source data packet, and the source IP of the second response data packet and the second source data packet is the destination IP of the first source data packet.

[0087] The method of extracting the key fields of the first source data packet in step S11 can be further implemented as follows: parsing the first source data packet to extract the destination IP and source IP of the first source data packet.

[0088] Based on the above, the method of establishing the mapping relationship between the key field and the VLAN ID in the mapping table in step S11 can be further implemented as follows: establishing the mapping relationship between the target IP and the VLAN ID, and the mapping relationship between the source IP and the VLAN ID in the mapping table.

[0089] Similarly, the method of extracting the key fields of the second response data packet in step S16 can be further implemented as follows: if the second response data packet is a data packet including the ARP protocol, the source IP is extracted from the source data packet; if the second response data packet is not a data packet including the ARP protocol, the destination IP is extracted from the source data packet.

[0090] The detection and processing method for the first source data packet after the VLAN identifier is removed can be flexibly selected. For example, it can be detected according to preset rules or by using a neural network. In this embodiment, there is no specific limitation.

[0091] In one possible implementation, refer to Figure 5 In S12, the first source data packet after the VLAN identifier is removed is detected and processed to obtain the first response data packet, which can be further implemented as the following steps.

[0092] S121, based on the preset security detection rule, perform security detection on the first source data packet after the VLAN identifier is removed to obtain a detection result. If the detection result is safe, execute step S122, otherwise, execute step S133.

[0093] S122, use the first source data packet as the first response data packet.

[0094] S123, adding the key field of the first source data packet to the intercepted data as the first response data packet.

[0095] When the detection result is safe, the first response data after adding the VLAN identifier is sent to the second device. When the detection result is unsafe, the second response data after adding the VLAN identifier is returned to the first device.

[0096] On the basis of the above, in a possible implementation manner, referring to Figure 6 , step S13 can obtain the target VLAN identifier through the following steps.

[0097] S131, parse the first response data packet and extract the destination IP or source IP of the first response data packet.

[0098] S132, determine from the mapping table a VLAN identifier that has a mapping relationship with the target IP or the source IP as the target VLAN identifier.

[0099] Through the above steps S131-S132, the target VLAN identifier of the first response data packet can be quickly determined.

[0100] Similarly, in step S16, the "first response data packet" in the above steps S131-S132 is replaced with the "second response data packet" to obtain the target VLAN identifier of the second response data packet.

[0101] The transparent proxy method provided by the embodiment of the present invention can realize VLAN Trunk communication under transparent proxy while performing security detection on the data packets of the network device 140 of the virtual local area network, without configuring or presetting any VLAN identifier or VLAN sub-interface on the proxy server, and is not affected by the number of local VLANs. It can greatly reduce the resource consumption of the proxy server and reduce the maintenance difficulty and cost.

[0102] Based on the inventive concept of the transparent proxy method, in a possible implementation manner, the present invention further provides a transparent proxy device 160, which can be applied to Figure 1 The first proxy server 120 in the embodiment may also be applied to Figure 1 The second proxy server 130 in Figure 7 , the transparent proxy device 160 may include a first processing module 170 and a second processing module 180 .

[0103] The first processing module 170 is configured to extract key fields and a VLAN identifier of the first source data packet when receiving the first source data packet sent by the first device, and to establish a mapping relationship between the key fields and the VLAN identifier in a mapping table.

[0104] The second processing module 180 is used to remove the VLAN identifier of the first source data packet, and perform detection processing on the first source data packet after the VLAN identifier is removed to obtain a first response data packet.

[0105] The first processing module 170 is also used to extract the key field of the first response data packet, query the mapping table according to the key field, obtain the target VLAN identifier of the first response data packet, and add the target VLAN identifier to the first response data packet and send it to the first device or the second device.

[0106] The second device is a target device of the next hop of the first source data packet, and the first device and / or the second device is a network device 140 in a virtual local area network.

[0107] Furthermore, the first processing module 170 is also used to receive a second source data packet sent by the second device.

[0108] The second processing module 180 is further configured to remove the VLAN identifier in the second source data packet, and perform detection processing on the second source data packet after the VLAN identifier is removed to obtain a second response data packet.

[0109] The first processing module 170 is further used to extract the key field of the second response data packet, query the mapping table according to the key field, obtain the target VLAN identifier of the second response data packet, and add the target VLAN identifier to the second response data packet before sending it to the first device.

[0110] In the transparent proxy device 160, through the synergistic effect of the first processing module 170 and the second processing module 180, the proxy server does not need to configure a corresponding VLAN sub-interface for each VLAN to process the source data packet with the VLAN, which greatly reduces the resource overhead of the proxy server. At the same time, the proxy server does not need to set up a virtual VLAN representation, sub-interface and virtual gateway, which can greatly reduce the difficulty and cost of maintenance.

[0111] For the specific definition of the transparent proxy device 160, please refer to the definition of the transparent proxy method above, which will not be repeated here. Each module in the above transparent proxy device 160 can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0112] In one embodiment, an electronic device 190 is provided. The electronic device 190 may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The electronic device 190 includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. Among them, the processor of the electronic device 190 is used to provide computing and control capabilities. The memory of the electronic device 190 includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the electronic device 190 is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, an operator network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a transparent proxy method as provided in the above embodiment is implemented.

[0113] Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the electronic device 190 to which the solution of the present invention is applied. The specific electronic device 190 may include Figure 8More or fewer components may be shown, or certain components may be combined, or may have a different arrangement of components.

[0114] In one embodiment, the transparent proxy device 160 provided by the present invention can be implemented in the form of a computer program. The computer program can be used in Figure 8 The electronic device 190 is shown as running. The memory of the electronic device 190 can store various program modules constituting the transparent proxy device 160, for example, Figure 7 The first processing module 170 and the second processing module 180 are shown. The computer program composed of various program modules enables the processor to execute the steps of the transparent proxy method described in this specification.

[0115] For example, Figure 8 The electronic device 190 shown may be Figure 7 The first processing module 170 in the transparent proxy device 160 shown in the figure performs step S11. The electronic device 190 may perform step S12 through the second processing module 180. The electronic device 190 may perform step S13 through the first processing module 170.

[0116] In one embodiment, an electronic device 190 is provided, including a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program: upon receiving a first source data packet sent by a first device, extracting key fields and a VLAN identifier of the first source data packet, and establishing a mapping relationship between the key fields and the VLAN identifier in a mapping table; removing the VLAN identifier of the first source data packet, and performing detection processing on the first source data packet after the VLAN identifier is removed to obtain a first response data packet; extracting the key field of the first response data packet, querying the mapping table according to the key field, obtaining a target VLAN identifier of the first response data packet, and adding the target VLAN identifier to the first response data packet and sending it to the first device or the second device.

[0117] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: when a first source data packet sent by a first device is received, key fields and VLAN identifiers of the first source data packet are extracted, and a mapping relationship between the key fields and the VLAN identifiers is established in a mapping table; the VLAN identifier of the first source data packet is removed, and the first source data packet after the VLAN identifier is removed is detected and processed to obtain a first response data packet; the key fields of the first response data packet are extracted, the mapping table is searched according to the key fields, the target VLAN identifier of the first response data packet is obtained, and the target VLAN identifier is added to the first response data packet and then sent to the first device or the second device.

[0118] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0119] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0120] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0121] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A transparent proxy method, It is characterized in that Applied to a proxy server, the method comprises: When receiving a first source data packet sent by a first device, extracting a key field and a VLAN identifier of the first source data packet, and establishing a mapping relationship between the key field and the VLAN identifier in a mapping table; Removing the VLAN identifier of the first source data packet, and performing detection processing on the first source data packet after the VLAN identifier is removed to obtain a first response data packet; Extracting a key field of the first response data packet, querying the mapping table according to the key field, obtaining a target VLAN identifier of the first response data packet, and adding the target VLAN identifier to the first response data packet and sending it to the first device or the second device; The second device is a target device of the next hop of the first source data packet, and the first device and / or the second device are network devices in a virtual local area network; The step of detecting and processing the first source data packet after the VLAN identifier is removed to obtain a first response data packet includes: Based on a preset security detection rule, a security detection is performed on the first source data packet after the VLAN identifier is removed to obtain a detection result; If the detection result is safe, taking the first source data packet as the first response data packet; If the detection result is unsafe, adding the key field of the first source data packet to the intercepted data as the first response data packet; The step of sending the first response data to the first device or the second device includes: If the detection result is safe, the first response data after adding the VLAN identifier is sent to the second device; If the detection result is unsafe, the second response data with the VLAN identifier added is returned to the first device.

2. The transparent proxy method according to claim 1, It is characterized in that The first device is connected to an uplink interface of the proxy server, and the second device is connected to a downlink interface of the proxy server. The method further includes: receiving a second source data packet sent by the second device; wherein the second source data packet is response data of the first source data packet; Removing the VLAN identifier in the second source data packet, and performing detection processing on the second source data packet after the VLAN identifier is removed to obtain a second response data packet; Extract the key field of the second response data packet, query the mapping table according to the key field, obtain the target VLAN identifier of the second response data packet, and add the target VLAN identifier to the second response data packet and send it to the first device.

3. The transparent proxy method according to claim 1 or 2, It is characterized in that The step of extracting the key fields of the first source data packet comprises: Parsing the first source data packet to extract the destination IP and source IP of the first source data packet; The step of establishing a mapping relationship between the key field and the VLAN identifier in the mapping table includes: A mapping relationship between the target IP and the VLAN ID, and a mapping relationship between the source IP and the VLAN ID are established in a mapping table.

4. The transparent proxy method according to claim 3, It is characterized in that The step of extracting the key field of the first response data packet, querying the mapping table according to the key field, and obtaining the target VLAN identifier of the first response data packet includes: Parsing the first response data packet to extract the destination IP or source IP of the first response data packet; A VLAN identifier having a mapping relationship with the target IP or the source IP is determined from the mapping table as the target VLAN identifier.

5. The transparent proxy method according to claim 2, It is characterized in that The step of extracting the key fields of the second response data packet comprises: If the second response data packet is a data packet including the ARP protocol, extracting the source IP from the source data packet; If the second response data packet is not a data packet including the ARP protocol, the destination IP is extracted from the source data packet.

6. The transparent proxy method according to claim 2, It is characterized in that When the second source data packet is not the response data of the first source data packet, before the step of removing the VLAN identifier in the second source data packet, the method further includes: Extract the key field and VLAN identifier of the second source data packet, and establish a mapping relationship between the key field and the VLAN identifier in a mapping table.

7. A transparent proxy device, It is characterized in that Applied to a proxy server, the transparent proxy device comprises a first processing module and a second processing module; The first processing module is used to extract the key field and VLAN identifier of the first source data packet when receiving the first source data packet sent by the first device, and establish a mapping relationship between the key field and the VLAN identifier in a mapping table; The second processing module is used to remove the VLAN identifier of the first source data packet, and perform detection processing on the first source data packet after the VLAN identifier is removed to obtain a first response data packet; The first processing module is further configured to extract a key field of the first response data packet, query the mapping table according to the key field, obtain a target VLAN identifier of the first response data packet, and add the target VLAN identifier to the first response data packet before sending it to the first device or the second device; The second device is a target device of the next hop of the first source data packet, and the first device and / or the second device are network devices in a virtual local area network; The second processing module is further used for: Based on a preset security detection rule, a security detection is performed on the first source data packet after the VLAN identifier is removed to obtain a detection result; If the detection result is safe, taking the first source data packet as the first response data packet; If the detection result is unsafe, adding the key field of the first source data packet to the intercepted data as the first response data packet; The first processing module is further used for: If the detection result is safe, the first response data after adding the VLAN identifier is sent to the second device; If the detection result is unsafe, the second response data with the VLAN identifier added is returned to the first device.

8. An electronic device, It is characterized in that The invention comprises a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the transparent proxy method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the transparent proxy method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method, device and system for network monitoring

    CN106559283A

  • Data message processing method and device

    CN107317740A

  • F5G terminal VLAN aggregation method, system and device and storage medium

    CN115118547A

  • Communication method for one-way transmission based on VLAN id and switch device using the same

    US20220231881A1