CN109040344A - A kind of NAT penetrating method, device, equipment and storage medium - Google Patents
A kind of NAT penetrating method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN109040344A CN109040344A CN201811102186.6A CN201811102186A CN109040344A CN 109040344 A CN109040344 A CN 109040344A CN 201811102186 A CN201811102186 A CN 201811102186A CN 109040344 A CN109040344 A CN 109040344A
- Authority
- CN
- China
- Prior art keywords
- port
- nat
- nat device
- mapped
- prediction
- 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.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/256—NAT traversal
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/256—NAT traversal
- H04L61/2575—NAT traversal using address mapping retrieval, e.g. simple traversal of user datagram protocol through session traversal utilities for NAT [STUN]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
This application discloses a kind of NAT penetrating method, device, equipment and media, including when receiving NAT and penetrating instruction, detect the port type of NAT device;If port type is host port, corresponding prediction port numbers are set according to the first preset rules;If fixed port, corresponding prediction port numbers are searched from corresponding gateway server according to the second preset rules;If symmetrical ports, terminate process;Then prediction port numbers corresponding with present port type are sent to gateway server, obtain the prediction port numbers so as to target outer net equipment and so that NAT device is realized that NAT is penetrated with target outer net equipment by the packet that burrows.Wherein, fixed port is the NAT device that the different outer net equipment of access use same map port numbers;Host port/symmetrical ports are in the different mappings port numbers used, in the presence/absence of the NAT device of mapped port number identical with host side slogan;Therefore, the application improves the penetrance of NAT device.
Description
Technical field
The present invention relates to field of computer technology, in particular to a kind of NAT penetrating method, device, equipment and computer can
Read storage medium.
Background technique
With the fast development of computer network and widely available, current Internet faces two large problems, i.e., available
The shortage of IP address and the continuous increase of routing table, this makes the access of numerous users encounter difficulties.It can be made using NAT technology
One all user within the organization accesses Internet by the legitimate ip address of limited quantity, to save on Internet
Legitimate ip address;On the other hand, by address conversion, the real IP address of intranet host can be hidden, to improve network
Safety.
But at the same time the host due to the real IP address for concealing intranet host, in heterogeneous networks
Equipment needs to carry out NAT before being communicated and penetrates.NAT penetrate substantially be predicting NAT equipment mapped port number, it is different
The NAT device of type has different mapped port rules.In the prior art, only when the same NAT device access it is different
When outer net equipment uses identical mapped port, current can be used can be found from corresponding gateway server
Mapped port number, and different outer net equipment is accessed when the same NAT device, if the mapping end of corresponding different outer net equipment
When slogan is different, then it represents that the NAT device cannot find mapped port number from gateway server, that is to say, that the NAT
Equipment can not achieve NAT and penetrate.It so, is all using difference since most of NAT device access different outer net equipment
Mapped port number, therefore a large amount of NAT device will be had be unable to complete and penetrate, so that the low efficiency of network communication
Under.
Therefore, the penetrance for how improving NAT device is a technical problem that technical personnel in the field need to solve at present.
Summary of the invention
In view of this, can be improved the penetrance of NAT device the purpose of the present invention is to provide a kind of NAT penetrating method;
It is a further object of the present invention to provide a kind of NAT penetrating device, equipment and computer readable storage mediums, all have above-mentioned beneficial
Effect.
In order to solve the above technical problems, the present invention provides a kind of NAT penetrating method, comprising:
When receiving NAT and penetrating instruction, the port type of NAT device is detected;
It is that NAT device setting is corresponding pre- according to the first preset rules if the port type is host port
Survey port numbers;Wherein, the host port characterizes when the NAT device accesses different outer net equipment using different mapped ports
Number, and there is mapped port number identical with host side slogan in the different mapped port number;
If the port type be fixed port, is searched from corresponding gateway server according to the second preset rules and
The corresponding prediction port numbers of the NAT device;Wherein, the fixed port characterizes the NAT device and accesses different outer net equipment
When use identical mapped port number;
If the port type is symmetrical ports, terminate process;Wherein, the symmetrical ports characterize the NAT device
Using different mapped ports number when accessing different outer net equipment, and it is not present and the master in the different mapped port number
The identical mapped port number of generator terminal slogan;
Prediction port numbers corresponding with present port type are sent to the gateway server, so that target outer net equipment obtains
It takes the corresponding prediction port numbers and so that the NAT device is realized that NAT is penetrated with the target outer net equipment by the packet that burrows.
Preferably, described when receiving NAT and penetrating instruction, the port type for detecting NAT device specifically includes:
When receiving the NAT and penetrating instruction, type detection packet is sent to the first gateway server;
Judge whether the host side slogan is identical as mapped port No. the first;
If they are the same, then the port type for determining the NAT device is the host port;
If it is different, the type detection packet is then sent to the second gateway server;
Judge whether mapped port No. the second is identical as the mapped port No. first;
If they are the same, then determine that the port type is the fixed port;
If it is different, then determining that the port type is the symmetrical ports.
It preferably, is that the NAT device is set according to the first preset rules if the port type is host port
Corresponding prediction port numbers are set to specifically include:
If the port type be host port, judge it is upper one predict port numbers whether with the host side slogan phase
Together;
If so, setting any in addition to the host side slogan for the current prediction port numbers of the NAT device
Mapped port number;
If it is not, then setting mapping identical with the host side slogan for the current prediction port numbers of the NAT device
Port numbers.
Preferably, the prediction port numbers are sent to the gateway server described, so as to the acquisition of target outer net equipment
Prediction port numbers and after making the NAT device and the target outer net equipment realize that NAT is penetrated by the packet that burrows, into one
Step includes:
Connection test bag is sent to the target outer net equipment.
Preferably, the type detection packet is specially UDP packet.
Preferably, after for the NAT device, the prediction port numbers are set, further comprise:
Record the corresponding relationship of the host side slogan and each prediction port numbers.
Preferably, after detecting that the port type is the symmetrical ports, further comprise:
Issue prompt information.
In order to solve the above technical problems, the present invention also provides a kind of NAT penetrating devices, comprising:
Detection module, for detecting the port type of NAT device when receiving NAT and penetrating instruction;
First setup module is the NAT according to the first preset rules if being host port for the port type
Corresponding prediction port numbers are arranged in equipment;Wherein, the host port characterizes when the NAT device accesses different outer net equipment and makes
With different mapped ports number, and there is mapped port number identical with host side slogan in the different mapped port number;
Second setup module, if being fixed port for the port type, according to the second preset rules from corresponding
Prediction port numbers corresponding with the NAT device are searched in gateway server;Wherein, the fixed port characterizes the NAT and sets
Identical mapped port number is used when the different outer net equipment of standby access;
Third setup module terminates process if being symmetrical ports for the port type;Wherein, the symmetrical end
Oral thermometer is levied when the NAT device accesses different outer net equipment using different mapped ports number, and the different mapped port
Mapped port number identical with the host side slogan is not present in number;
Burrow module, for sending prediction port numbers corresponding with present port type to the gateway server, so as to
Target outer net equipment obtains the corresponding prediction port numbers and sets the NAT device with the target outer net by the packet that burrows
It is standby to realize that NAT is penetrated.
In order to solve the above technical problems, the present invention also provides a kind of NAT to penetrate equipment, comprising:
Memory, for storing computer program;
Processor, the step of any of the above-described kind of NAT penetrating method is realized when for executing the computer program.
In order to solve the above technical problems, the present invention also provides a kind of computer readable storage medium, it is described computer-readable
Computer program is stored on storage medium, the computer program realizes that any of the above-described kind of NAT is penetrated when being executed by processor
The step of method.
A kind of NAT penetrating method provided by the invention, compared to the prior art in, when the same NAT device access it is different
Outer net equipment, if the mapped port number of corresponding different outer net equipment is different, which can not achieve NAT
The case where penetrating, this programme are when the same NAT device accesses different outer net equipment, if corresponding different outer net equipment is reflected
It penetrates that port numbers are different, but exists in different mapped port number identical with the host side slogan of the NAT device
Mapped port number is then that corresponding prediction port numbers are arranged in the NAT device according to the first preset rules.As it can be seen that this programme increases
NAT device gets a possibility that prediction port numbers, so as to be able to carry out the probability penetrated higher for NAT device, therefore improves
The penetrance of NAT device.
In order to solve the above technical problems, the present invention also provides a kind of NAT penetrating device, equipment and computer-readable storages
Medium all has above-mentioned beneficial effect.
Detailed description of the invention
It in order to illustrate the embodiments of the present invention more clearly or the technical solution of the prior art, below will be to embodiment or existing
Attached drawing needed in technical description is briefly described, it should be apparent that, the accompanying drawings in the following description is only this hair
Bright some embodiments for those of ordinary skill in the art without creative efforts, can be with root
Other attached drawings are obtained according to the attached drawing of offer.
Fig. 1 is a kind of flow chart of NAT penetrating method provided in an embodiment of the present invention;
Fig. 2 is that S10 detects NAT device when receiving NAT and penetrating instruction in a kind of NAT penetrating method shown in FIG. 1
The specific flow chart of port type;
Fig. 3 is a kind of structure chart of NAT penetrating device provided in an embodiment of the present invention;
Fig. 4 is the structure chart that a kind of NAT provided in an embodiment of the present invention penetrates equipment.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
The core of the embodiment of the present invention is to provide a kind of NAT penetrating method, can be improved the penetrance of NAT device;This hair
Bright another core is to provide a kind of NAT penetrating device, equipment and computer readable storage medium, all has above-mentioned beneficial to effect
Fruit.
It is right with reference to the accompanying drawings and detailed description in order to make those skilled in the art more fully understand the present invention program
The present invention is described in further detail.
Fig. 1 is a kind of flow chart of NAT penetrating method provided in an embodiment of the present invention.As shown in Figure 1, a kind of NAT is penetrated
Method includes:
S10: when receiving NAT and penetrating instruction, the port type of NAT device is detected.
Specifically, NAT, which is penetrated, refers to that triggering NAT device carries out the operational order that NAT is penetrated, the present embodiment pair
NAT penetrates the particular content of instruction without limitation.It is understood that NAT is penetrated namely network address translation or network address
Translation, the essence that NAT is penetrated are the mapped ports number of predicting NAT equipment, and mapped port is arranged in the NAT device of different port type
Number rule it is different.Therefore in the present embodiment, instruction is penetrated by receiving NAT, with the port class of detection trigger NAT device
Type.Specifically, specified operation content is executed generally by control NAT device, to detect the port class of NAT device itself
Type, the present embodiment to detection NAT device port type concrete mode without limitation.
S20: being that corresponding prediction end is arranged in NAT device according to the first preset rules if port type is host port
Slogan;Wherein, using different mapped ports number when host port characterization NAT device accesses different outer net equipment, and it is different
There is mapped port number identical with host side slogan in mapped port number.
Specifically, if it is detected that the port type of NAT device is that host port namely NAT device access different outer nets and set
Using different mapped ports number when standby, and there is mapped port identical with host side slogan in different mapped ports number
Number, then it is that corresponding default port numbers are arranged in NAT device according to the first preset rules.It should be noted that the first preset rules
It can be and select any one mapped port number as current prediction port numbers from the set of mapped port number, be also possible to
From the set of mapped port number, select any one mapped port number in addition to host side slogan as prediction port numbers,
The present embodiment to the first preset rules without limitation.
S30: if port type be fixed port, is searched from corresponding gateway server according to the second preset rules and
The corresponding prediction port numbers of NAT device;Wherein, using identical when fixed port characterization NAT device accesses different outer net equipment
Mapped port number.
Specifically, if it is detected that the port type of NAT device is that fixed port namely NAT device access different outer nets and set
Identical mapped port number is used when standby.It in the case, then can be corresponding with the NAT device according to the second preset rules
Mapped port number corresponding with the NAT device is searched in gateway server.That is, being previously stored in gateway server
The host side slogan of NAT device and each mapped port number then take from gateway when the port type of NAT device is fixed port
Prediction port numbers of the corresponding mapped port number as the NAT device are searched in business device.
S40: if port type is symmetrical ports, terminate process;Wherein, the access of symmetrical ports characterization NAT device is different
Using different mapped ports number when outer net equipment, and reflected in different mapped ports number there is no identical with host side slogan
Penetrate port numbers.
Specifically, if it is detected that the port type of NAT device is that symmetrical ports namely NAT device access different outer nets and set
Using different mapped ports number when standby, and mapped port identical with host side slogan is not present in different mapped ports number
Number, that is to say, that the mapped port number of NAT device and host side slogan are different, in this case, then can not obtain
The prediction port numbers of NAT device namely the NAT device not can be carried out NAT and penetrate operation, therefore, terminate process.
S50: prediction port numbers corresponding with present port type are sent to gateway server, so that target outer net equipment obtains
It takes prediction port numbers and so that NAT device is realized that NAT is penetrated with target outer net equipment by the packet that burrows.
After for NAT device, prediction port numbers corresponding with present port type are set, namely in two different nets
NAT device in network gets respective prediction port numbers respectively, and respective prediction port numbers are then sent to gateway respectively
Server, and by gateway server transfer, informs the prediction port numbers of other side oneself, in order to two NAT device respectively to
Other side sends the packet that burrows, to realize that NAT is penetrated.
It should be noted that the NAT device test statistics through 60,000 fiber optic networks, the NAT device of the prior art are worn
Saturating rate is 30% or so, and NAT penetrating method provided by the present embodiment, and the penetrance of NAT device may make to reach 96%.
NAT penetrating method provided in this embodiment, comprising: when receiving NAT and penetrating instruction, detect the end of NAT device
Mouth type;It is that corresponding prediction port numbers are arranged in NAT device according to the first preset rules if port type is host port;
Wherein, using different mapped ports number when host port characterization NAT device accesses different outer net equipment, and different mapping ends
There is mapped port number identical with host side slogan in slogan;If port type is fixed port, according to the second default rule
Prediction port numbers corresponding with NAT device are then searched from corresponding gateway server;Wherein, fixed port characterizes NAT device
Identical mapped port number is used when accessing different outer net equipment;If port type is symmetrical ports, terminate process;Wherein,
Using different mapped ports number when symmetrical ports characterization NAT device accesses different outer net equipment, and different mapped ports number
In be not present mapped port number identical with host side slogan;Prediction port numbers are sent to gateway server, are then taken to gateway
Business device sends port numbers corresponding with present port type, so that target outer net equipment obtains corresponding prediction port numbers and passes through
The packet that burrows makes NAT device realize that NAT is penetrated with target outer net equipment.
In compared to the prior art, when the same NAT device accesses different outer net equipment, if corresponding different outer net is set
When standby mapped port number is different, then the NAT device can not achieve the case where NAT is penetrated, and this programme is as the same NAT
Equipment accesses different outer net equipment, if the mapped port number of corresponding different outer net equipment is different, but it is different
Mapped port number in exist mapped port number identical with the host side slogan of the NAT device, then according to the first preset rules
For the NAT device, corresponding prediction port numbers are set.As it can be seen that this programme increase NAT device get prediction port numbers can
Energy property, so that NAT device is able to carry out, the probability penetrated is higher, therefore improves the penetrance of NAT device.
Fig. 2 is that S10 detects NAT device when receiving NAT and penetrating instruction in a kind of NAT penetrating method shown in FIG. 1
The specific flow chart of port type.Referring to FIG. 2, the process specifically includes:
S101: when receiving NAT and penetrating instruction, type detection packet is sent to the first gateway server;
S102: judge whether host side slogan is identical as mapped port No. the first;
S103: if they are the same, then determine the port type of NAT device for host port;
S104: if it is different, type detection packet is then sent to the second gateway server;
S105: judge whether mapped port No. the second is identical as mapped port No. the first;
S106: if they are the same, then determine port type for fixed port;
S107: if it is different, then determining port type for symmetrical ports.
Specifically, type detection packet is sent to the first gateway server first when receiving NAT and penetrating instruction, with
Mapped port No. the first is obtained, and judges whether host side slogan is identical as mapped port No. the first, if they are the same, then it represents that should
NAT device is host port;If it is different, then needing further to judge that the host port is fixed port or symmetrical ports, specifically
Method are as follows: type detection packet is sent to the second gateway server, and judge mapped port No. the second whether with first mapping end
Slogan is identical, namely when judging to send the second gateway server for type detection packet, whether the mapped port number of NAT device is sent out
It is raw to change, if no change has taken place, then it represents that the NAT device accesses used mapped port phase when different outer net equipment
Together, then determine the NAT device for fixed port;If changing, then it represents that the NAT device accesses different outer net equipment when institutes
The mapped port number used is different, then determines the NAT device for symmetrical ports.
It is understood that gateway server refers to realizing the server of network interconnection, therefore type detection packet is divided
It is not sent to the first gateway server and the second gateway server namely indicates type detection packet being sent to different outer net equipment,
To obtain corresponding mapped port number namely mapped port No. the first and mapped port No. the second respectively.
As preferred embodiment, in the present embodiment, type detection packet is specially UDP packet.Since UDP packet is not belonging to
Connecting-type agreement, thus have resource consumption small, the fast advantage of processing speed, even and if even during using UDP packet
You lose one or two of data packet, will not have much impact to reception result, so using UDP packet as class in the present embodiment
Type detection packet.
As it can be seen that in the present embodiment, by the way that type detection packet is respectively sent to the first gateway server and the second gateway
The mode of server determines the port type of NAT device, and judgment mode is simple, and judging result is accurate.
On the basis of the above embodiments, the present embodiment has made further instruction and optimization to technical solution, specifically,
It is that the corresponding prediction port numbers of NAT device setting specifically include according to the first preset rules if port type is host port:
If port type is host port, judge whether upper prediction port numbers are identical as host side slogan;
If so, setting any mapped port in addition to host side slogan for the current prediction port numbers of NAT device
Number;
If it is not, then setting mapped port number identical with host side slogan for the current prediction port numbers of NAT device.
Specifically, in the present embodiment, when the port type for judging NAT device is host port, then further sentencing
Whether disconnected upper prediction port numbers are identical as host side slogan;Namely judge currently mapped port number identical with host side slogan
It is whether occupied, if so, any being reflected what the current prediction port numbers of NAT device were set as in addition to host side slogan
Penetrate port numbers;If it is not, then setting mapped port number identical with host side slogan for the current prediction port numbers of NAT device.
Namely in the case that identical with host side slogan mapped port number is unoccupied, preferentially the prediction port numbers of NAT device are set
It is set to mapped port number identical with the host side slogan of NAT device;If mapped port number identical with host side slogan is
It is occupied, then set the prediction port numbers of NAT device to any mapped port number in addition to host side slogan.
For example, it is assumed that current host side slogan is 4000, the prediction port numbers when accessing outer net equipment A are 4000,
Then when accessing another outer net equipment B, other port numbers in addition to 4000 are set by prediction port numbers, such as 5000.Due to
It predicts that port numbers are from 1 to 65535 totally 65535 port numbers, therefore in random selection, uses identical prediction end
The probability of slogan is very little, therefore can be realized NAT and penetrate.
As preferred embodiment, prediction port numbers are being sent to gateway server, so as to the acquisition of target outer net equipment
After predicting port numbers and so that NAT device and target outer net equipment is realized that NAT is penetrated by the packet that burrows, further comprise:
Connection test bag is sent to target outer net equipment.
That is, after NAT device burrows packet to the transmission of target outer net equipment, in order to ensure the reliable of data transmission
Property, before transmission services data packet, further detected by way of sending connection test bag to target outer net equipment current
Penetrate whether process succeeds.It should be noted that since the transmission process of business data packet is two-way, general connection
NAT device sends respectively to other side with target outer net equipment and is connected to test bag.
As it can be seen that in the present embodiment, by sending connection test bag to target outer net equipment, further ensureing and passing through this reality
The mode for applying example carries out the reliability that NAT is penetrated.
Further comprise after for NAT device, prediction port numbers are set as preferred embodiment:
Record the corresponding relationship of host side slogan and each prediction port numbers.
That is, by host side slogan and being NAT device setting after prediction port numbers are arranged for NAT device
Each prediction mapped port number is recorded.It should be noted that the mode of record can be by way of log is written, it can also
To be by the record storage to database, the present embodiment is not limited this.But it is the need to ensure that host side slogan and sets every time
The prediction port numbers set are correspondingly arranged, in order to the subsequent corresponding relationship checked host side slogan and predict port numbers.
In the present embodiment, the information that can also further record corresponding outer net equipment, is equally checked convenient for the later period, when
So, other information can also be recorded according to actual needs, and the present embodiment does not limit this.
Further comprise after detecting that port type is symmetrical ports as preferred embodiment:
Issue prompt information.
It is penetrated since symmetrical ports cannot achieve, it, can when the port type for detecting NAT device is symmetrical ports
The case where current NAT device of operator is prompted in a manner of by issuing prompt information, so that operator knows that the NAT is set in time
Standby cannot achieve penetrates.
It is understood that the mode for issuing prompt information is varied, can be by showing corresponding text or figure
As the mode of information is prompted, it is also possible to be prompted by way of suggestion device such as buzzer or indicator light, this reality
Apply example to issue prompt information concrete mode and prompt information particular content without limitation, as long as can be to detection
Exit port type is that symmetrical ports are prompted, and is the protection scheme of the present embodiment.
A kind of embodiment of NAT penetrating method provided by the invention is described in detail above, the present invention is also
Provide a kind of NAT penetrating device corresponding with this method, equipment and computer readable storage medium, due to device, equipment and
The embodiment of computer readable storage medium part and the embodiment of method part mutually correlate, therefore device, equipment and calculating
The embodiment of machine readable storage medium storing program for executing part refers to the description of the embodiment of method part, wouldn't repeat here.
Fig. 3 is a kind of structure chart of NAT penetrating device provided in an embodiment of the present invention, as shown in figure 3, a kind of NAT is penetrated
Device includes:
Detection module 31, for detecting the port type of NAT device when receiving NAT and penetrating instruction;
First setup module 32 is set if being host port for port type according to the first preset rules for NAT device
Set corresponding prediction port numbers;Wherein, using different mapping ends when host port characterization NAT device accesses different outer net equipment
Slogan, and there is mapped port number identical with host side slogan in different mapped ports number;
Second setup module 33, if being fixed port for port type, according to the second preset rules from corresponding net
It closes and searches prediction port numbers corresponding with NAT device in server;Wherein, fixed port characterization NAT device accesses different outer nets
Identical mapped port number is used when equipment;
Third setup module 34 terminates process if being symmetrical ports for port type;Wherein, symmetrical ports characterize
Using different mapped ports number when NAT device accesses different outer net equipment, and it is not present and master in different mapped ports number
The identical mapped port number of generator terminal slogan;
The module that burrows 35, for sending prediction port numbers corresponding with present port type to gateway server, so as to mesh
Mark outer net equipment obtains corresponding prediction port numbers and so that NAT device is realized that NAT is penetrated with target outer net equipment by the packet that burrows.
NAT penetrating device provided in an embodiment of the present invention, the beneficial effect with above-mentioned NAT penetrating method.
Fig. 4 is the structure chart that a kind of NAT provided in an embodiment of the present invention penetrates equipment, as shown in figure 4, a kind of NAT is penetrated
Equipment includes:
Memory 41, for storing computer program;
Processor 42 is realized when for executing computer program such as the step of above-mentioned NAT penetrating method.
NAT provided in an embodiment of the present invention penetrates equipment, the beneficial effect with above-mentioned NAT penetrating method.
In order to solve the above technical problems, the present invention also provides a kind of computer readable storage medium, computer-readable storage
It is stored with computer program on medium, realizes when computer program is executed by processor such as the step of above-mentioned NAT penetrating method.
Computer readable storage medium provided in an embodiment of the present invention, the beneficial effect with above-mentioned NAT penetrating method.
NAT penetrating method, device, equipment and computer readable storage medium provided by the present invention have been carried out in detail above
It is thin to introduce.Principle and implementation of the present invention are described for specific embodiment used herein, above embodiments
Illustrate to be merely used to help understand method and its core concept of the invention.It should be pointed out that for the common skill of the art
, without departing from the principle of the present invention, can be with several improvements and modifications are made to the present invention for art personnel, these change
It is also fallen within the protection scope of the claims of the present invention into modification.
Each embodiment is described in a progressive manner in specification, the highlights of each of the examples are with other realities
The difference of example is applied, the same or similar parts in each embodiment may refer to each other.For device disclosed in embodiment
Speech, since it is corresponded to the methods disclosed in the examples, so being described relatively simple, related place is referring to method part illustration
?.
Professional further appreciates that, unit described in conjunction with the examples disclosed in the embodiments of the present disclosure
And algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and
The interchangeability of software generally describes each exemplary composition and step according to function in the above description.These
Function is implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Profession
Technical staff can use different methods to achieve the described function each specific application, but this realization is not answered
Think beyond the scope of this invention.
Claims (10)
1. a kind of NAT penetrating method characterized by comprising
When receiving NAT and penetrating instruction, the port type of NAT device is detected;
It is that corresponding prediction end is arranged in the NAT device according to the first preset rules if the port type is host port
Slogan;Wherein, the host port characterizes when the NAT device accesses different outer net equipment using different mapped ports number,
And there is mapped port number identical with host side slogan in the different mapped port number;
If the port type be fixed port, searched from corresponding gateway server according to the second preset rules with it is described
The corresponding prediction port numbers of NAT device;Wherein, the fixed port characterizes when the NAT device accesses different outer net equipment and makes
With identical mapped port number;
If the port type is symmetrical ports, terminate process;Wherein, the symmetrical ports characterize the NAT device access
Using different mapped ports number when different outer net equipment, and it is not present and the host side in the different mapped port number
The identical mapped port number of slogan;
Prediction port numbers corresponding with present port type are sent to the gateway server, so that target outer net equipment obtains institute
It states corresponding prediction port numbers and so that the NAT device is realized that NAT is penetrated with the target outer net equipment by the packet that burrows.
2. detection NAT is set the method according to claim 1, wherein described when receiving NAT and penetrating instruction
Standby port type specifically includes:
When receiving the NAT and penetrating instruction, type detection packet is sent to the first gateway server;
Judge whether the host side slogan is identical as mapped port No. the first;
If they are the same, then the port type for determining the NAT device is the host port;
If it is different, the type detection packet is then sent to the second gateway server;
Judge whether mapped port No. the second is identical as the mapped port No. first;
If they are the same, then determine that the port type is the fixed port;
If it is different, then determining that the port type is the symmetrical ports.
If 3. according to the method described in claim 2, it is characterized in that, the port type be host port, according to
First preset rules are that the corresponding prediction port numbers of NAT device setting specifically include:
If the port type is host port, judge whether upper prediction port numbers are identical as the host side slogan;
If so, setting any mapping in addition to the host side slogan for the current prediction port numbers of the NAT device
Port numbers;
If it is not, then setting mapped port identical with the host side slogan for the current prediction port numbers of the NAT device
Number.
4. the method according to claim 1, wherein sending the prediction end to the gateway server described
Slogan obtains the prediction port numbers so as to target outer net equipment and is made outside the NAT device and the target by the packet that burrows
After net equipment realizes that NAT is penetrated, further comprise:
Connection test bag is sent to the target outer net equipment.
5. according to the method described in claim 2, it is characterized in that, the type detection packet is specially UDP packet.
6. method according to any one of claims 1 to 5, which is characterized in that the prediction is being arranged for the NAT device
After port numbers, further comprise:
Record the corresponding relationship of the host side slogan and each prediction port numbers.
7. according to the method described in claim 6, it is characterized in that, detect the port type be the symmetrical ports it
Afterwards, further comprise:
Issue prompt information.
8. a kind of NAT penetrating device characterized by comprising
Detection module, for detecting the port type of NAT device when receiving NAT and penetrating instruction;
First setup module is the NAT device according to the first preset rules if being host port for the port type
Corresponding prediction port numbers are set;Wherein, the host port characterizes when the NAT device accesses different outer net equipment using not
Same mapped port number, and there is mapped port number identical with host side slogan in the different mapped port number;
Second setup module, if being fixed port for the port type, according to the second preset rules from corresponding gateway
Prediction port numbers corresponding with the NAT device are searched in server;Wherein, the fixed port characterizes the NAT device and visits
Identical mapped port number is used when asking different outer net equipment;
Third setup module terminates process if being symmetrical ports for the port type;Wherein, the symmetrical ports table
It levies when the NAT device accesses different outer net equipment using different mapped ports number, and in the different mapped port number
There is no mapped ports number identical with the host side slogan;
Burrow module, for sending prediction port numbers corresponding with present port type to the gateway server, so as to target
Outer net equipment obtains the corresponding prediction port numbers and keeps the NAT device and the target outer net equipment real by the packet that burrows
Existing NAT is penetrated.
9. a kind of NAT penetrates equipment characterized by comprising
Memory, for storing computer program;
Processor realizes NAT penetrating method as described in any one of claim 1 to 7 when for executing the computer program
The step of.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium
Program, the computer program realize NAT penetrating method as described in any one of claim 1 to 7 when being executed by processor
Step.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811102186.6A CN109040344A (en) | 2018-09-20 | 2018-09-20 | A kind of NAT penetrating method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811102186.6A CN109040344A (en) | 2018-09-20 | 2018-09-20 | A kind of NAT penetrating method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109040344A true CN109040344A (en) | 2018-12-18 |
Family
ID=64617642
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811102186.6A Pending CN109040344A (en) | 2018-09-20 | 2018-09-20 | A kind of NAT penetrating method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109040344A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112437168A (en) * | 2020-11-13 | 2021-03-02 | 广州朗国电子科技有限公司 | Intranet penetrating system |
CN113489810A (en) * | 2021-05-31 | 2021-10-08 | 普联国际有限公司 | Symmetric NAT penetration method, device, storage medium, equipment and system |
CN115499411A (en) * | 2022-09-21 | 2022-12-20 | 北京百度网讯科技有限公司 | Network penetration system, method and device and electronic equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100220721A1 (en) * | 2005-03-22 | 2010-09-02 | Logitech Europe S.A. | Method and Apparatus for Packet traversal of A Network Address Translation Device |
CN104994184A (en) * | 2015-06-25 | 2015-10-21 | 北京广密华安科技有限公司 | NAT traversal method and device |
CN105141711A (en) * | 2015-08-24 | 2015-12-09 | 北京息通网络技术有限公司 | Symmetrical NAT traversal method and system based on big data analysis |
US20170295136A1 (en) * | 2016-04-11 | 2017-10-12 | Western Digital Technologies, Inc. | Establishing connections between data storage devices |
-
2018
- 2018-09-20 CN CN201811102186.6A patent/CN109040344A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100220721A1 (en) * | 2005-03-22 | 2010-09-02 | Logitech Europe S.A. | Method and Apparatus for Packet traversal of A Network Address Translation Device |
CN104994184A (en) * | 2015-06-25 | 2015-10-21 | 北京广密华安科技有限公司 | NAT traversal method and device |
CN105141711A (en) * | 2015-08-24 | 2015-12-09 | 北京息通网络技术有限公司 | Symmetrical NAT traversal method and system based on big data analysis |
US20170295136A1 (en) * | 2016-04-11 | 2017-10-12 | Western Digital Technologies, Inc. | Establishing connections between data storage devices |
Non-Patent Citations (1)
Title |
---|
曹申会: ""NAT穿越技术研究与实现"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112437168A (en) * | 2020-11-13 | 2021-03-02 | 广州朗国电子科技有限公司 | Intranet penetrating system |
CN112437168B (en) * | 2020-11-13 | 2023-09-01 | 广州朗国电子科技股份有限公司 | Intranet penetration system |
CN113489810A (en) * | 2021-05-31 | 2021-10-08 | 普联国际有限公司 | Symmetric NAT penetration method, device, storage medium, equipment and system |
CN113489810B (en) * | 2021-05-31 | 2023-03-24 | 普联国际有限公司 | Symmetric NAT penetration method, device, storage medium, equipment and system |
CN115499411A (en) * | 2022-09-21 | 2022-12-20 | 北京百度网讯科技有限公司 | Network penetration system, method and device and electronic equipment |
CN115499411B (en) * | 2022-09-21 | 2023-07-21 | 北京百度网讯科技有限公司 | Network penetration system, method and device and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109040344A (en) | A kind of NAT penetrating method, device, equipment and storage medium | |
CN105163316B (en) | Access the method and device of Wi-Fi Hotspot | |
CN107015892A (en) | A kind of method for testing pressure, device and system | |
CN108183975A (en) | A kind of method and system of domain name mapping | |
CN108259425A (en) | The determining method, apparatus and server of query-attack | |
CN102055813A (en) | Access controlling method for network application and device thereof | |
CN104869155B (en) | Data Audit method and device | |
CN109218316A (en) | A kind of NAT penetrating method, device, equipment and storage medium | |
CN107888605A (en) | A kind of Internet of Things cloud platform traffic security analysis method and system | |
CN107786440A (en) | A kind of method and device of data message forwarding | |
CN105227692B (en) | A kind of NAT through method and gateway | |
CN107342913A (en) | The detection method and device of a kind of CDN node | |
CN109639796A (en) | A kind of implementation of load balancing, device, equipment and readable storage medium storing program for executing | |
CN108737206A (en) | Route selecting method, device and its computer equipment of network channel | |
CN110224897A (en) | Vulnerable network test method, device, mobile device and the storage medium of application program | |
CN107171889A (en) | Network application interface test method and device and electronic equipment | |
CN110011955A (en) | A kind of SSRF loophole or attack determination, processing method, device, equipment and medium | |
CN106953741A (en) | A kind of traffic playback method and system of network-oriented simulated environment | |
Liljenstam et al. | Development of an Internet backbone topology for large-scale network simulations | |
CN107193634A (en) | The access method and device of a kind of virtual machine | |
CN107798239A (en) | Operational risk processing method, device, computer equipment and storage medium | |
CN111106983A (en) | Method and device for detecting network connectivity | |
CN105812324B (en) | The method, apparatus and system of IDC information security management | |
CN109462527A (en) | Network congestion analysis method, device and storage medium | |
CN105721190B (en) | Fault detection method, device and the server of data transfer path |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181218 |
|
RJ01 | Rejection of invention patent application after publication |