CN111835885B - Network address translation method, device and equipment - Google Patents

Network address translation method, device and equipment Download PDF

Info

Publication number
CN111835885B
CN111835885B CN202010679579.4A CN202010679579A CN111835885B CN 111835885 B CN111835885 B CN 111835885B CN 202010679579 A CN202010679579 A CN 202010679579A CN 111835885 B CN111835885 B CN 111835885B
Authority
CN
China
Prior art keywords
address
application layer
network
address translation
layer
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.)
Active
Application number
CN202010679579.4A
Other languages
Chinese (zh)
Other versions
CN111835885A (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.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies 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 Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN202010679579.4A priority Critical patent/CN111835885B/en
Publication of CN111835885A publication Critical patent/CN111835885A/en
Application granted granted Critical
Publication of CN111835885B publication Critical patent/CN111835885B/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
    • H04L61/256NAT traversal
    • H04L61/2564NAT traversal for a higher-layer protocol, e.g. for session initiation protocol [SIP]
    • 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/2514Translation of Internet protocol [IP] addresses between local and global IP addresses
    • 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/2517Translation of Internet protocol [IP] addresses using port numbers
    • 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/255Maintenance or indexing of mapping tables

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a network address translation method, a device and equipment. The network address translation method provided by the application comprises the following steps: judging whether the received message is a Session Initiation Protocol (SIP) invitation message or not; if so, carrying out address conversion on the network layer IP address of the SIP invitation message; and performing address translation on the application layer IP address of the SIP invitation message according to a pre-configured network address translation NAT mapping table. The network address translation method, the network address translation device and the network address translation equipment can avoid the problem of wrong translation of the IP address of the application layer, and further avoid the problem that video data cannot be transmitted due to the wrong translation of the IP address of the application layer.

Description

Network address translation method, device and equipment
Technical Field
The present application relates to the field of communications, and in particular, to a method, an apparatus, and a device for network address translation.
Background
Session Initiation Protocol (SIP) is an application layer control protocol, is mainly used for creating, modifying or terminating sessions, and is widely applied to the field of video monitoring.
In the field of video monitoring, a playback control server and a recording control server often use SIP negotiation to enable a camera (a camera controlled by the recording control server) to acquire an IP address of a player (a player controlled by the playback control server), so that the camera sends video data to the player. During specific implementation, the playing control server informs the camera of the IP address of the player through the IP address of the player carried in the SIP invitation message sent to the recording control server.
When the playing control server is located in the local area network, the target NAT device located in the same local area network as the playing control server performs address translation on the SIP invite message from the playing control server. When the target NAT device performs address translation on the SIP invite message, it performs address translation on a network layer IP address (an IP address carried in a message header of the SIP invite message), and updates an application layer IP address in the SIP invite message to an address after the network layer IP address performs address translation. I.e. the application layer IP address (the IP address of the player) is converted into the network layer IP address for address conversion.
And after the NAT equipment performs address translation on the application layer IP address of the SIP invitation message according to the method, the IP address of the player is translated into the public network IP address corresponding to the target NAT equipment. If the playing control server and the player controlled by the playing control server are located in different local area networks, the public network IP address corresponding to the player should be the public network IP address corresponding to the NAT device in the local area network where the playing control server is located, rather than the public network IP address corresponding to the target NAT device. Namely, when the playing control server and the player controlled by the playing control server are located in different local area networks, after the address conversion is carried out by adopting the method, the problem of error conversion of the IP address of the application layer exists. Accordingly, when the application layer IP address translation is wrong, video data cannot be transmitted.
Disclosure of Invention
In view of this, the present application provides a network address translation method, device and apparatus, so as to solve the problem that video data cannot be transmitted due to an application layer IP address translation error when the existing network address translation method performs address translation on an SIP invite message.
A first aspect of the present application provides a network address translation method, where the method includes:
judging whether the received message is a Session Initiation Protocol (SIP) invitation message or not;
if so, carrying out address conversion on the network layer IP address of the SIP invitation message;
and performing address translation on the application layer IP address of the SIP invitation message according to a pre-configured network address translation NAT mapping table.
A second aspect of the present application provides a network address translation device, comprising a determination module, a network layer address translation module, and an application layer address translation module, wherein,
the judging module is used for judging whether the received message is a Session Initiation Protocol (SIP) invitation message;
the network layer address conversion module is used for carrying out address conversion on the network layer IP address of the SIP invitation message when the judging module judges that the received message is the SIP invitation message;
and the application layer address translation module is used for translating the address of the application layer IP address of the SIP invitation message according to a pre-configured network address translation NAT mapping table.
A third aspect of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of any of the network address translation methods provided herein.
A fourth aspect of the present application provides a computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of any of the network address translation methods provided in the present application when executing the program.
According to the network address translation method, the network address translation device and the network address translation equipment, whether a received message is a Session Initiation Protocol (SIP) invitation message is judged, when the received message is judged to be the SIP invitation message, address translation is carried out on a network layer IP address of the SIP invitation message, and address translation is carried out on an application layer IP address of the SIP invitation message according to a pre-configured Network Address Translation (NAT) mapping table. Therefore, the application layer IP address is converted based on the pre-configured network address conversion NAT mapping table, so that the converted IP address can be ensured to be correct, and the problem that video data cannot be transmitted due to the error conversion of the application layer IP address can be avoided.
Drawings
FIG. 1 is a schematic diagram of a video surveillance system shown in an exemplary embodiment;
fig. 2 is a flowchart of a first embodiment of a network address translation method provided in the present application;
FIG. 3 is an interaction diagram of the video surveillance system shown in FIG. 1 after performing network address translation using the method provided by the present application;
fig. 4 is a flowchart of a second embodiment of a network address translation method provided in the present application;
fig. 5 is a flowchart of a third embodiment of network address translation provided by the present application;
fig. 6 is a hardware structure diagram of a network address translation device where a network address translation apparatus is located according to an exemplary embodiment of the present application;
fig. 7 is a schematic structural diagram of a first network address translation device according to an embodiment of the present disclosure.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if," as used herein, may be interpreted as "at \8230; \8230when" or "when 8230; \823030when" or "in response to a determination," depending on the context.
Session Initiation Protocol (SIP) is an application layer control protocol, is mainly used for creating, modifying or terminating sessions, and is widely applied to the field of video monitoring.
In the field of video monitoring, a play control server and a record control server often make a camera controlled by the record control server know an IP address of a player controlled by the play control server through SIP negotiation, so that the camera sends acquired video data to the player for playing. In specific implementation, the playing control server informs the camera of the IP address of the player by carrying the IP address of the player in the message body of the SIP invite message sent to the recording control server (the IP address carried in the message body of the SIP invite message is the application layer IP address of the SIP invite message).
When the playing control server is located in the local area network, the target NAT device located in the same local area network as the playing control server performs network address translation on the SIP invite message from the playing control server. When the target NAT device performs network address translation on the SIP invite message, NAT translation is performed on a network layer IP address (an IP address carried in a message header of the SIP invite message), and an application layer IP address in the SIP invite message is updated to an address after NAT translation is performed on the network layer IP address. I.e. the application layer IP address (the IP address of the player) is converted into the address after the address conversion of the network layer IP address.
For example, FIG. 1 is a schematic diagram of a video surveillance system, shown in an exemplary embodiment. Referring to fig. 1, the video monitoring system shown in fig. 1 includes a player 1, a first NAT device 2, a play control server 3, a second NAT device 4, a recording control server 5 and a camera 6, where the player 1 and the first NAT device 2 are in the same local area network, the play control server 3 and the second NAT device 4 are in the same local area network, the recording control server 5 and the camera 6 are in a public network, the play controller 3 is configured to manage and control the player 1, and the recording control server 5 is configured to manage and control the camera 6. The play control server 3 performs SIP negotiation with the recording controller 5 to inform the camera 6 of the IP address of the player 1 before the camera 6 transmits video data to the player 1.
In concrete implementation, when the playing control server 3 sends the SIP invite message to the recording controller 5, the message body of the SIP invite message carries the private network IP address of the player 1, so as to inform the private network IP address of the player 1 to the camera 6 through the recording controller 5. For example, in an embodiment, the private network IP address of the playing control server 3 is 1.1.1.5/32, the private network IP address of the player 1 is 1.1.2.5/32, the public network IP address of the second NAT device 4 is 3.3.3.5/32, the network layer IP address (in this application, the network layer IP address refers to a network layer source IP address) of the SIP invite message sent by the playing control server 3 to the video recording control server 5 is 1.1.1.1.5/32, and the application layer IP address is 1.1.2.5/32, and after receiving the SIP invite message, the second NAT device 4 converts both the network layer IP address and the application layer IP address of the SIP invite message into 3.3.3.3.5/32.
Further, after receiving the SIP invite message, the recording control server 5 instructs the camera 6 to send video data to the device identified by the application layer IP address of the SIP invite message, that is, instructs the camera to send video data to the device identified by 3.3.3.5/32 (the device identified by 3.3.3.5/32 is the second NAT device 4).
With reference to fig. 1, in fact, the player 1 and the first NAT device 2 are in the same local area network, and the translated public network IP address should be the public network IP address (2.2.2.5/32) corresponding to the first NAT device 2. After the address translation is performed by using the above method, the private network IP address of the player 1 is translated into the public network IP address corresponding to the second NAT device 4, that is, the application layer IP address of the SIP invite message is translated incorrectly. Thus, when the second NAT device 4 receives the video data, since the second NAT device 4 is in a different local area network from the player 1, NAT information matching the private IP address of the player 1 is not stored on the second NAT device 4, that is, the second NAT device 4 cannot restore 3.3.3.5/32 to 1.1.2.5/32, and cannot send the received video data to the player 1.
Referring to the foregoing description, that is, when the playback control server and the player controlled by the playback control server are located in different local area networks, after the address translation is performed by the above method, there is a problem of an application layer IP address translation error. Accordingly, when the application layer IP address translation is wrong, the video data cannot be transmitted.
In view of this, the present application provides a network address translation method, device and apparatus, so as to solve the problem that video data cannot be transmitted due to an application layer IP address translation error when the existing network address translation method performs address translation on an SIP invite message.
According to the network address translation method, the network address translation device and the network address translation equipment, whether a received message is a Session Initiation Protocol (SIP) invitation message is judged, when the received message is judged to be the SIP invitation message, the network layer IP address of the SIP invitation message is subjected to address translation, and the application layer IP address of the SIP invitation message is subjected to address translation according to a pre-configured Network Address Translation (NAT) mapping table. Therefore, the application layer IP address is converted based on the pre-configured network address conversion NAT mapping table, so that the converted IP address can be ensured to be correct, and the problem that video data cannot be transmitted due to the fact that the application layer IP address is converted wrongly can be avoided.
Several specific embodiments are given below to describe the technical solutions of the present application in detail, and these specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 2 is a flowchart of a first embodiment of a network address translation method provided in the present application. Referring to fig. 2, the method provided in this embodiment may include:
s201, judging whether the received message is a Session Initiation Protocol (SIP) invitation message.
Specifically, when the destination port of the message is a 5060 port and the message carries an Invite field, it may be determined that the message is an SIP Invite message.
And S201, if so, carrying out address conversion on the network layer IP address of the SIP invitation message.
It should be noted that, for a specific implementation principle and implementation process related to address translation for a network layer IP address, reference may be made to descriptions in the related art, and details are not described here. In addition, in the present application, the network layer IP address refers to a network layer source IP address. In the application, whether the destination IP address of the network layer needs to be subjected to address conversion is not concerned. In addition, if the destination IP address of the network layer needs to be converted, the conversion may be performed according to a related method, which is not described herein again.
S202, address translation is carried out on the application layer IP address of the SIP invitation message according to a pre-configured NAT mapping table.
Specifically, the preconfigured NAT mapping table may include a static NAT mapping table and/or a dynamic NAT static table. The static mapping table records the mapping relation between the private network IP address and the public network IP address. For example, for the example shown in fig. 1, the following static NAT information may be configured in the static mapping table in advance: 1.1.2.5/32-2.2.2.5/32.
In addition, the mapping relation among the interface, the private network IP address and the public network IP address is recorded in the dynamic NAT mapping table. It should be noted that, in some scenarios, when it is desired to convert the application layer IP addresses of two SIP invite messages into different public network IP addresses for the two SIP invite messages with the same application layer IP address and different access interfaces, dynamic NAT information may be configured to implement the conversion.
Specifically, when the NAT mapping table includes the static NAT mapping table, the application layer IP address of the SIP invite message may be matched with the static NAT mapping table, and then address translation is performed on the application layer IP address according to the matched static NAT information.
When the NAT mapping table simultaneously comprises a dynamic NAT static table, when an SIP invitation message is received, an input interface of the SIP invitation message can be obtained, then dynamic NAT information matched with the input interface and an application layer IP address is inquired from the dynamic NAT mapping table, and further address conversion is carried out on the application layer IP address according to the inquired dynamic NAT information.
When the pre-configured NAT mapping table includes both a static NAT mapping table and a dynamic NAT static table, the address translation of the application layer IP address can be performed based on any NAT mapping table, or when the address translation of the application layer IP address is performed based on any NAT mapping table, if the address translation is not successful (there is no entry matching with the application layer IP address), the address translation of the application layer IP address is performed based on the other NAT mapping table.
Further, referring to fig. 3, fig. 3 is an interaction schematic diagram of the video monitoring system shown in fig. 1 after the video monitoring system performs network address translation by using the method provided by the present application. Referring to fig. 3, after the network address is converted according to the method provided in the present application, the network layer IP address of the SIP invite message is converted into 3.3.3.5/32, and the application layer IP address is converted into 2.2.2.5/32. Correspondingly, when receiving the converted SIP invite message, the recording control server 5 instructs the camera 6 to send video data to the device identified by 2.2.2.5/32. Further, after the camera 6 sends the video data to the device (the first NAT device 4) identified by 2.2.2.5/32, since the device is a NAT device of the local area network where the player 1 is located, and the NAT information corresponding to the player 1 is stored on the device, it can restore the public network IP address 2.2.2.5/32 to the private network IP address 1.1.2.5/32 of the player 1, and further forward the video data to the player 1.
In the method provided by this embodiment, by determining whether the received message is a session initiation protocol SIP invite message, and when determining that the received message is a SIP invite message, performing address translation on a network layer IP address of the SIP invite message, and performing address translation on an application layer IP address of the SIP invite message according to a pre-configured NAT mapping table. Therefore, the application layer IP address is based on the pre-configured network address translation NAT mapping table, so that the translated IP address can be ensured to be correct, namely, the problem of error in translation of the application layer IP address caused by the fact that the application layer IP address is translated according to the address after the network layer address translation can be avoided, and the problem that video data cannot be transmitted caused by error in translation of the application layer IP address is further avoided.
Fig. 4 is a flowchart of a second network address translation method according to the present application. Referring to fig. 4, on the basis of the foregoing embodiment, before step S202, the method provided in this embodiment may further include:
s401, judging whether the application layer IP address is consistent with the network layer IP address.
And S402, if not, performing address translation on the application layer IP address according to the NAT mapping table.
It should be noted that, when the application layer IP address is consistent with the network layer IP address, the application layer IP address may be directly converted into the network layer IP address for address conversion.
For example, in an embodiment, an application layer IP address of an SIP invite message is 1.1.2.5/32, and a network layer IP address is 1.1.1.5/32, and at this time, address translation is performed on the application layer IP address according to a preconfigured NAT mapping table.
According to the method provided by the embodiment, when the application layer IP address is not consistent with the network layer IP address, the address translation is carried out on the application layer IP address according to the NAT mapping table. Therefore, the conversion efficiency can be improved, and the resources can be saved.
Fig. 5 is a flowchart of a third embodiment of network address translation provided by the present application. The method provided by the embodiment may include:
s501, when the received message is a Session Initiation Protocol (SIP) invitation message, acquiring a network layer IP address and an application layer IP address of the SIP invitation message.
Specifically, the SIP invite message is composed of a start line, a message header, and a message body. Wherein, the IP address carried in the message header is the network layer IP address. In addition, the main information in the message body is media control information described by an SDP (Session Description Protocol, SDP for short) Protocol, which is used for both parties to negotiate and establish a media channel, wherein the carried IP address is an application layer IP address.
S502, address conversion is carried out on the network layer IP address.
The specific implementation principle and implementation process of this step can be referred to the description in the related art, and are not described herein again.
S503, judging whether the network layer IP address is consistent with the application layer IP address, if so, executing step S504, and if not, executing step S505.
S504, the application layer IP address is converted into the address after the network layer IP address is subjected to address conversion.
For example, in an embodiment, the network layer IP address and the application layer IP address are both 1.1.1.5, at this time, the player and the play control server are integrated in one device, and at this time, the application layer IP address is directly converted into an address obtained by address conversion of the network layer IP address.
S505, searching a routing table item matched with the application layer IP address from the routing table, if the routing table item is not searched, executing step S506, and if the routing table item is searched, executing step S510.
For example, in an embodiment, the network layer IP address is 1.1.1.5/32, and the application layer IP address is 1.1.2.5/32, and at this time, the network layer IP address and the application layer IP address are not consistent, and address translation needs to be performed on the application layer IP address according to a pre-configured NAT mapping table.
In this embodiment, a routing table entry matching 1.1.2.5/32 is first searched from the routing table, if the routing table entry is found, step S506 is executed, and if the routing table entry is not found, step S510 is executed.
S506, inquiring static NAT information matched with the application layer IP address from a pre-configured static NAT mapping table; and recording the corresponding relation between the private network IP address and the public network IP address by each table entry in the static NAT mapping table.
Specifically, the user may pre-configure the static NAT mapping table according to actual needs. For example, for each player, a user may configure the static NAT information for the player on the NAT device corresponding to the play control server of the player. In addition, the static NAT information for the player may be a correspondence between a private network IP address of the player and a public network IP address corresponding to the NAT device of the local network where the player is located. For example, in the example shown in fig. 1, the following static NAT information may be preconfigured on the second NAT device 4: 1.1.2.5/32-2.2.2.5/32.
And S507, if the address translation is found, carrying out address translation on the application layer IP address according to the static NAT information.
In connection with the above example, in this step, the application layer IP address (1.1.2.5/32) is converted to 2.2.2.5/32.
S508, if the first reminding message is not inquired, outputting a first reminding message; the first reminding message is used for reminding a user of configuring static NAT information aiming at the application layer IP address or routing table items and dynamic NAT information aiming at the application layer IP address.
Specifically, the first reminding message can be output in a text mode and/or a voice mode. In the present application, the output mode of the first reminder message is not limited. For example, in one embodiment, the text "please configure static NAT information for 1.1.2.5/32 or configure routing information and dynamic NAT information for 1.1.2.5/32" may be output to alert the user based on the text.
In addition, for the first reminding message, the user can select to configure the static NAT information and/or configure the routing information and the dynamic NAT information according to actual needs.
It should be noted that, for two SIP invite messages with the same application layer IP address and different access interfaces, if it is desired to convert the application layer IP addresses of the two SIP invite messages into different public network IP addresses, at this time, the dynamic NAT information may be configured to implement the conversion.
S509, address conversion is carried out on the application layer IP address according to the information configured by the user.
Specifically, after the address translation is performed on the application layer IP address according to the information configured by the user, the information configured by the user may also be stored. In this way, address translation may be performed subsequently based on this information.
S510, inquiring dynamic NAT information matched with an outgoing interface of the routing table item and the application IP from a pre-configured dynamic NAT mapping table; the dynamic NAT mapping table records the corresponding relation among the private network IP address, the public network IP address and the interface.
Specifically, the user may pre-configure the dynamic NAT mapping table according to actual needs. For example, for each player, the user configures the dynamic NAT information for the player on the NAT device corresponding to the play control server of the player. In addition, the dynamic NAT information for the player may be a correspondence between a private network IP address of the player, a public network IP address corresponding to the NAT device of the local network where the player is located, and an interface of the player. For example, in the example shown in fig. 1, the following dynamic NAT information may be preconfigured on the second NAT device: 1.1.2.5/32-2.2.5/32, any interface.
And S511, if the address translation is found, carrying out address translation on the application layer IP address according to the dynamic NAT information.
S512, if the second reminding message is not inquired, outputting a second reminding message; and the second reminding message is used for reminding a user of configuring dynamic NAT information matched with the outgoing interface and the application layer IP.
Specifically, the first reminding message can be output in a text mode and/or a voice mode. In this application, the output mode of the second reminder message is not limited. For example, in one embodiment, the following voice "please configure the dynamic NAT information for 1.1.2.5/32 may be output.
S513, address translation is carried out on the application layer IP address according to the dynamic NAT information configured by the user.
Specifically, after address translation is performed on the application layer IP address according to the dynamic NAT information configured by the user, the dynamic NAT information configured by the user may also be stored. In this way, address translation may be performed subsequently based on this information.
In the method provided by this embodiment, when performing address translation on an application layer IP address, whether the application layer IP address is consistent with a network layer IP address is determined, and when the application layer IP address is inconsistent with the network layer IP address, the application layer IP address is subjected to address translation based on a preconfigured NAT mapping table. Therefore, the converted application layer IP address can be ensured to be correct, the problem that video data cannot be transmitted due to the fact that the application layer IP address is converted wrongly is avoided, and conversion efficiency can be improved.
Corresponding to the foregoing embodiments of the network address translation method, the present application also provides embodiments of a network address translation apparatus.
The embodiment of the network address translation device can be applied to network address translation equipment. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. Taking software implementation as an example, as a device in a logical sense, the device is formed by reading corresponding computer program instructions in the memory into the memory through the processor of the network address translation device where the device is located to operate. In terms of hardware, as shown in fig. 6, for a hardware structure diagram of a network address translation device where a network address translation apparatus is located in an exemplary embodiment of the present application, except for the storage 610, the processor 620, the memory 630, and the network interface 640 shown in fig. 6, the network address translation device where the apparatus is located in the embodiment may also include other hardware according to an actual function of the network address translation apparatus, which is not described again.
Fig. 7 is a schematic structural diagram of a network address translation device according to a first embodiment of the present disclosure. Referring to fig. 7, the apparatus provided in this embodiment may include a determining module 710, a network layer address translation module 720 and an application layer address translation module 730, wherein,
the determining module 710 is configured to determine whether the received message is a session initiation protocol SIP invite message;
the network layer address translation module 720 is configured to, when the determining module determines that the received message is an SIP invite message, perform address translation on a network layer IP address of the SIP invite message;
the application layer address translation module 730 is configured to perform address translation on the application layer IP address of the SIP invite message according to a preconfigured network address translation NAT mapping table.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 1, and the implementation principle and the technical effect are similar, which are not described herein again.
Further, the determining module 710 is further configured to determine whether the application layer IP address is consistent with the network layer IP address before the application layer address translation module 730 performs address translation on the application layer IP address of the SIP invite message according to a preconfigured network address translation NAT mapping table;
the application layer address translation module 730 is specifically configured to perform address translation on the application layer IP address according to the NAT mapping table when the determination module determines that the application layer IP address is inconsistent with the network layer IP address.
Further, the application layer address translation module 730 is specifically configured to:
searching a routing table item matched with the IP address of the application layer from a routing table;
if the address is not found, inquiring static NAT information matched with the application layer IP address from a pre-configured static NAT mapping table; wherein, each table entry in the static NAT mapping table records the corresponding relation between the private network IP address and the public network IP address;
and performing address translation on the application layer IP address according to the inquired static NAT information.
Further, if the routing table entry matching the application layer IP address is found from the routing table, the application layer address translation module 730 is further specifically configured to:
inquiring dynamic NAT information matched with an outgoing interface of the routing table item and the application IP from a pre-configured dynamic NAT mapping table; the dynamic NAT mapping table records the corresponding relation among the private network IP address, the public network IP address and the interface;
and performing address translation on the application layer IP address according to the inquired dynamic NAT information.
The present application further provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of any of the network address translation methods provided herein.
In particular, computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media and memory devices, including by way of example semiconductor memory devices (e.g., EPROM, EEPROM, and flash memory devices), magnetic disks (e.g., internal hard disk or removable disks), magneto-optical disks, and CD ROM and DVD-ROM disks.
With reference to fig. 6, the present application further provides a network address translation device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the processor implements the steps of any network address translation method provided in the present application.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (8)

1. A method for network address translation, the method comprising:
judging whether the received message is a Session Initiation Protocol (SIP) invitation message or not;
if so, carrying out address conversion on the network layer IP address of the SIP invitation message;
performing address translation on the application layer IP address of the SIP invitation message according to a pre-configured network address translation NAT mapping table;
before the address translation is performed on the application layer IP address of the SIP invite message according to the pre-configured NAT mapping table, the method further includes:
judging whether the application layer IP address is consistent with the network layer IP address;
if not, performing address translation on the application layer IP address according to the NAT mapping table;
if yes, the application layer IP address is converted into the address after the network layer IP address is subjected to address conversion.
2. The method of claim 1, wherein the performing address translation on the application layer IP address of the SIP invite message according to the preconfigured NAT mapping table comprises:
searching a routing table item matched with the IP address of the application layer from a routing table;
if the address is not found, inquiring static NAT information matched with the application layer IP address from a pre-configured static NAT mapping table; wherein, each table entry in the static NAT mapping table records the corresponding relation between the private network IP address and the public network IP address;
and performing address translation on the application layer IP address according to the inquired static NAT information.
3. The method of claim 2, wherein if static NAT information matching the application layer IP address is not queried from a preconfigured static NAT mapping table, the method further comprises:
outputting a first reminding message; the first reminding message is used for reminding a user of configuring static NAT information aiming at the application layer IP address;
and performing address translation on the application layer IP address according to the static NAT information configured by the user.
4. The method of claim 2, wherein if a routing table entry matching the application layer IP address is found from a routing table, the method further comprises:
inquiring dynamic NAT information matched with an outgoing interface of the routing table item and the application IP from a pre-configured dynamic NAT mapping table; the dynamic NAT mapping table records the corresponding relation among the private network IP address, the public network IP address and the interface;
and performing address translation on the application layer IP address according to the inquired dynamic NAT information.
5. The method of claim 4, wherein if no dynamic NAT information matching both the outbound interface of the routing table entry and the application layer IP is queried from a preconfigured dynamic NAT mapping table, the method further comprises:
outputting a second reminding message; the second reminding message is used for reminding a user of configuring dynamic NAT information matched with the outgoing interface and the application layer IP;
and performing address translation on the application layer IP address according to the dynamic NAT information configured by the user.
6. A network address translation device is characterized in that the device comprises a judging module, a network layer address translation module and an application layer address translation module, wherein,
the judging module is used for judging whether the received message is a Session Initiation Protocol (SIP) invitation message;
the network layer address conversion module is used for carrying out address conversion on the network layer IP address of the SIP invitation message when the judging module judges that the received message is the SIP invitation message;
the application layer address translation module is used for translating the address of the application layer IP address of the SIP invitation message according to a pre-configured network address translation NAT mapping table;
the judging module is further configured to judge whether the application layer IP address is consistent with the network layer IP address before the application layer address translation module performs address translation on the application layer IP address of the SIP invite message according to a pre-configured network address translation NAT mapping table;
the application layer address translation module is specifically configured to perform address translation on the application layer IP address according to the NAT mapping table when the judgment module judges that the application layer IP address and the network layer IP address are inconsistent;
and when the judging module judges that the application layer IP address is consistent with the network layer IP address, converting the application layer IP address into an address obtained by converting the network layer IP address into an address after address conversion.
7. A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of any of the network address translation methods provided herein.
8. A network address translation device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of any of the network address translation methods provided herein when executing the program.
CN202010679579.4A 2020-07-15 2020-07-15 Network address translation method, device and equipment Active CN111835885B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010679579.4A CN111835885B (en) 2020-07-15 2020-07-15 Network address translation method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010679579.4A CN111835885B (en) 2020-07-15 2020-07-15 Network address translation method, device and equipment

Publications (2)

Publication Number Publication Date
CN111835885A CN111835885A (en) 2020-10-27
CN111835885B true CN111835885B (en) 2023-04-07

Family

ID=72924596

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010679579.4A Active CN111835885B (en) 2020-07-15 2020-07-15 Network address translation method, device and equipment

Country Status (1)

Country Link
CN (1) CN111835885B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101902506A (en) * 2010-06-21 2010-12-01 中兴通讯股份有限公司 SIP call-based traversal network address translation method and system
CN108156269A (en) * 2016-12-05 2018-06-12 财团法人资讯工业策进会 Network Address Translation Server And Network Address Translation Method Thereof
CN110062056A (en) * 2018-01-19 2019-07-26 中兴通讯股份有限公司 Method for network address translation and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8204065B2 (en) * 2006-09-29 2012-06-19 Avaya Ecs Ltd. Network address translation in session initiation protocol based application

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101902506A (en) * 2010-06-21 2010-12-01 中兴通讯股份有限公司 SIP call-based traversal network address translation method and system
CN108156269A (en) * 2016-12-05 2018-06-12 财团法人资讯工业策进会 Network Address Translation Server And Network Address Translation Method Thereof
CN110062056A (en) * 2018-01-19 2019-07-26 中兴通讯股份有限公司 Method for network address translation and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
SIP与NAT工作冲突模型;徐昊;《科技信息》;20101225(第36期);全文 *

Also Published As

Publication number Publication date
CN111835885A (en) 2020-10-27

Similar Documents

Publication Publication Date Title
US10033454B2 (en) Communication path control device, communication path control system, communication path control method and communication path control program
US8713313B2 (en) Terminal device, system and computer readable medium
JP2010212792A (en) Terminal device, and computer program
EP2472825B1 (en) Providing communications including an extended protocol header
CA2812174A1 (en) Uninterrupted transmission of internet protocol transmissions during endpoint changes
WO2015154520A1 (en) Call recording method, recording server, private branch exchange and recording system
JP2005039820A (en) Virtual connectivity with local connection translation
CN111835885B (en) Network address translation method, device and equipment
US7436814B2 (en) Selecting transport addresses to route streams between endpoints
JP2006067400A (en) Communication system, control method of communication system and control program for communication system
EP1763205A1 (en) Communication system, transfer control method, telephone device used for same, communication device, and program
US20090016520A1 (en) Apparatus, method, computer program product, and terminal device for controlling communications
CN110086727B (en) Load sharing method and device between CGN boards
JP4371874B2 (en) Call holding tone output method and SIP server
RU2014126331A (en) METHOD, DEVICE AND SYSTEM FOR RECORDING MULTIMEDIA DATA
US20080198851A1 (en) Information processing system including information processing apparatus and terminals, and information processing method for the same
US20180159823A1 (en) Network address translation server and network address translation method thereof
US20140293995A1 (en) Communication management system, communication management method, and computer program product
CN111885219B (en) Communication method and device based on SIP (Session initiation protocol) media negotiation and NAT (network Address translation) equipment
JP3980562B2 (en) SIP communication control device
JP2005033603A (en) Communication terminal and communication method
CN108989221B (en) SIP message transmission method and device, computer equipment and storage medium
CN102137090A (en) Method for logging in VOIP (Voice Over Internet Protocol) network and authentication server
JP4769882B2 (en) Media gateway control device and media gateway control method
JP2008022380A (en) Communication control unit, communication control method, and program for communication control

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