CN110933190A - Client address obtaining method and device, storage medium and computer equipment - Google Patents

Client address obtaining method and device, storage medium and computer equipment Download PDF

Info

Publication number
CN110933190A
CN110933190A CN201910992092.9A CN201910992092A CN110933190A CN 110933190 A CN110933190 A CN 110933190A CN 201910992092 A CN201910992092 A CN 201910992092A CN 110933190 A CN110933190 A CN 110933190A
Authority
CN
China
Prior art keywords
address
data processing
processing request
client
real server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910992092.9A
Other languages
Chinese (zh)
Other versions
CN110933190B (en
Inventor
覃华伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910992092.9A priority Critical patent/CN110933190B/en
Publication of CN110933190A publication Critical patent/CN110933190A/en
Priority to PCT/CN2020/119105 priority patent/WO2021073431A1/en
Application granted granted Critical
Publication of CN110933190B publication Critical patent/CN110933190B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/741Routing in networks with a plurality of addressing schemes, e.g. with both IPv4 and IPv6
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/251Translation of Internet protocol [IP] addresses between different IP versions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content

Abstract

The invention discloses a method and a device for acquiring a client address, a storage medium and computer equipment, relates to the technical field of information, and mainly aims to realize that a real server acquires the client address in a load balancing mode without modifying the code of the real server and improve the efficiency of acquiring the client address. The method comprises the following steps: acquiring a service protocol type supported by a real server, and receiving a data processing request sent by a client in a load balancing mode; adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address; and forwarding the data processing request after the address is replaced to a real server, wherein the real server is used for calling an extraction function corresponding to the service protocol type and extracting the client address from the data processing request after the address is replaced. The method and the device are suitable for obtaining the client address.

Description

Client address obtaining method and device, storage medium and computer equipment
Technical Field
The present invention relates to the field of information technologies, and in particular, to a method and an apparatus for acquiring a client address, a storage medium, and a computer device.
Background
The load balancing (fullmat) mode is a mode for forwarding client requests by an IP virtual server (IPVS), and is characterized in that: when the data packet is input, destination address conversion (DNAT) and source address conversion (SNAT) are carried out on the request packet and the response packet, so that communication between a Linux Virtual Server (LVS) and a back-end real server (RealServer) can be carried out across a virtual local area network (vlan), and the RealServer is only required to be connected to an intranet. But in the FULLNAT mode RealServer cannot acquire the Client address (Client IP).
At present, in the full nat mode, a manner that a specific service protocol option carries a client address is generally adopted to implement RealServer to acquire the client address. However, in practical applications, if the RealServer does not support the specific service protocol, the code of the RealServer needs to be modified based on the kernel layer, and complicated code migration is performed on the RealServer, which results in a complicated process of obtaining the address of the client and a low efficiency of obtaining the address of the client.
Disclosure of Invention
In view of this, the present invention provides a method, an apparatus, a storage medium, and a computer device for obtaining a client address, and mainly aims to achieve that a real server obtains a client address in a load balancing mode, and improve efficiency of obtaining the client address without modifying a code of the real server.
According to an aspect of the present invention, there is provided a method for client address acquisition, including:
acquiring a service protocol type supported by a real server, and receiving a data processing request sent by a client in a load balancing mode;
adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address;
and forwarding the data processing request with the address replaced to the real server, wherein the real server is used for calling an extraction function corresponding to the service protocol type and extracting the client address from the data processing request with the address replaced.
Optionally, the adding a service agreement option corresponding to the service agreement type in the data processing request includes:
according to the service protocol type, a service protocol option corresponding to the service protocol type is searched locally;
and adding the searched service protocol option into a request header of the data processing request.
Optionally, the replacing the source address of the protocol header in the service protocol option with the client address includes:
extracting a client address in the data processing request;
searching and deleting a source address of a protocol header in the service protocol option;
and utilizing a preset address replacement function to store the client address to the position of the source address of the protocol head.
Optionally, the adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address includes:
adding a MIPv6 option in the data processing request, and replacing a source address of a protocol header in the MIPv6 option with a client address;
the forwarding the data processing request with the address replaced to the real server, where the real server is configured to call an extraction function corresponding to the service protocol type, and extract the client address from the data processing request with the address replaced, and the method includes:
forwarding the data processing request including the MIPv6 option to the real server, wherein the real server is used for calling an extraction function corresponding to the MIPv6 option and extracting the client address from the data processing request.
Optionally, before adding the service agreement option corresponding to the service agreement type in the data processing request, the method further includes:
detecting whether the real server needs to use a source address or not by detecting whether a source address acquisition instruction sent by the real server to the client is received or not;
the adding of the service agreement option corresponding to the service agreement type in the data processing request includes:
and if not, executing the step of adding the service agreement option corresponding to the service agreement type in the data processing request.
Correspondingly, after detecting whether the real server needs to use a source address, the method further includes:
and if so, forwarding the data processing request to the real server.
Optionally, after replacing the source address of the protocol header in the service protocol option with the client address, the method further includes:
saving the source address to a specified data structure;
and when a source address acquisition instruction sent to the client by the real server is received, extracting the source address from the data structure and sending the source address to the real server.
According to a second aspect of the present invention, there is provided a client address obtaining apparatus, including:
the system comprises an acquisition unit, a load balancing unit and a processing unit, wherein the acquisition unit is used for acquiring the service protocol type supported by a real server and receiving a data processing request sent by a client under a load balancing mode;
the adding unit is used for adding a service protocol option corresponding to the service protocol type in the data processing request;
a replacing unit, configured to replace a source address of a protocol header in the service protocol option with a client address;
and the forwarding unit is used for forwarding the data processing request after the address is replaced to the real server.
Optionally, the adding unit includes: a searching module and an adding module, wherein the searching module and the adding module,
the searching module is used for locally searching a service protocol option corresponding to the service protocol type according to the service protocol type;
and the adding module is used for adding the searched service protocol option into a request header of the data processing request.
Optionally, the replacement unit further comprises: an extraction module, a search module and a replacement module,
the extraction module is used for extracting the client address in the data processing request;
the searching and deleting module is used for searching and deleting the source address of the protocol head in the service protocol option;
and the replacing module is used for storing the client address to the position of the source address of the protocol head by using a preset address replacing function.
Optionally, the adding unit is specifically configured to add an MIPv6 option in the data processing request, and replace a source address of a protocol header in the MIPv6 option with a client address;
the forwarding unit is specifically configured to forward the data processing request including the MIPv6 option to the real server, where the real server is configured to invoke an extraction function corresponding to the MIPv6 option, and extract the client address from the data processing request.
Optionally, the apparatus further comprises: a detection unit for detecting the position of the optical fiber,
the detection unit is used for detecting whether the real server needs to use the source address or not by detecting whether a source address acquisition instruction sent by the real server to the client is received or not;
the adding unit is further configured to, if not needed, execute the step of adding the service agreement option corresponding to the service agreement type in the data processing request.
Further, the forwarding unit is further configured to forward the data processing request to the real server if necessary.
Optionally, the apparatus further comprises: a storage unit and an extraction unit, wherein,
a saving unit configured to save the source address into a specified data structure;
and the extracting unit is used for extracting the source address from the data structure and sending the source address to the real server when receiving a source address acquisition instruction sent by the real server to the client.
According to a third aspect of the present invention, there is provided a storage medium having at least one executable instruction stored therein, the executable instruction causing a processor to perform the steps of: acquiring a service protocol type supported by a real server, and receiving a data processing request sent by a client in a load balancing mode; adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address; and forwarding the data processing request with the address replaced to the real server, wherein the real server is used for calling an extraction function corresponding to the service protocol type and extracting the client address from the data processing request with the address replaced.
According to a fourth aspect of the present invention, there is provided a computer device comprising a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus, and the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to perform the following steps: acquiring a service protocol type supported by a real server, and receiving a data processing request sent by a client in a load balancing mode; adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address; and forwarding the data processing request with the address replaced to the real server, wherein the real server is used for calling an extraction function corresponding to the service protocol type and extracting the client address from the data processing request with the address replaced.
Compared with the prior art that the client address is acquired by a real server in a mode that a specific service protocol option carries the client address, the method for acquiring the client address acquires the client address by acquiring the service protocol type supported by the real server and receiving a data processing request sent by the client in a load balancing mode; adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address; and forwarding the data processing request with the address replaced to the real server, wherein the real server is used for calling an extraction function corresponding to the service protocol type and extracting the client address from the data processing request with the address replaced. Therefore, the real server can acquire the client address in the load balancing mode without modifying the code of the real server, and the efficiency of acquiring the client address is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 shows a flowchart of a client address obtaining method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram illustrating a client address obtaining apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram illustrating another client address obtaining apparatus according to an embodiment of the present invention;
fig. 4 shows a physical structure diagram of a computer device according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As described in the background art, currently, in the full nat mode, a manner that a specific service protocol option carries a client address is usually adopted to implement RealServer to obtain the client address. However, in practical applications, if the RealServer does not support the specific service protocol, the code of the RealServer needs to be modified based on the kernel layer, and complicated code migration is performed on the RealServer, which results in a complicated process of obtaining the address of the client and a low efficiency of obtaining the address of the client.
In order to solve the above problem, an embodiment of the present invention provides a method for obtaining an address of a client, as shown in fig. 1, where the method includes:
101. and acquiring the service protocol type supported by the real server, and receiving a data processing request sent by the client in a load balancing mode.
The execution subject of the invention can be IPVS, and particularly can be a Layer-4 switch, and is used for providing load balancing. The types of service protocols supported by the real server may include a TCP protocol, a UDP protocol, and the like. The data processing request may be a GET request, a PUT request, or the like sent by the client to the RealServer.
102. And adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address.
Specifically, searching a corresponding service protocol option according to the obtained service protocol type, and adding the searched service protocol option to a request header of the data processing request; and extracting a client address in the data processing request, and replacing the source address of the protocol header in the service protocol option by the client address. For example: the obtained service protocol type supported by the server may be a TCP protocol, and if a service protocol option corresponding to the service protocol type search may be an MIPv6 option, the source address of the protocol header in the MIPv6 option may be replaced with the client address.
103. And forwarding the data processing request with the address replaced to the real server, wherein the real server is used for calling an extraction function corresponding to the service protocol type and extracting the client address from the data processing request with the address replaced.
After analyzing the data processing request, the real server locally searches a corresponding extraction function according to a service protocol type in the data processing request, and the real server locally stores a corresponding relation between the service protocol type and the extraction function; and the real server calls the searched extraction function and extracts the client address from the data processing request.
Further, in order to better describe the process of the client address obtaining method, as a refinement and an extension of the above embodiment, the embodiment of the present invention provides several alternative embodiments, but is not limited to this, and specifically the following embodiments are provided:
in an optional embodiment of the present invention, the step 102 may specifically include: according to the service protocol type, a service protocol option corresponding to the service protocol type is searched locally; and adding the searched service protocol option into a request header of the data processing request.
For the embodiment of the present invention, the execution subject may be an IPVS, and the IPVS may locally store the correspondence between the service protocol type and the service protocol option. After the service protocol option corresponding to the service protocol type is found, the service protocol option corresponding to the service protocol type may be added to a request message sent by a client, where the request message may include: request line, request header, space, request body, and in particular, the service agreement option may be added to the request header.
In an optional embodiment of the present invention, the step 102 may further include: extracting a client address in the data processing request; searching and deleting a source address of a protocol header in the service protocol option; and utilizing a preset address replacement function to store the client address to the position of the source address of the protocol head.
Specifically, the client address in the data processing request may be extracted by calling an extraction function, where the extraction function may specifically be request. Searching a source address of a protocol header in the service protocol option, and deleting data in the source address; and storing the client address to the position of the source address of the protocol head by using the preset address replacement function, wherein the address replacement function can be used for copying the client address and pasting the client address to the position of the source address of the protocol head.
In an optional embodiment of the present invention, the step 102 may specifically further include: adding a MIPv6 option in the data processing request, and replacing a source address of a protocol header in the MIPv6 option with a client address.
Among them, the RealServer may be a real server supporting IPv 6. The MIPv6 option may be included in a destination option extension header of IPv6, the destination option extension header may be an optional extension header of IPv6, and adding the header type field of the destination option extension header to the last extension header of IPv6 may be implemented, thereby completing the addition of the MIPv6 option. The role of the MIPv6 option may include: when the client moves, the client can be used as a mobile Node (mobile Node, MN), the MIPv6 option can set a fixed Home Address (Home Address) for each mobile Node, and when the mobile Node is in a Home network segment, the mobile Node communicates with a Communication Node (CN) according to a conventional routing technology without the intervention of the MIPv 6. When the mobile node moves to a foreign link, the home address of the mobile node remains unchanged while a temporary Care-of address (Care-of address) is obtained. The mobile node informs a Home Agent (HA) of a binding message of a home address and a care-of address. The communication between the communication node and the mobile node still uses the home address of the mobile node, the data packet is still sent to the home network segment of the mobile node, and the home agent intercepts the data packet and forwards the data packet to the care-of address of the mobile node through the tunneling technology according to the obtained mapping relation, thereby realizing that the mobile node can directly communicate with the communication node. When the client transmits packets outside the home network segment, the care-of address is typically used as the source address in the MIPv6 option.
It should be noted that, in the present invention, an actual MIPv6 access authentication and home registration mechanism with the client is not needed, and only after receiving a data processing request sent by the client, the client address is encapsulated in the MIPv6 field and sent to the RealServer at the back end.
Correspondingly, the step 103 may specifically include: forwarding the data processing request including the MIPv6 option to the real server, wherein the real server is used for calling an extraction function corresponding to the MIPv6 option and extracting the client address from the data processing request.
After receiving the data processing request after replacing the address, the RealServer may call a function to obtain the client address from the data processing request. The called function may be a recv _ from function, and the recv _ from function may be specifically configured to receive a request packet and capture an address of a data transmission source. After receiving the request, the RealServer may call a recv _ from function to obtain a source address in the MIPv6 option in the request message, where the source address is the client address. It should be noted that, in the present invention, the RealServer may support Linux to open option # if defined (CONFIG _ IPv6_ MIP6) | defined (CONFIG _ IPv6_ MIP6_ MODULE) of the official support IPv 6.
In addition, it should be noted that the above process is based on that the type of the data processing request sent by the client is an IPv6 request, but if the type of the data processing request sent by the client is an IPv4 request, the IPVS may encapsulate the IPv6 into the HomeAddress, which is described above in detail and is not described here again. The process of encapsulating the IPv6 into the HomeAddress may include: and converting the IPv4 address into an IPv6 address, and encapsulating the obtained IPv6 address in a Destination Options for IPv6(DSTOPTS) option of the request header.
In an optional embodiment of the present invention, before adding a service agreement option corresponding to the service agreement type in the data processing request, the method may further include: and detecting whether the real server needs to use the source address or not by detecting whether a source address acquisition instruction sent by the real server to the client is received or not.
Wherein the real server may send a source address acquisition instruction to the client. After receiving a data processing request sent by the client, firstly detecting whether a source address acquisition instruction sent by the real server is received, and further detecting whether the real server needs to use a source address: if a source address acquisition instruction sent to the client by the real server is received, determining that the real server needs to use a source address; and if a source address acquisition instruction sent to the client by the real server is not received, determining that the real server does not need to use a source address.
Further, after detecting whether a source address acquisition instruction sent by the real server to the client is received and detecting whether the real server needs to use a source address, the method further includes: and if not, executing the step of adding the service agreement option corresponding to the service agreement type in the data processing request. If it is detected that the RealServer does not need to acquire the source address, a service protocol option corresponding to the service protocol type may be added to the data processing request, and the service protocol option after address replacement is forwarded to the RealServer.
Correspondingly, after detecting whether the real server needs to use the source address by detecting whether a source address acquisition instruction sent by the real server to the client is received, the method further includes: and if so, forwarding the data processing request to the real server. If the RealServer needs to acquire the source address, the address of the client is not replaced after the data processing request sent by the client is received, and the data processing request is directly forwarded to the RealServer.
In an optional embodiment of the present invention, after replacing the source address of the protocol header in the service protocol option with the client address, the method may further include: saving the source address to a specified data structure; and when a source address acquisition instruction sent to the client by the real server is received, extracting the source address from the data structure and sending the source address to the real server.
After the source address of the protocol header in the service protocol option is replaced by the user side address, the replaced source address can be stored in a specified data structure, and the stored address is recorded. For example, the source address may be stored in a memory space local to the IPVS, and the address of the data structure stored by the source address may be recorded. When a source address acquisition instruction sent to the client by the real server is received, the corresponding source address can be searched according to the storage address, and the corresponding source address is extracted and sent to the RealServer.
Further, as a specific implementation of fig. 1, an embodiment of the present invention provides a client address obtaining apparatus, as shown in fig. 2, where the apparatus includes: an acquisition unit 21, an addition unit 22, a replacement unit 23 and a forwarding unit 24.
The obtaining unit 21 may be configured to obtain a service protocol type supported by a real server, and receive a data processing request sent by a client in a load balancing mode;
the adding unit 22 may be configured to add a service agreement option corresponding to the service agreement type in the data processing request;
the replacing unit 23 may be configured to replace a source address of a protocol header in the service protocol option with a client address;
the forwarding unit 24 may be configured to forward the data processing request after replacing the address to the real server.
The adding unit 22 may include: the lookup module 221 and the add module 222, as shown in figure 3,
the searching module 221 may be configured to locally search, according to the service protocol type, a service protocol option corresponding to the service protocol type;
the adding module 222 may be configured to add the found service agreement option to a request header of the data processing request.
The replacement unit 23 may include: an extraction module 231, a lookup module 232 and a replacement module 233,
the extracting module 231 may be configured to extract a client address in the data processing request;
the search deleting module 232 may be configured to search for and delete a source address of a protocol header in the service protocol option;
the replacing module 233 may be configured to store the client address in a location where a source address of the protocol header is located by using a preset address replacing function.
Further, the adding unit 22 may be specifically configured to add an MIPv6 option in the data processing request, and replace a source address of a protocol header in the MIPv6 option with a client address;
further, the forwarding unit 24 may be specifically configured to forward the data processing request including the MIPv6 option to the real server, where the real server is configured to call an extraction function corresponding to the MIPv6 option, and extract the client address from the data processing request.
For the embodiment of the present invention, in order to detect whether the real server needs to use a source address, the apparatus may further include: the detection unit (25) is provided with a detection unit,
the detecting unit 25 may be configured to detect whether the real server needs to use a source address by detecting whether a source address obtaining instruction sent by the real server to the client is received;
the adding unit 22 may be further configured to, if not required, execute the step of adding the service agreement option corresponding to the service agreement type in the data processing request.
The forwarding unit 24 may be further configured to forward the data processing request to the real server, if necessary.
For the embodiment of the present invention, in order to store and forward the source address to the real server, the apparatus may further include: a saving unit 26 and an extracting unit 27,
the saving unit 26 may be configured to save the source address into a specified data structure;
the extracting unit 27 may be configured to, when receiving a source address obtaining instruction sent by the real server to the client, extract the source address from the data structure and send the source address to the real server.
It should be noted that other corresponding descriptions of the functional modules related to the client address obtaining apparatus provided in the embodiment of the present invention may refer to the corresponding description of the method shown in fig. 1, and are not described herein again.
Based on the method shown in fig. 1, correspondingly, an embodiment of the present invention further provides a storage medium, where at least one executable instruction is stored in the storage medium, and the executable instruction causes a processor to perform the following steps: acquiring a service protocol type supported by a real server, and receiving a data processing request sent by a client in a load balancing mode; adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address; and forwarding the data processing request with the address replaced to the real server, wherein the real server is used for calling an extraction function corresponding to the service protocol type and extracting the client address from the data processing request with the address replaced.
Based on the above-mentioned embodiments of the method shown in fig. 1 and the apparatus shown in fig. 2, the embodiment of the present invention further provides a computer device, as shown in fig. 4, including a processor (processor)31, a communication Interface (communication Interface)32, a memory (memory)33, and a communication bus 34. Wherein: the processor 31, the communication interface 32, and the memory 33 communicate with each other via a communication bus 34. A communication interface 34 for communicating with network elements of other devices, such as clients or other servers. The processor 31 is configured to execute a program, and may specifically execute relevant steps in the above-described client address obtaining method embodiment. In particular, the program may include program code comprising computer operating instructions. The processor 31 may be a central processing unit CPU or a Specific integrated circuit asic (application Specific integrated circuit) or one or more integrated circuits configured to implement an embodiment of the present invention.
The terminal comprises one or more processors, which can be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs. And a memory 33 for storing a program. The memory 33 may comprise a high-speed RAM memory, and may further include a non-volatile memory (non-volatile memory), such as at least one disk memory. The program may specifically be adapted to cause the processor 31 to perform the following operations: acquiring a service protocol type supported by a real server, and receiving a data processing request sent by a client in a load balancing mode; adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address; and forwarding the data processing request with the address replaced to the real server, wherein the real server is used for calling an extraction function corresponding to the service protocol type and extracting the client address from the data processing request with the address replaced.
By the technical scheme, the service protocol type supported by the real server can be obtained, and the data processing request sent by the client in the load balancing mode is received; adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address; and forwarding the data processing request with the address replaced to the real server, wherein the real server is used for calling an extraction function corresponding to the service protocol type and extracting the client address from the data processing request with the address replaced. Therefore, the real server can acquire the client address in the load balancing mode without modifying the code of the real server, and the efficiency of acquiring the client address is improved.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be appreciated that the relevant features of the method and apparatus described above are referred to one another. In addition, "first", "second", and the like in the above embodiments are for distinguishing the embodiments, and do not represent merits of the embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the components in accordance with embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (10)

1. A method for acquiring a client address is characterized by comprising the following steps:
acquiring a service protocol type supported by a real server, and receiving a data processing request sent by a client in a load balancing mode;
adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address;
and forwarding the data processing request with the address replaced to the real server, wherein the real server is used for calling an extraction function corresponding to the service protocol type and extracting the client address from the data processing request with the address replaced.
2. The method of claim 1, wherein adding a service agreement option corresponding to the service agreement type to the data processing request comprises:
according to the service protocol type, a service protocol option corresponding to the service protocol type is searched locally;
and adding the searched service protocol option into a request header of the data processing request.
3. The method of claim 1, wherein replacing a source address of a protocol header in the service protocol option with a client address comprises:
extracting a client address in the data processing request;
searching and deleting a source address of a protocol header in the service protocol option;
and utilizing a preset address replacement function to store the client address to the position of the source address of the protocol head.
4. The method according to claim 1, wherein the adding a service protocol option corresponding to the service protocol type in the data processing request, and replacing a source address of a protocol header in the service protocol option with a client address comprises:
adding a MIPv6 option in the data processing request, and replacing a source address of a protocol header in the MIPv6 option with a client address;
the forwarding the data processing request with the address replaced to the real server, where the real server is configured to call an extraction function corresponding to the service protocol type, and extract the client address from the data processing request with the address replaced, and the method includes:
forwarding the data processing request including the MIPv6 option to the real server, wherein the real server is used for calling an extraction function corresponding to the MIPv6 option and extracting the client address from the data processing request.
5. The method of claim 1, wherein prior to adding the service agreement option corresponding to the service agreement type in the data processing request, the method further comprises:
detecting whether the real server needs to use a source address or not by detecting whether a source address acquisition instruction sent by the real server to the client is received or not;
and if not, executing the step of adding the service agreement option corresponding to the service agreement type in the data processing request.
6. The method of claim 5, wherein after detecting whether the real server needs to use a source address, the method further comprises:
and if so, forwarding the data processing request to the real server.
7. The method of claim 1, wherein after replacing the source address of the protocol header in the service protocol option with the client address, the method further comprises:
saving the source address to a specified data structure;
and when a source address acquisition instruction sent to the client by the real server is received, extracting the source address from the data structure and sending the source address to the real server.
8. An apparatus for obtaining a client address, comprising:
the system comprises an acquisition unit, a load balancing unit and a processing unit, wherein the acquisition unit is used for acquiring the service protocol type supported by a real server and receiving a data processing request sent by a client under a load balancing mode;
the adding unit is used for adding a service protocol option corresponding to the service protocol type in the data processing request;
a replacing unit, configured to replace a source address of a protocol header in the service protocol option with a client address;
and the forwarding unit is used for forwarding the data processing request after the address is replaced to the real server.
9. A storage medium having a computer program stored thereon, the storage medium having at least one executable instruction stored therein, the executable instruction causing a processor to perform operations corresponding to the client address obtaining method according to any one of claims 1 to 7.
10. A computer device comprising a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus, and the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the client address acquisition according to any one of claims 1 to 7.
CN201910992092.9A 2019-10-18 2019-10-18 Client address acquisition method and device, storage medium and computer equipment Active CN110933190B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910992092.9A CN110933190B (en) 2019-10-18 2019-10-18 Client address acquisition method and device, storage medium and computer equipment
PCT/CN2020/119105 WO2021073431A1 (en) 2019-10-18 2020-09-29 Method and apparatus for acquiring client address, storage medium, and computer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910992092.9A CN110933190B (en) 2019-10-18 2019-10-18 Client address acquisition method and device, storage medium and computer equipment

Publications (2)

Publication Number Publication Date
CN110933190A true CN110933190A (en) 2020-03-27
CN110933190B CN110933190B (en) 2022-09-27

Family

ID=69849179

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910992092.9A Active CN110933190B (en) 2019-10-18 2019-10-18 Client address acquisition method and device, storage medium and computer equipment

Country Status (2)

Country Link
CN (1) CN110933190B (en)
WO (1) WO2021073431A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111586200A (en) * 2020-04-29 2020-08-25 平安科技(深圳)有限公司 Method and system for transmitting real IP address of client
CN113885794A (en) * 2021-09-10 2022-01-04 鸬鹚科技(深圳)有限公司 Data access method and device based on multi-cloud storage, computer equipment and medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006277569A (en) * 2005-03-30 2006-10-12 Toshiba Corp Load distribution system, load distribution device, real server and load distribution method
CN102014175A (en) * 2010-12-09 2011-04-13 中兴通讯股份有限公司 DHCPv6 protocol-based IPv4 address distribution method and system
CN102790798A (en) * 2012-05-23 2012-11-21 蓝汛网络科技(北京)有限公司 Transparent proxy implementation method, device and system in content distribution network
CN103297407A (en) * 2012-03-02 2013-09-11 百度在线网络技术(北京)有限公司 Method and device for transmitting IPv6 address and port of client-side to back-end server
CN103491016A (en) * 2012-06-08 2014-01-01 百度在线网络技术(北京)有限公司 Method, system and device for transferring source address in UDP load balancing system
US20160094513A1 (en) * 2014-09-30 2016-03-31 A10 Networks, Incorporated Use of packet header extension for layer-3 direct server return
CN105554065A (en) * 2015-12-03 2016-05-04 华为技术有限公司 Method, conversion unit and application unit for message processing
CN108173976A (en) * 2016-12-07 2018-06-15 腾讯科技(深圳)有限公司 Domain name analytic method and device
CN109729104A (en) * 2019-03-19 2019-05-07 北京百度网讯科技有限公司 Client source address acquiring method, device, server and computer-readable medium
CN110099115A (en) * 2019-04-30 2019-08-06 湖南麒麟信安科技有限公司 A kind of load-balancing method and system of transparent scheduling forwarding
CN110324437A (en) * 2019-07-09 2019-10-11 中星科源(北京)信息技术有限公司 A kind of original address transmission method, system, storage medium and processor

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101815104A (en) * 2010-03-19 2010-08-25 中兴通讯股份有限公司 Network protocol address feedback method and domain name resolution server
CN103491053A (en) * 2012-06-08 2014-01-01 北京百度网讯科技有限公司 UDP load balancing method, UDP load balancing system and UDP load balancing device

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006277569A (en) * 2005-03-30 2006-10-12 Toshiba Corp Load distribution system, load distribution device, real server and load distribution method
CN102014175A (en) * 2010-12-09 2011-04-13 中兴通讯股份有限公司 DHCPv6 protocol-based IPv4 address distribution method and system
CN103297407A (en) * 2012-03-02 2013-09-11 百度在线网络技术(北京)有限公司 Method and device for transmitting IPv6 address and port of client-side to back-end server
CN102790798A (en) * 2012-05-23 2012-11-21 蓝汛网络科技(北京)有限公司 Transparent proxy implementation method, device and system in content distribution network
CN103491016A (en) * 2012-06-08 2014-01-01 百度在线网络技术(北京)有限公司 Method, system and device for transferring source address in UDP load balancing system
US20160094513A1 (en) * 2014-09-30 2016-03-31 A10 Networks, Incorporated Use of packet header extension for layer-3 direct server return
CN105554065A (en) * 2015-12-03 2016-05-04 华为技术有限公司 Method, conversion unit and application unit for message processing
CN108173976A (en) * 2016-12-07 2018-06-15 腾讯科技(深圳)有限公司 Domain name analytic method and device
CN109729104A (en) * 2019-03-19 2019-05-07 北京百度网讯科技有限公司 Client source address acquiring method, device, server and computer-readable medium
CN110099115A (en) * 2019-04-30 2019-08-06 湖南麒麟信安科技有限公司 A kind of load-balancing method and system of transparent scheduling forwarding
CN110324437A (en) * 2019-07-09 2019-10-11 中星科源(北京)信息技术有限公司 A kind of original address transmission method, system, storage medium and processor

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111586200A (en) * 2020-04-29 2020-08-25 平安科技(深圳)有限公司 Method and system for transmitting real IP address of client
CN111586200B (en) * 2020-04-29 2022-05-17 平安科技(深圳)有限公司 Method and system for transmitting real IP address of client
CN113885794A (en) * 2021-09-10 2022-01-04 鸬鹚科技(深圳)有限公司 Data access method and device based on multi-cloud storage, computer equipment and medium
CN113885794B (en) * 2021-09-10 2024-01-26 鸬鹚科技(深圳)有限公司 Data access method and device based on multi-cloud storage, computer equipment and medium

Also Published As

Publication number Publication date
WO2021073431A1 (en) 2021-04-22
CN110933190B (en) 2022-09-27

Similar Documents

Publication Publication Date Title
CN107872545B (en) Message transmission method and device and computer readable storage medium
EP2939399B1 (en) Methods and system for seamless network communications between ipv4 and ipv6 devices
US10798222B2 (en) Apparatus for managing SDN-based in-vehicle network and control method thereof
US10461958B2 (en) Packet transmission method and apparatus
US20230014411A1 (en) Dynamic internet protocol translation for port-control-protocol communication
CN102480526B (en) Peer-to-peer connection system and the method used under multi-network environment
CN106572197B (en) Network address translation method, device and system
EP2564579A1 (en) Method and apparatus for synthesized address detection
CN110933190B (en) Client address acquisition method and device, storage medium and computer equipment
CN106982163B (en) Method and gateway for acquiring route on demand
CN103581351B (en) The method and apparatus of network access
US20130332586A1 (en) Providing ipv6 connectivity through shared external interfaces on electronic devices
US7286512B1 (en) System and method for supporting alternative addressessing in a mobile network
CN110830434A (en) Universal transparent proxy method
US20040141513A1 (en) Address translation device
US20140365557A1 (en) Information processing device, content distribution method, and content distribution system
CN111565237B (en) Network parameter determination method and device, computer equipment and storage medium
US20120143939A1 (en) Mobile node and method for maintaining session using logical interface
TW201114221A (en) Method and system of smart detection and recovery
WO2017166038A1 (en) Communication method and terminal
US20050113109A1 (en) Method, apparatus and system for context-based registrations based on intelligent location detection
JP6605149B2 (en) Method and apparatus for detecting shared terminal
CN110290230B (en) Method, device and storage medium for detecting dialing mode supported by network environment
CN110035134B (en) Network address translation method, device and access equipment
CN105939398B (en) IPv6 transition method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant