Summary of the invention
The object of the present invention is to provide the implementation method of domain name system in a kind of mobile ad-hoc network.
The invention belongs to mobile ad-hoc network MANET (Mobile Ad Hoc Networks) field, proposed the new distribution type domain name system DMDNS (Distributed MANET Domain Name System) of a kind of MANET of being applicable to.DMDNS adopts and to declare in good time/to upgrade in time, information incidentally/the novel mechanism that domain name buffer memory, cache hit/validation of information, broadcast request/clean culture are replied reduces the number of broadcast times of domain name request, alleviate the extra load of bringing owing to Web broadcast, guaranteed the correctness of domain-name information simultaneously.Under the situation of IP address static configuration, DMDNS has reduced the domain-name information response time, and application program can in time be communicated.
DMDNS is a kind of distributed domain name system, and it can finish the conversion that domain name arrives IP address (IPv4 or IPv6) among the MANET.Implementation method is as follows:
DMDNS is made up of domain name service module and domain name mapping module, all nodes in the MANET all move this two modules simultaneously, the domain name mapping module starts the domain name mapping process and the domain name response message of receiving is handled, the domain name service module is monitored the arrival of domain name request, and the domain name request message of receiving is handled.
Required node domain name, life cycle, the IP address of domain name service module obtained in the following manner: (the requiring the domain name in the same MANET territory not repeat) of user's appointment or the domain name that produces by automatic generting machanism and be kept at life cycle in the domain name configuration file, and the domain name service module is obtained domain name and lifetime information from this configuration file; The IP address of network interface card is specified (static configuration) by hand or is produced (dynamic-configuration) by the automatic generting machanism in address by the user, and the domain name service module reads the current IP address of network interface card from the address information file of system.After being configured domain name and IP address, node just can provide domain name service to other node.
The node of operation DMDNS is being safeguarded a domain-name information tabulation (DN_REC_LIST), be also referred to as the domain name buffer memory, this list records the domain-name information known to this node, it comprises following several field: sequence number (sequence number), domain name (NAME), classification (CLASS), type (TYPE), IP address, life cycle (TTL), more new logo (RF:Refresh Flag), timer life cycle (TTL_Timer), reply waiting timer (Reply_wait_Timer).Sequence number is one 32 a signless integer, is used for identifying the order of the domain-name information that same node produces, and is used for other node and upgrades the own domain-name information of being preserved; Sequence number is generated by node oneself and safeguard that a part that is used as domain-name information is transmitted in network.Whether more the length of new logo is 1, be used to identify this domain-name information and be updated; More new logo only is present in the domain name buffer memory, and it does not belong to the domain-name information that transmits in the network; Life cycle, timer was used for carrying out timing to TTL is overtime; Replying waiting timer is used for domain-name information response message wait timeout is carried out timing.Other several fields are consistent with the field meaning of traditional DNS definition.Document [3] P.Mockapetris, " DOMAIN NAMES-IMPLEMENTATION AND SPECIFICATION ", RFC1035, November 1987.Domain-name information request among the DMDNS/response message form uses the form of RFC1035 definition, preceding 4 sequence numbers that byte is used for preserving domain-name information of RDATA item among the RR (Resource Record).
The working mechanism of DMDNS:
The maintenance of DN_REC_LIST
DN_REC_LIST will upgrade as follows:
When (1) DMDNS started, the domain-name information of node oneself was added into DN_REC_LIST.
(2) (when using the address to dispose automatically, the IP address of node is dynamic change) during the IP address modification of node, the record of preserving the domain-name information of node oneself among the DN_REC_LIST is updated.
When the domain name in the domain-name information of (3) receiving did not exist in DN_REC_LIST, this information was used as new record and adds DN_REC_LIST.
(4) domain-name information R1 that receives and the record of certain among DN_REC_LIST R2 compare:
If (the R1. domain name==the R2. domain name)
If (R1. sequence number>R2. sequence number)
R2 is updated to record R1;
Else if ((the R1. sequence number==R2. sequence number) ﹠amp; ﹠amp; (R1.IP_P==R2.IP_P))
//IP_P={ classification, type, IP address }
If (R1. life cycle>R2. life cycle)
R2. is updated to R1. life cycle life cycle;
The timeout value of R2.TTL_Timer is updated to R1.TTL.
}
}
}
(5) timer TTL_Timer life cycle of record R is overtime among the DN_REC_LIST: if R is the domain-name information of node oneself, R.RF is changed to " not upgrading " state, otherwise R is deleted.
The domain-name information declaration
The MANET node is when meeting the following conditions, the domain-name information record RS of oneself is added DN_REC_LIST, RS.RF is changed to " upgrading " state, and starts timer RS.TTL_Timer (initial timeout value is RS.TTL), and the domain-name information of oneself is broadcasted away.The form of domain-name information declaration bag is identical with domain-name information response packet (DN_REP), and just the destination address of IP head is a broadcast address.Broadcast conditional:
When (1) node starts DMDNS; Or
(2) during the IP address modification of node; Or
(3) node is received the domain-name information request (DN_REQ) that is broadcast to oneself, and the RF sign of this node domain-name information record RS is in " not upgrading " state among the DN_REC_LIST.
The generation of domain-name information request (DN_REQ)
When the domain name mapping module is received the domain name mapping request that application program sends, generate the domain-name information request message, and the value of putting request counter (Req_Counter) is 0 according to the mode of traditional DNS.
The transmission of DN_REQ
(1) value with Req_Counter adds 1, and the domain-name information of node oneself is added among the DN_REQ;
(2) in the own DN_REC_LIST that is safeguarded, search the domain name D_name that is asked,
If have corresponding domain-name information record R, be changed to " not upgrading " state just to R.ip clean culture DN_REQ, and with R.RF; If just do not exist DN_REQ is broadcasted away, and in DN_REC_LIST, add original records RI (domain name field of RI is D_name, and RF is changed to " not upgrading " state, and all the other fields are empty);
(3) start timer R (or RI) .Reply_wait_Timer, wait for the arrival of DN_REP.
Value=2*NODE_TRAVERSAL_TIME*NET_DIAMETER of Reply_wait_Timer;
NODE_TRAVERSAL_TIME: in the processing time that node E-Packets, be generally 40 milliseconds;
Maximum hop count among the NET_DIAMETER:MANET between two nodes, relevant with network size.
The processing of DN_REQ
Receive the node of DN_REQ, will handle as follows:
(1) sets up or is maintained into the route of source node (send DN_REQ node);
(2) domain name and the domain name of oneself (being the domain name of RS record among the DN_REC_LIST) of asking among the DN_REQ compared, if equate just to forward to (5); Otherwise, enter (3);
(3) judge whether DN_REQ is the unicast packet of issuing oneself, if just forward (6) to; Otherwise, enter (4);
(4) DN_REQ is broadcasted away, forward (7) then to;
(5) judge the value of RS.RF,, just start domain-name information declaration mechanism, forward (7) then to if be in " not upgrading " state; Otherwise, enter (6);
(6) to source node clean culture DN_REP;
(7), in DN_REC_LIST, increase or upgrade the record of corresponding (domain name of carrying among domain name and the DN_REQ is identical) according to the domain-name information of the source node that carries among the DN_REQ.
The processing of DN_REP
Receive the node of DN_REP, will handle as follows:
(1) sets up or is maintained into the route of the node R_node that sends DN_REP;
(2) destination address of DN_REP and the address of node oneself are compared,, and forward (6) to if unequally just forward to the purpose node; Otherwise, enter (3);
What (3) lost efficacy this domain name correspondence replys waiting timer Reply_wait_Timer, and the domain name D_name that domain name and the node of R_node are asked compares then, if just equate the IP address of R_node is returned to application program, and forwards (6) to; Otherwise, enter (4);
(4) in DN_REC_LIST, search the record R that domain name is D_name,, just forward (6) to if R.RF is in " upgrading " state; Otherwise, enter (5);
(5) deletion record R, and restart the domain-name information request mechanism;
(6), in DN_REC_LIST, increase or upgrade corresponding record according to the domain-name information among the DN_REP.
The maintenance of sequence number
Node is when sending DN_REP, and except following exception, the sequence number of domain-name information all will add 1, and sequence number is stored in the domain name configuration file.
Exception: node receives that clean culture gives the DN_REQ of oneself, but the domain name of being asked among current domain name of node and the DN_REQ does not wait.
Domain-name information among the DN_REP
When (1) destination address of DN_REP is broadcast address (being the domain-name information declaration), only comprise the domain-name information of node oneself among the DN_REP.
When (2) destination address of DN_REP was unicast address, all be added into DN_REP greater than all domain-name informations of Min_ttl (a predefined threshold value is decided according to the real network environment, can be kept in the domain name configuration file) life cycle among the DN_REC_LIST.
The more maintenance of new logo (RF) among the DN_REC_LIST
When (1) increasing the domain-name information record RS of node oneself in DN_REC_LIST, the RF position of RS is changed to " upgrading " state.
When (2) domain-name information was declared, the RF position of the domain-name information of node oneself record RS was changed to " upgrading " state among the DN_REC_LIST.
(3) in DN_REC_LIST, increase or when upgrading domain-name information among the DN_REP, the RF position of domain-name information record R is changed to " upgrading " state.
When (4) increasing the domain-name information original records RI of requesting node in DN_REC_LIST, the RF position of RI is changed to " not upgrading " state.
(5) the domain-name information request mechanism is when the R.ip clean culture sends DN_REQ, and the RF position of R is changed to " not upgrading " state.
(6) TTL_Timer of the domain-name information of node oneself record RS is overtime among the DN_REC_LIST, and the RF position of RS is changed to " not upgrading " state.
The processing of timer expiry
(1) if the TTL_Timer of the domain-name information of node oneself record RS is overtime among the DN_REC_LIST, the RF position of RS is changed to " not upgrading " state.
(2) if the TTL_Timer of the record R except that RS is overtime among the DN_REC_LIST, R is deleted.
(3) if the Reply_wait_Timer of record R is overtime among the DN_REC_LIST, then
if(Req_Counter<=2){
If (R.RF is in " not upgrading " state)
Deletion record R;
Start the domain-name information request mechanism;
}else{
Return " domain name does not exist " to application program;
}
The optimization of domain-name information request mechanism
When DMDNS is applied to the outstanding MANET network of dynamic characteristic, can adopt following optimization mechanism further to reduce the domain name mapping time:
When DMDNS receives the domain name mapping request of application program, in the own DN_REC_LIST that is safeguarded, search the domain name D_name that is asked, if there is corresponding domain-name information record R, not immediately to R.ip clean culture DN_REQ, but whether the residue timeout value of at first judging R.TTL_Timer is greater than the product of Ratio and R.TTL, if directly send R.ip to application program, if not, send DN_REQ to the R.ip clean culture.Ratio is the number between 0 to 1, decides according to the dynamic characteristic of network; When Ratio was 1, this mechanism deteriorated to the domain-name information request mechanism of not optimizing; When Ratio is 0, be applied to the static constant MANET network in IP address; Typically, the Ratio value is 1/2, is applied to the moderate MANET network of IP address change speed.
Fig. 1 is seen in above-mentioned description for the domain name mapping process, sees Fig. 2 for the description of domain name service and forwards process.
The treatment mechanism of DMDNS and the simple broadcast request/clean culture domain name system of replying relatively, we obviously as can be seen the present invention have the following advantages:
(1) alleviated the broadcasting load of network.Because it is standby that domain-name information is got up by the node buffer memory, when node needed domain name mapping, the domain-name information of very possible request in buffer memory, therefore only needed clean culture to confirm the accuracy of this information.Because DMDNS used piggy mechanism, domain name request/reply can be to message institute many domain-name informations of node reception and registration on the path, the probability that the domain name of request analysis is hit in buffer memory is very big.In addition, because network node carries out the domain-name information declaration in good time, the node of the adding domain name request/response message approach buffer memory of oneself that upgrades in time makes that the correctness of the domain-name information that hits is very high in buffer memory, that is to say that to need the probability of broadcast request very little.Therefore DMDNS has reduced the number of times of broadcasting to a great extent, thereby has alleviated the extra load that Web broadcast caused.
(2) when the static configuration of IP address, DMDNS can reduce the domain-name information response time.When the static configuration of IP address, the mapping between domain name and the IP address is fixed, and the domain-name information that therefore hits in buffer memory is accurately, does not need to verify that its correctness just can return domain-name information to application program and reply.In addition, if the domain name of request analysis is not hit in local cache, and hit in the node buffer memory of request message process, this node can replace the purpose node to return domain-name information immediately replying.This obviously can reduce the response time of domain-name information.
The present invention has been used in the design of the IPv6 MANET of Computer Department of the Chinese Academy of Science test clinical system.
The invention technical scheme
A kind of domain name service/analytic method of distributed domain name system, network node carry out the domain-name information declaration in good time, make the up-to-date domain-name information of the timely buffer memory declaration of other node node on the network; In domain name request/response message, use piggy mechanism, guarantee that junction associated is once obtaining domain-name information as much as possible in request/acknowledge cycle, make the domain name mapping request strengthen at the probability that local cache hits, thus the broadcasting load that alleviates network; Under the static configuration situation of IP address, but the domain-name information that hits in any network node buffer memory need not confirmed just immediate answer, can effectively reduce the domain name response time; Under the dynamic-configuration situation of IP address, utilize the correctness of clean culture affirmation process assurance domain-name information, when reducing broadcasting, guaranteed the validity of domain name mapping.
A kind of domain name service/analytic method of distributed domain name system, its concrete steps are as follows:
Step S1: when node starts this domain name system or IP address modification, other node broadcasting domain name information answer message DN_REP in MANET, the own current domain-name information of declaration;
Step S2: receive the node of domain-name information declaration, upgrade the domain-name information buffer memory DN_REC_LIST of oneself according to the domain-name information that carries among the DN_REP;
Step S3: require the node that domain name D_NAME resolves is searched the record R that the domain name item is D_NAME in the DN_REC_LIST of oneself, if there is record R, the IP address clean culture of just being write down in R sends a domain-name information request message DN_REQ; If there is not record R, just the node of all in MANET is broadcasted a DN_REQ;
Step S4: receive the node of DN_REQ, judge at first whether oneself is the node of being asked, upgrade DN REC_LIST according to domain-name information entrained among the DN_REQ then,,, otherwise DN_REQ is forwarded with regard to execution in step 5 if oneself be the node of being asked;
Step 5: node is replied the DN_REQ that receives, node judges at first whether the domain-name information of declaring oneself last time is out-of-date life cycle, if just DN_REP of the node of all in MANET broadcasting replys; If life cycle is not out-of-date as yet,, carry all the effective domain name information known to the node among the DN_REP just to asking DN_REP of node clean culture to reply;
Step S6: receive the node of DN_REP, judge at first whether it is the domain name response message of issuing oneself,, otherwise it is transmitted to the request node, upgrade DN_REC_LIST according to the domain-name information that carries among the DN_REP then if with regard to execution in step S7;
Step S7: judge whether the domain-name information that carries among the DN_REP is own institute information requested, if just return the pairing IP of D_NAME address to application program, otherwise delete original record R, and restart the domain name mapping process, after if twice domain name mapping process finished, node is not received the own DN_REP that is asked yet, just returns " domain name does not exist " to application program.
Embodiment
Fig. 1 is the domain name mapping flow chart, and the treatment step of each incident is as follows among the figure:
Step S1.1: after node is received the domain name mapping request of application program, in the domain name buffer memory of oneself, search the domain name D_name that is asked; And initialization domain name mapping trial counter Req_Counter, its initial value is 0.
Step S1.2: judge domain name cache lookup result, if the record R of existence domain D_name by name in the domain name buffer memory enters S1.3; If the record of existence domain D_name by name not in the domain name buffer memory enters S1.4.
Step S1.3: the IP address clean culture of being write down in R sends DN_REQ, in order to confirm the correctness of D_name and IP_addr mapping; The IP head's of DN_REQ message address is the IP that is write down among the R, enters S1.5.
Step S1.4: to DN_REQ of the whole network broadcasting, in order to the IP address of inquiry D_name; The IP head's of DN_REQ message address is a broadcast address, is the multicast address of all nodes in the predefined expression MANET in IPv6.
Step S1.5: start waiting timer, wait for the arrival of domain-name information response message DN_REP; The value of Req_Counter adds 1.
Step S1.6: if timer expiry just enters S1.7; Otherwise, wait for up to DN_REP always and arriving, enter S1.8.
Step S1.7: judge that whether this domain name mapping trial Req_Counter surpasses 2 times, just returns " domain name does not exist " to application program if surpass; Otherwise, enter S1.4, broadcast DN_REQ again.
Step S1.8: in the domain name buffer memory, add or upgrade corresponding record according to the domain-name information among the DN_REP.
Step S1.9: judge whether the domain name among the DN_REP that receives is the domain name of asking, if just return the IP address of this domain name correspondence to application program; Otherwise, illustrate the mapping error of D_name and IP_addr in the former domain name buffer memory to enter S1.10.
Step S1.10:, just enter S1.11 if the record R of mapping error still is present in the domain name buffer memory; Otherwise, enter S1.12.
Step S1.11: will write down R and from the domain name buffer memory, delete, and restart the domain name mapping process.
Step S1.12: abandon the DN_REP that receives, do not do any other processing.
Fig. 2 is domain name service and forwards flow chart, and the treatment step of each incident is as follows among Fig. 2:
Step S2.1: when starting the IP address modification of DMDNS or node oneself, node is declared own current domain-name information to other network node to domain-name information response message DN_REP of MANET broadcasting.
Step S2.2: upgrade the domain-name information buffer memory according to the domain-name information request of receiving/response message.
Step S2.3: when receiving domain-name information request/response message, judge the type of this message according to the QR sign position (seeing RFC1035) of message packet head, if the domain-name information request message just enters S2.4; If the domain-name information response message just enters S2.6.
Step S2.4: whether the domain name of judging oneself is whether the domain name or the IP address of oneself of being asked is the purpose IP address of DN_REQ, if just reply, otherwise DN_REQ is forwarded.
Step S2.5: nslookup declaration state, if the domain name of declaration is out-of-date life cycle, promptly node is in domain name and does not declare state, to MANET broadcasting DN_REP, promptly enters S2.1; If node is in domain name and has declared state, just enter S2.8.
Step S2.6: the address according to the IP head of the DN_REP that receives judges whether this DN_REP is the message of issuing this node, if just by receiving among Fig. 1 that the handling process after the domain-name information response message handles; If not, DN_REP is forwarded, promptly enter S2.7.
Step S2.7: the destination address according to message packet forwards this domain-name information request/response message to other node.
Step S2.8: send a domain-name information response message DN_REP to the clean culture of request node.