Gateway device-based domain name resolution method and apparatus, and electronic device

By establishing a pre-configured domain name tree and alias domain name tree in the gateway device, the domain name request message is automatically resolved, which solves the problem of inconsistent mapping between domain names and IP addresses, ensures normal traffic flow, reduces the configuration complexity for administrators, and improves the user experience.

CN115665086BActive Publication Date: 2025-12-12BEIJING HILLSTONE NETWORKS INFORMATION TECHCO
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211281874.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-19
Publication Date
2025-12-12
Estimated Expiration
2042-10-19

AI Technical Summary

Technical Problem

In existing technologies, gateway devices cannot effectively solve the problem of inconsistent mapping between domain names and IP addresses, especially in cases of CNAME cascading and multiple domain names pointing to the same domain name, which leads to traffic blocking and high complexity for administrators.

Method used

By establishing a pre-configured domain name tree and alias domain name tree in the gateway device, the domain name request message is automatically resolved, and the mapping relationship between domain name and IP address is updated, realizing the dynamic matching and updating of the domain name tree and IP tree, and ensuring that the target terminal can automatically access the corresponding server.

Benefits of technology

This technology enables gateway devices to automatically learn and update IP addresses when CNAME cascading and multiple domains pointing to the same domain, ensuring normal traffic flow, reducing administrator configuration complexity, and improving user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115665086B_ABST
    Figure CN115665086B_ABST
Patent Text Reader

Abstract

The application discloses a domain name resolution method and device based on a gateway device and electronic equipment, wherein the resolution method comprises the following steps: receiving a domain name request message sent by a target terminal and performing resolution, in the case that a request domain name is matched from a preset configuration domain name tree, updating an IP tree of a domain name entry matched with the request domain name in the preset configuration domain name tree to obtain a first update result, or in the case that the request domain name is matched from a preset alias domain name tree, updating a father tree of an alias domain name entry matched with the request domain name in the preset alias domain name tree and updating an IP tree of each father domain name in the father tree to obtain a second update result, and in the case that the first update result or the second update result indicates that an IP address corresponding to the request domain name is added on the IP tree, returning the IP address to the target terminal. The application solves the technical problem that in the related art, when a request domain name exists an alias domain name, a corresponding server cannot be automatically accessed through a gateway device.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of gateway devices, in particular to a domain name resolution method and device based on a gateway device and an electronic device. BACKGROUND

[0002] Early Internet identifies a host by IP address, but IP address is not easy to remember. With the gradual increase in the number of hosts in the network, it is very difficult to identify a host by IP address, so the DNS system (Domain Name System) appears, which uses domain names that are easy to remember to identify a host and records the mapping relationship between domain names and IP addresses.

[0003] One of the important functions of a gateway device is policy, i.e. an administrator can configure some rules to control (such as pass, block, enter tunnel, need authentication, etc.) traffic passing through the device, and each rule has matching items such as source / destination address, source / destination security domain, destination domain name, service, application, etc. The configurability of the destination domain name helps to improve the ease of use of the function and avoids the administrator remembering and configuring IP addresses, but this also poses a higher challenge to the gateway device, requiring the gateway device to have the ability to learn the domain name and IP mapping relationship.

[0004] For example, the administrator can configure the following policies: 1 allow all DNS traffic to pass; 2 allow www.x.com business traffic to pass; 3 the rest of the traffic is not allowed to pass.

[0005] Figure 1 is a schematic diagram of an optional user access www.x.com process in the prior art, as shown in Figure 1 , the user terminal sends a DNS request for the domain name to the local DNS server (step 1), the local DNS server sends the DNS request to the DNS server for resolution (step 2), the DNS server returns the IP address corresponding to the domain name to the local DNS server (step 3), and the local DNS server returns the IP address to the user terminal (step 4), all of the above traffic is DNS traffic and is passed by policy 1; and the user terminal accesses the www.x.com business server through the IP address (steps 5 and 6) requires the gateway device to learn the IP address of the domain name www.x.com in order to be passed normally by policy 2, otherwise it can only be blocked according to policy 3.

[0006] In addition to the policy function, other modules such as policy-based routing (PBR) and link load balancing module need to learn the domain name and IP mapping relationship. Therefore, the module that learns the domain name and IP mapping relationship is the basis for supporting the upper-layer business module, and these modules can be referred to as the DNS snooping module (i.e., the DNS sniffing module) and the DNS sniffing module.

[0007] In the DNS protocol, the A record is used to record the mapping relationship between the domain name and the IPv4 address; the AAAA record is used to record the mapping relationship between the domain name and the IPv6 address, and the A record and the AAAA record are a kind of resource record used to learn the domain name and IP mapping relationship. In addition, the CNAME record is used to record the mapping relationship between the domain name alias and the domain name, and is mainly used in the following scenarios:

[0008] a) A host computer provides multiple services at the same time, and different domain names are presented to users to help users remember.

[0009] For example, there is a computer named host, which belongs to the domain h**s**.com, and it provides WWW and MAIL services at the same time. Two aliases (CNAME) can be set for the computer: WWW and MAIL. One of the domain names host.h**s**.com is made into an A record pointing to the server IP, and the other domain names are made into aliases (i.e., CNAME) mapped to the domain name host.h**s**.com, as follows:

[0010] host A 1.2.3.4;

[0011] WWW CNAME host;

[0012] MAIL CNAME host;

[0013] When the server IP address changes, it is not necessary to change the pointing of multiple domain names (such as www.h**s**.com and mail.h**s**.com), but only the domain name host.h**s**.com needs to be changed to map to the new IP of the server, and the rest of the domain names that have been made into aliases (i.e., CNAME) will be automatically updated to the new IP.

[0014] b) Large websites use CDN (content distribution network) solutions to improve response speed.

[0015] The basic scenario of CDN is as follows:

[0016] 1. The user terminal wants to access the domain name www.web.com and finds that there is no local DNS cache, so it requests the local DNS server;

[0017] 2. The local DNS server finds the authoritative DNS server responsible for resolving www.web.com, assuming the authoritative DNS server is NSWEB;

[0018] 3. NSWEB sets the CNAME of www.web.com to www.web.51cdn.com. Assume that the domain name resolution of www.web.51cdn.com is responsible by the intelligent DNS load balancing system NSWEB51CDN in the CDN network;

[0019] 4. The local DNS server initiates an IP address resolution request for www.web.51cdn.com to NSWEB51CDN;

[0020] 5. NSWEB51CDN returns the IP that can respond to the local DNS server the fastest (theoretically, it is also the fastest response to the user terminal) to the local DNS server;

[0021] 6. The local DNS server caches the CNAME record and A record of www.web.com locally and returns them to the terminal user, and the returned results are as follows:

[0022] www.web.com CNAME www.web.51cdn.com;

[0023] www.web.51cdn.com A 2.3.4.5;

[0024] The DNS protocol does not encourage CNAME pointing to CNAME, which may cause CNAME loop (i.e. alias loop), and CNAME loop will increase the processing difficulty and resolution time of the DNS system, and affect the Internet speed of the user terminal. In practice, however, there is inevitably a cascading situation of CNAME, as follows:

[0025] www.web.com CNAME www.webcdn1.com;

[0026] www.web cdn1.com CNAME www.webcdn2.com;

[0027] www.web cdn2.com A 3.4.5.6;

[0028] c) There is a situation where a domain name corresponds to multiple CNAMEs, as follows:

[0029] www.web.com CNAME www.webcname1.com;

[0030] www.web.com CNAME www.webcname2.com

[0031] www.web.com CNAME www.webcname3.com;

[0032] This configuration enables the DNS server to achieve CNAME-based load balancing for the resolution of a domain name. For example, for a resolution request of the IP address of www.web.com., the DNS server can return one of the three CNAMEs randomly or according to a certain balancing policy.

[0033] The three cases of the multiple domain names mentioned above being CNAME pointed to the same domain name, CNAME cascading, and one domain name corresponding to multiple CNAMEs provide great flexibility for the domain name resolution service of the DNS system, and the result is that the original domain name displayed externally and the CNAME domain name used internally by the DNS system share the same set of IP addresses, which brings great challenges to the DNS snooping function on the gateway device.

[0034] In the related art, Figure 2 is a schematic diagram of an optional device workflow according to the prior art, as shown in Figure 2As shown, the gateway device includes: a control plane, a data plane, the control plane includes: a policy, a DNSd; the data plane includes: DNS snooping, a policy. The upper layer module initiates registration of a domain name www.x.com (1 register domain www.x.com) to the policy of the control plane, the policy of the control plane sends the registration of the domain name www.x.com (2 register domain www.x.com) to the DNSd, the DNSd initiates a DNS request (3.1 DNS request: www.x.com A?) to the DNS server 1, the DNS server 1 returns a DNS response (3.2 DNS response: www.x.com A 2.3.4.5) to the DNSd, the DNSd sends a mapping relationship (4.1 report mapping: www.x.com A 2.3.4.5) to the policy of the control plane, and the policy of the control plane sends the mapping relationship (4.2 report mapping: www.x.com A 2.3.4.5) to the policy of the data plane. The user terminal sends a DNS request (5.1 DNS request: www.x.com A?) to the local DNS server, the local DNS server sends a DNS request (5.2 DNS request: www.x.com A?) to the DNS server, the DNS server returns a DNS response (5.3 DNS resonse: www.x.com3.4.5.6) to the local DNS server, and the local DNS server returns a DNS response (5.4 DNS resonse: www.x.com3.4.5.6) to the user terminal. The user terminal accesses the www.x.com service server through a destination IP address (dst-ip:3.4.5.6), but since the IP address stored by the policy of the data plane is 2.3.4.5, the service traffic is blocked by the gateway device (6 IP pak (dst-ip: 3.4.5.6)).

[0035] The DNS module in the gateway device is responsible for converting the domain name configured by other service modules into an IP address. In implementation, the other service modules register the domain name configured by an administrator to the DNS module (DNSd in the DNS module) Figure 2 The DNS module acts as a DNS client and periodically queries the domain name through the DNS server configured by the gateway device, and notifies the corresponding service module of the IP address queried.

[0036] However, many websites will apply for multiple IP addresses, and the DNS server will often use some intelligent algorithm or balancing algorithm to return the IP address.

[0037] The intelligent / balancing algorithm used by the DNS server end can cause the following two situations:

[0038] 1) Different DNS client requests for the same domain name IP address may get different results;

[0039] 2) The same DNS client multiple requests for a domain name IP address, may also get different results.

[0040] Therefore, the DNS module on the gateway device and the DNS client of the user terminal may obtain inconsistent IP addresses, which ultimately manifests as: the network administrator has configured to allow the business traffic of a certain domain name to pass through the device, but due to the IP address learned by the gateway device for the domain name (2.3.4.5 in step 3.2 of the prior art two) is inconsistent with the IP address used by the user terminal to initiate the business traffic to the domain name (3.4.5.6 in step 6 of the prior art two), resulting in the business traffic to the www.x.com business server in step 6 of the prior art two being blocked by the gateway device. Figure 2 Figure 2 Figure 2

[0041] In addition, the above scheme cannot effectively solve the case of multiple domain names pointing to the same domain name, CNAME cascading, and one domain name corresponding to multiple CNAMEs.

[0042] Figure 3 is a schematic diagram of an optional gateway device workflow according to the prior art two, as shown in Figure 3 the gateway device includes: a control plane, a data plane, the control plane includes: a policy, DNSsnpd; the data plane includes: DNSsnooping, a policy.

[0043] The prior art two places the function of learning domain name and IP correspondence relationship in the data plane, that is, by analyzing the DNS response packet received by the user terminal to ensure that the IP address learned by the gateway is consistent with the IP address seen by the user terminal.

[0044] As Figure 3 ​​​As shown, steps 1, 2, and 3 are the process of registering www.x.com to DNSsnpd by the policy module of the control plane after receiving the configuration instruction from the network administrator that the traffic of www.x.com needs to be allowed (i.e., the upper module initiates to register the domain name www.x.com (1 register domain www.x.com) to the policy of the control plane, the control plane sends the registered domain name www.x.com (2 register domain www.x.com) to DNSsnpd, and DNSsnpd sends the registered domain name www.x.com (3 register domain www.x.com) to the data plane).

[0045] Step 4 is that the DNS snooping module listens to the IP address 2.3.4.5 corresponding to the registered domain name www.x.com, and returns the mapping relationship between www.x.com and the IP address 2.3.4.5 to the policy module of the control plane, and the policy module of the control plane synchronizes the IP address 2.3.4.5 to the policy module of the data plane. After receiving the synchronization message, the policy module of the data plane adds the IP to the allowed list (i.e., the user terminal sends a DNS request (4.1 DNS request: www.x.com A?) to the local DNS server, the local DNS server sends a DNS request (4.2 DNS request: www.x.com A?) to the DNS server, the DNS server returns a DNS response (4.3 DNS response: www.x.com A 2.3.4.5) to the local DNS server. The DNS snooping sends the mapping relationship (4.4 report mapping: www.x.com A 2.3.4.5) to DNSsnpd, DNSsnpd sends the mapping relationship (4.5 report mapping: www.x.com A 2.3.4.5) to the policy of the data plane, and the policy of the control plane sends the mapping relationship (4.6 report mapping: www.x.com A 2.3.4.5) to the policy of the data plane. The local DNS server returns a DNS response (4.7 DNS response: www.x.com 2.3.4.5) to the user terminal).

[0046] Step 5 is the user terminal issued to 2.3.4.5 IP address of the message to the gateway device, the data plane policy module found that 2.3.4.5 is in the list of allowed, allow the message to pass normally (i.e. 5 IP pak (dst-ip:2.3.4.5)).

[0047] Prior art two solved the problem of prior art one learned gateway IP address and user terminal using the IP address is inconsistent, but still can not solve the domain name CNAME exists.

[0048] Figure 4 According to prior art two, an optional gateway device workflow in the presence of CNAME case is shown in the figure, as Figure 4 The gateway device includes: control plane, data plane, control plane includes: policy, DNSsnpd; the data plane includes: DNS snooping, policy.

[0049] As shown in Figure 4 1, 2, 3, the upper module initiates the registration domain name www.x.com (1 register domain www.x.com) to the control plane policy, the control plane policy will register domain name www.x.com (2 register domain www.x.com) sent to DNSsnpd, DNSsnpd will register domain name www.x.com (3 register domain www.x.com sent to the data plane).

[0050] Step 4, the user terminal sends DNS request (4.1 DNS request: www.x.com A?) to the local DNS server, the local DNS server sends DNS request (4.2 DNS request: www.x.com A?) to the DNS server, the DNS server returns DNS response (4.3 DNS resonse: www.x.com CNAME www.y.com www.y.com A 2.3.4.5) to the local DNS server, the local DNS server sends DNS request (4.4 DNS request: www.y.com A?) to the DNS server, the DNS server returns DNS response (4.5 DNS resonse: www.y.com A 3.4.5.6) to the local DNS server, the local DNS server returns DNS response (4.6 DNS resonse: www.x.com 3.4.5.6) to the user terminal.

[0051] Since the DNS response packet of step 4.3 contains 2 resource records, one is the CNAME of www.x.com www.y.com, and the other is the A record of www.y.com 2.3.4.5, steps 5 to 7 will inform the mapping relationship between www.x.com and IP address 2.3.4.5 to the data plane policy module, and the data plane policy module will add 2.3.4.5 to the allowed list (i.e. DNS snooping sends the mapping relationship to DNSsnpd (5. report mapping: www.x.com A 2.3.4.5), DNSsnpd sends the mapping relationship to the data plane policy (6. report mapping: www.x.com A 2.3.4.5), and the control plane policy sends the mapping relationship to the data plane policy (7. report mapping: www.x.com A 2.3.4.5)).

[0052] When the initiator of step 4.1 is a local DNS server, if a DNS response packet with CNAME is received in step 4.3, it will be iterated to request the IP address of www.y.com, as in step 4.4. Since www.y.com is not manually configured by the administrator, the DNS snooping module does not pay attention to the DNS response packet of step 4.5, and there is no processing similar to steps 5 to 7.

[0053] After receiving the packet of step 4.5, the local DNS server finally returns the CNAME record www.y.com and the A record 3.4.5.6 of www.x.com to the end user.

[0054] The user terminal uses IP address 3.4.5.6 to access www.x.com, and the data plane policy module finds that the IP address is not in the allowed list, and discards the packet, so the user terminal cannot normally access www.x.com (i.e. 8 IP pak (dst-ip:3.4.5.6)).

[0055] Although the administrator can manually configure the CNAME domain name www.y.com of www.x.com as well, so that the DNS snooping module pays attention to the IP address of www.y.com, and also notifies the policy module of the IP address 3.4.5.6 seen in step 4.5. However, the administrator needs to be familiar with the mapping relationship between domain names in the DNS system, and needs to manually configure the domain name allowed to pass through the device and the domain name mapped in the DNS system (if the domain name has multiple levels of CNAME, the administrator needs to manually configure each level of CNAME domain name) to achieve domain name-based policy control. This increases the complexity of configuring the gateway device and reduces the user experience of the gateway device.

[0056] Currently, no effective solution has been proposed for the above problems. SUMMARY

[0057] Embodiments of the present application provide a gateway device-based domain name resolution method and device and an electronic device to at least solve the technical problem in the related art that when an alias domain name exists for a requested domain name, the corresponding server cannot be automatically accessed through the gateway device.

[0058] According to an aspect of an embodiment of the present application, a gateway device-based domain name resolution method is provided, including: receiving a domain name request message sent by a target terminal and resolving the domain name request message to obtain a resolution result, wherein the resolution result at least includes: a requested domain name; in a case where the requested domain name is matched from a preset configured domain name tree, updating an IP tree of a domain name entry matched with the requested domain name in the preset configured domain name tree to obtain a first update result; or in a case where the requested domain name is matched from a preset alias domain name tree, updating a father tree of an alias domain name entry matched with the requested domain name in the preset alias domain name tree and updating an IP tree of each father domain name in the father tree to obtain a second update result; in a case where the first update result or the second update result indicates that an IP address corresponding to the requested domain name is added on the IP tree, returning the IP address to the target terminal, wherein the target terminal accesses a server indicated by the requested domain name through the IP address.

[0059] Optionally, before receiving the domain name request message sent by the target terminal, the method further includes: receiving a domain name registration request sent by the target terminal, wherein the domain name registration request includes: a to-be-registered domain name, an IP address type, and a terminal identifier; in response to the domain name registration request, registering the to-be-registered domain name; and in a case where the to-be-registered domain name is successfully registered, representing the to-be-registered domain name as the requested domain name.

[0060] Optionally, before receiving the domain name request message sent by the target terminal, the method further comprises: configuring a first type of domain name and a second type of domain name; generating a preset configuration domain name tree based on the first type of domain name and the second type of domain name, wherein a domain name entry in the preset configuration domain name tree is the first type of domain name or a derived domain name matched with the second type of domain name, each domain name entry corresponds to an IP tree, and the IP tree is used to save an IP address of a domain name indicated by the domain name entry; obtaining a historical domain name request message, wherein the historical domain name request message carries an alias domain name of the first type of domain name or a derived domain name matched with the second type of domain name; and generating a preset alias domain name tree based on the alias domain name, wherein an alias domain name entry in the preset alias domain name tree corresponds to a father tree, the father tree is used to record a father domain name corresponding to the alias domain name indicated by the alias domain name entry, and each father domain name in the father tree corresponds to an IP tree.

[0061] Optionally, after resolving the domain name request message to obtain a resolution result, the method further comprises: in a case where the resolution result further comprises an alias record, judging whether the request domain name is matched from the preset configuration domain name tree, wherein the alias record at least comprises a multi-level domain name; in a case where the matching is successful, judging whether the multi-level domain name is stored in the preset alias domain name tree; in a case where the multi-level domain name is not stored in the preset alias domain name tree, inserting the multi-level domain name into the preset alias domain name tree, and inserting the request domain name into a father tree of an alias domain name entry represented by the multi-level domain name; updating a time to live of the request domain name to a time to live of a father domain name of the multi-level domain name; or in a case where the multi-level domain name is stored in the preset alias domain name tree, updating the time to live of the request domain name to the time to live of the father domain name of the multi-level domain name.

[0062] Optionally, after judging whether the request domain name is matched from the preset configuration domain name tree, the method further comprises: in a case where the matching is unsuccessful, judging whether the request domain name is matched from the preset alias domain name tree; in a case where the matching is successful, judging whether the multi-level domain name exists in the preset alias domain name tree; in a case where the multi-level domain name does not exist in the preset alias domain name tree, inserting the multi-level domain name into the preset alias domain name tree, and querying all father domain names of the request domain name from the preset alias domain name tree; adding all the father domain names of the request domain name to a father tree of the multi-level domain name; in a case where any target father domain name of the request domain name already exists in the father tree of the multi-level domain name, updating a time to live of the target father domain name based on a time to live of the alias record.

[0063] Optionally, after the domain name request message is parsed to obtain a resolution result, the method further comprises: in a case where the resolution result further comprises a preset record, determining whether the request domain name is matched from the preset configuration domain name tree; in a case where the matching is successful, updating an IP tree of a domain name entry matched with the request domain name; in a case where the matching is unsuccessful, determining whether the request domain name is matched from the preset alias domain name tree; in a case where the request domain name is matched from the preset alias domain name tree, querying all parent domain names of the request domain name from the preset alias domain name tree; and traversing the all parent domain names to update an IP tree of each of the parent domain names.

[0064] Optionally, the step of updating the IP tree of the domain name entry matched with the request domain name comprises: determining whether the IP tree exists a current IP address; in a case where the IP tree does not exist the current IP address, inserting the current IP address into the IP tree; and in a case where the IP tree exists the current IP address, updating a time to live of an IP address consistent with the current IP address in the IP tree.

[0065] Optionally, the method further comprises: in a case where a time to live of an IP address of the domain name entry in the preset configuration domain name tree exceeds a first preset threshold, performing aging processing on the IP address; in a case where the domain name entry is the derivative domain name and all IP addresses in the IP tree corresponding to the derivative domain name are all aged, deleting the derivative domain name from the preset configuration domain name tree; in a case where a time to live of a parent domain name of the alias domain name entry in the preset alias domain name tree exceeds a second preset threshold, performing aging processing on the parent domain name; and in a case where all parent domain names in the parent tree corresponding to the alias domain name entry are all aged, deleting the alias domain name entry from the preset alias domain name tree.

[0066] According to another aspect of the embodiments of the present application, a gateway device-based domain name resolution apparatus is further provided, and has the following characteristics. The apparatus comprises: a resolution unit, configured to receive a domain name request message sent by a target terminal, and resolve the domain name request message to obtain a resolution result, wherein the resolution result at least comprises a request domain name; a first updating unit, configured to, in a case where the request domain name is matched from a preset configuration domain name tree, update an IP tree of a domain name entry in the preset configuration domain name tree that matches the request domain name to obtain a first updating result; or a second updating unit, configured to, in a case where the request domain name is matched from a preset alias domain name tree, update a parent tree of an alias domain name entry in the preset alias domain name tree that matches the request domain name, and update an IP tree of each parent domain name in the parent tree to obtain a second updating result; and a return unit, configured to, in a case where the first updating result or the second updating result indicates that an IP address corresponding to the request domain name is added on the IP tree, return the IP address to the target terminal, wherein the target terminal accesses a server indicated by the request domain name through the IP address.

[0067] Optionally, the resolution apparatus further comprises: a first receiving module, configured to, before receiving the domain name request message sent by the target terminal, receive a domain name registration request sent by the target terminal, wherein the domain name registration request comprises a to-be-registered domain name, an IP address type, and a terminal identifier; a first response module, configured to, in response to the domain name registration request, register the to-be-registered domain name; and a first representation module, configured to, in a case where the to-be-registered domain name is successfully registered, represent the to-be-registered domain name as the request domain name.

[0068] Optionally, the resolution apparatus further comprises: a first configuration module, configured to, before receiving the domain name request message sent by the target terminal, configure a first type of domain name and a second type of domain name; a first generation module, configured to generate a preset configuration domain name tree based on the first type of domain name and the second type of domain name, wherein a domain name entry in the preset configuration domain name tree is the first type of domain name or a derived domain name matched from the second type of domain name, each domain name entry corresponds to an IP tree, and the IP tree is used to save an IP address of a domain name indicated by the domain name entry; a first acquisition module, configured to acquire a historical domain name request message, wherein the historical domain name request message carries an alias domain name of the first type of domain name or an alias domain name of a derived domain name matched from the second type of domain name; and a second generation module, configured to generate a preset alias domain name tree based on the alias domain name, wherein an alias domain name entry in the preset alias domain name tree corresponds to a parent tree, the parent tree is used to record a parent domain name corresponding to the alias domain name indicated by the alias domain name entry, and each parent domain name in the parent tree corresponds to an IP tree.

[0069] Optionally, the resolving device further comprises: a first judging module, configured to, after resolving the domain name request message and obtaining a resolving result, judge whether the request domain name is matched from the preset configuration domain name tree in a case that the resolving result further comprises an alias record, wherein the alias record at least comprises a multi-level domain name; a second judging module, configured to, in a case that the matching succeeds, judge whether the multi-level domain name is stored in the preset alias domain name tree; a first inserting module, configured to, in a case that the multi-level domain name is not stored in the preset alias domain name tree, insert the multi-level domain name into the preset alias domain name tree, and insert the request domain name into a father tree of an alias domain name entry represented by the multi-level domain name; a first updating module, configured to update a time to live of the request domain name to a time to live of a father domain name of the multi-level domain name; and a second updating module, configured to, in a case that the multi-level domain name is stored in the preset alias domain name tree, update the time to live of the request domain name to the time to live of the father domain name of the multi-level domain name.

[0070] Optionally, the resolving device further comprises: a third judging module, configured to, after judging whether the request domain name is matched from the preset configuration domain name tree, judge whether the request domain name is matched from the preset alias domain name tree in a case that the matching fails; a fourth judging module, configured to, in a case that the matching succeeds, judge whether the multi-level domain name exists in the preset alias domain name tree; a second inserting module, configured to, in a case that the multi-level domain name does not exist in the preset alias domain name tree, insert the multi-level domain name into the preset alias domain name tree, and query all father domain names of the request domain name from the preset alias domain name tree; a first adding module, configured to add all the father domain names of the request domain name to a father tree of the multi-level domain name; and a third updating module, configured to, in a case that any target father domain name of the request domain name already exists in the father tree of the multi-level domain name, update a time to live of the target father domain name based on a time to live of the alias record.

[0071] Optionally, the resolving device further comprises: a fifth judging module, configured to, after resolving the domain name request message and obtaining a resolving result, judge whether the request domain name is matched from the preset configuration domain name tree in a case that the resolving result further comprises a preset record; a fourth updating module, configured to, in a case that the matching succeeds, update an IP tree of a domain name entry matched with the request domain name; a sixth judging module, configured to, in a case that the matching fails, judge whether the request domain name is matched from the preset alias domain name tree; a first querying module, configured to, in a case that the request domain name is matched from the preset alias domain name tree, query all father domain names of the request domain name from the preset alias domain name tree; and a fifth updating module, configured to traverse the all father domain names, and update an IP tree of each of the father domain names.

[0072] Optionally, the fourth updating module comprises: a first judging submodule, configured to judge whether the IP tree exists a current IP address; a first inserting submodule, configured to insert the current IP address into the IP tree in a case that the IP tree does not exist the current IP address; and a first updating submodule, configured to update a time to live of an IP address consistent with the current IP address in the IP tree in a case that the IP tree exists the current IP address.

[0073] Optionally, the resolving apparatus further comprises: a first processing module, configured to perform aging processing on an IP address of the domain name entry in the preset configuration domain name tree in a case that a time to live of the IP address exceeds a first preset threshold; a first deleting module, configured to delete the derivative domain name from the preset configuration domain name tree in a case that the domain name entry is the derivative domain name and all IP addresses in the IP tree corresponding to the derivative domain name are all subjected to the aging processing; a second processing module, configured to perform aging processing on a parent domain name of the alias domain name entry in the preset alias domain name tree in a case that a time to live of the parent domain name exceeds a second preset threshold; and a second deleting module, configured to delete the alias domain name entry from the preset alias domain name tree in a case that all parent domain names in the parent tree corresponding to the alias domain name entry are all subjected to the aging processing.

[0074] According to another aspect of the embodiments of the present application, an electronic device is also provided, which comprises one or more processors and a memory, the memory being configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the gateway device-based domain name resolving method described above.

[0075] In the present disclosure, a domain name request packet sent by a target terminal is received, and the domain name request packet is resolved to obtain a resolving result, in a case that a request domain name is matched from a preset configuration domain name tree, an IP tree of a domain name entry matched with the request domain name in the preset configuration domain name tree is updated to obtain a first updating result, or in a case that the request domain name is matched from a preset alias domain name tree, a parent tree of an alias domain name entry matched with the request domain name in the preset alias domain name tree is updated, and an IP tree of each parent domain name in the parent tree is updated to obtain a second updating result, in a case that the first updating result or the second updating result indicates that an IP address corresponding to the request domain name is added on the IP tree, the IP address is returned to the target terminal.

[0076] In the present disclosure, the parsed request domain name can be matched with the domain names in the preset configuration domain name tree first, and the IP address resolved by the DNS server can be updated to the IP tree of the domain name entry matched with the request domain name in the preset configuration domain name tree after the matching is successful. If the request domain name is matched with the domain name in the preset alias domain name tree successfully, the request domain name is updated to the father tree of the matched alias domain name entry, and the IP address resolved by the DNS server is updated to the IP tree of each father domain name in the father tree. The IP address corresponding to the request domain name can also correspond to the alias domain name of the request domain name, so that the target terminal using the new IP address can automatically access the corresponding server, thereby solving the technical problem that the target terminal cannot automatically access the corresponding server through the gateway device when the request domain name has an alias domain name in the related art. BRIEF DESCRIPTION OF DRAWINGS

[0077] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and serve to explain the principles of the application. In the drawings:

[0078] Figure 1 is a schematic diagram of an optional user access www.x.com process according to prior art one;

[0079] Figure 2 is a schematic diagram of an optional gateway device working process according to prior art one;

[0080] Figure 3 is a schematic diagram of an optional gateway device working process according to prior art two;

[0081] Figure 4 is a schematic diagram of an optional gateway device working process in the case of CNAME according to prior art two;

[0082] Figure 5 is a flowchart of an optional gateway device-based domain name resolution method according to an embodiment of the present application;

[0083] Figure 6 is a schematic diagram of an optional gateway device structure according to an embodiment of the present application;

[0084] Figure 7 is a schematic diagram of an optional IP tree updating process according to an embodiment of the present application;

[0085] Figure 8 is a schematic diagram of an optional configuration domain name IP updating module and CNAME domain name father updating module processing process according to an embodiment of the present application;

[0086] Figure 9 is a schematic diagram of an optional distributed processing flow according to an embodiment of the present application;

[0087] Figure 10 is a schematic diagram of an optional application scenario according to an embodiment of the present application;

[0088] Figure 11 is a schematic diagram of an optional gateway device-based domain name resolution apparatus according to an embodiment of the present application. DETAILED DESCRIPTION

[0089] In order to make the personnel in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work should belong to the scope of protection of the present application.

[0090] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0091] The application provides a method for automatically sensing the corresponding relationship between domain names and alias domain names and the corresponding relationship between domain names and IP addresses in a DNS system for a gateway device, which can save the configured accurate domain names or the derived domain names capable of matching the wildcard domain names in a configuration domain name tree, each domain name entry maintains an IP tree capable of saving the corresponding IP addresses of the domain names, and the accurate domain names or the derived domain names learned from DNS message can be saved in an alias domain name tree, each alias domain name entry maintains a father tree for recording the corresponding accurate domain names or derived domain names of the alias domain names. When the gateway device is a distributed system, the DNS domain name resolution can be performed by a service card and a master card. The service card is used for resolving the passed DNS response message, and the IP addresses of the request domain names needing attention are reported to the master card. The master card receives the message of the service card, updates the IP tree in the configuration domain name tree and the father tree in the alias domain name tree, and reports the message to the strategy module of the control plane. The master card can also distribute the alias domain names needing attention of the service card to all service cards.

[0092] The method for automatically sensing the corresponding relationship between domain names and alias domain names and the corresponding relationship between domain names and IP addresses in a DNS system for a gateway device can solve the following problems: (1) when a domain name is mapped to a CNAME domain name in a DNS system through CNAME record, and the CNAME domain name is mapped to an IP address through A / AAAA record, the gateway device can learn the CNAME domain name and the A / AAAA record of the domain name in the DNS system by resolving the DNS message, so as to accurately obtain the IP address of the domain name; (2) for the scenes that multiple domain names are mapped to the same domain name through CNAME, CNAME cascading, and one domain name corresponds to multiple CNAMEs, the work can also be well completed.

[0093] The application will be described in detail in combination with various embodiments. Embodiment

[0094] According to the embodiment of the application, an embodiment of a domain name resolution method based on a gateway device is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a group of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0095] Figure 5 An embodiment of a domain name resolution method based on a gateway device according to the application is shown in the flowchart as shown in Figure 5 The method comprises the following steps:

[0096] Step S501, receiving a domain name request message sent by a target terminal, and parsing the domain name request message to obtain a parsing result, wherein the parsing result at least includes: a request domain name.

[0097] Step S502, in a case that the request domain name is matched from the preset configuration domain name tree, updating an IP tree of a domain name entry matched with the request domain name in the preset configuration domain name tree to obtain a first update result.

[0098] Step S503, in a case that the request domain name is matched from the preset alias domain name tree, updating a father tree of an alias domain name entry matched with the request domain name in the preset alias domain name tree, and updating an IP tree of each father domain name in the father tree to obtain a second update result.

[0099] Step S504, in a case that the first update result or the second update result indicates that an IP address corresponding to the request domain name is added on the IP tree, returning the IP address to the target terminal, wherein the target terminal accesses a server indicated by the request domain name through the IP address.

[0100] Through the above steps, the domain name request message sent by the target terminal can be received, and the domain name request message can be parsed to obtain the parsing result. In a case that the request domain name is matched from the preset configuration domain name tree, the IP tree of the domain name entry matched with the request domain name in the preset configuration domain name tree is updated to obtain the first update result, or in a case that the request domain name is matched from the preset alias domain name tree, the father tree of the alias domain name entry matched with the request domain name in the preset alias domain name tree is updated, and the IP tree of each father domain name in the father tree is updated to obtain the second update result. In a case that the first update result or the second update result indicates that the IP address corresponding to the request domain name is added on the IP tree, the IP address is returned to the target terminal. In the embodiment of the present application, the parsed request domain name can be matched with the domain names in the preset configuration domain name tree first. After the matching is successful, the IP address resolved by the DNS server can be updated on the IP tree of the domain name entry matched with the request domain name in the preset configuration domain name tree. If the request domain name is matched with the domain names in the preset alias domain name tree successfully, the request domain name is updated on the father tree of the matched alias domain name entry, and the IP address resolved by the DNS server is updated on the IP tree of each father domain name in the father tree. The IP address corresponding to the request domain name can also correspond to the alias domain name of the request domain name, so that the target terminal can automatically access the corresponding server by using the added IP address, thereby solving the technical problem that the corresponding server cannot be automatically accessed by the gateway device when the request domain name exists the alias domain name in the related art.

[0101] The embodiment of the present application will be described in detail below in combination with the above steps.

[0102] Figure 6 This is a schematic diagram of an optional gateway device structure according to an embodiment of the present invention, such as... Figure 6 As shown, it includes: a control plane and a data plane. The control plane includes the DNSsnpd module, which includes modules for registration management and IP reporting. The data plane includes the DNS snooping module, which includes modules for configuration management, message resolution, domain name matching, IP address reporting, configuration domain name IP update, CNAME domain name parent update, and aging.

[0103] Optionally, before receiving the domain name request message sent by the target terminal, the method further includes: receiving the domain name registration request sent by the target terminal, wherein the domain name registration request includes: the domain name to be registered, the IP address type, and the terminal identifier; responding to the domain name registration request and registering the domain name to be registered; and, if the domain name to be registered is successfully registered, representing the domain name to be registered as the requested domain name.

[0104] In this embodiment of the invention, the DNSsnpd module in the control plane can provide a unified API (Application Programming Interface) to accept registration requests from various upper-layer modules (i.e., receive domain name registration requests sent by the target terminal). The domain name registration request includes: the domain name to be registered (which can be an exact domain name or a wildcard domain name), the IP address type, and the terminal identifier (i.e., the upper-layer module ID). The domain name to be registered and the IP address type are then sent to the DNS snooping module in the data plane to register the domain name to be registered (i.e., respond to the domain name registration request and register the domain name to be registered). If the domain name to be registered is successfully registered, the domain name to be registered is represented as the requested domain name.

[0105] In this embodiment, after receiving the IP address reporting message from the DNS snooping module, the IP reporting module can add or delete the IP address of the domain name and send the message to the upper-layer module that registered the domain name.

[0106] Optionally, before receiving the domain name request message sent by the target terminal, the method further comprises: configuring a first type of domain name and a second type of domain name; generating a preset configuration domain name tree based on the first type of domain name and the second type of domain name, wherein a domain name entry in the preset configuration domain name tree is the first type of domain name or a derived domain name matched with the second type of domain name, each domain name entry corresponds to an IP tree, and the IP tree is used to save an IP address of the domain name indicated by the domain name entry; and obtaining a historical domain name request message, wherein the historical domain name request message carries an alias domain name of the first type of domain name or an alias domain name of the derived domain name matched with the second type of domain name; generating a preset alias domain name tree based on the alias domain name, wherein each alias domain name entry in the preset alias domain name tree corresponds to a father tree, and the father tree is used to record a father domain name corresponding to the alias domain name indicated by the alias domain name entry, and each father domain name in the father tree corresponds to an IP tree.

[0107] In the embodiment of the application, the configuration domain name tree and the CNAME domain name tree (i.e. the alias domain name tree) can be configured on the data plane (i.e. the accurate domain name (i.e. the first type of domain name) or the wildcard domain name (i.e. the second type of domain name) similar to *.h**s**.com can be configured, and the DNS snooping module of the data plane maintains two red-black trees: the configuration domain name tree and the CNAME domain name tree (i.e. the preset configuration domain name tree and the preset alias domain name tree), which can also be called the configuration domain name table and the CNAME domain name table.

[0108] In the embodiment, the configuration domain name tree can be generated based on the first type of domain name and the second type of domain name, the entry in the configuration domain name tree is the configured accurate domain name or the derived domain name matched with the wildcard domain name (i.e. the domain name entry in the preset configuration domain name tree is the first type of domain name or the derived domain name matched with the second type of domain name), and each entry maintains an IP tree used to save the IP address corresponding to the domain name (i.e. each domain name entry corresponds to an IP tree, and the IP tree is used to save the IP address of the domain name indicated by the domain name entry).

[0109] In the embodiment, the historical domain name request message can be obtained, the historical domain name request message carries the alias domain name of the first type of domain name or the alias domain name of the derived domain name matched with the second type of domain name, and then the preset alias domain name tree can be generated based on the alias domain name. The alias domain name tree is used to save the CNAME domain name of the accurate domain name or the derived domain name learned from the DNS report, each CNAME domain name entry maintains a father tree to record which accurate domain name or derived domain name it corresponds to (i.e. each alias domain name entry in the preset alias domain name tree corresponds to a father tree, and the father tree is used to record the father domain name corresponding to the alias domain name indicated by the alias domain name entry), and each father domain name in the father tree corresponds to an IP tree.

[0110] In the embodiment, the precise domain name can be inserted into the configuration domain name table (i.e., the configuration domain name tree) by the configuration management module, and the wildcard domain name can be written into a linked list and compiled into a hyperscan db (i.e., a regular matching library) to improve the speed of the domain name matching of the message analysis module.

[0111] In the embodiment, the domain name matching module can be used for domain name matching. The request domain name can be searched in the configuration domain name table (e.g., the search can be performed by using a red-black tree, which is fast), and then the request domain name can be searched in the hyperscan db to determine whether the request domain name can be matched to the configured wildcard domain name. If the request domain name can be matched to the wildcard domain name, the request domain name is marked as a derivative domain name, and then the request domain name is inserted into the configuration domain name table to improve the subsequent search speed.

[0112] In step S501, the domain name request message sent by the target terminal is received, and the domain name request message is analyzed to obtain an analysis result, wherein the analysis result at least includes the request domain name.

[0113] In the embodiment of the application, the gateway device can receive the domain name request message sent by the target terminal, and analyze the domain name request message to obtain the request domain name.

[0114] Optionally, after the domain name request message is analyzed to obtain the analysis result, the method further includes: in the case that the analysis result further includes an alias record, determining whether the request domain name is matched from the preset configuration domain name tree, wherein the alias record at least includes a multi-level domain name; in the case that the matching is successful, determining whether the multi-level domain name is stored in the preset alias domain name tree; in the case that the multi-level domain name is not stored in the preset alias domain name tree, inserting the multi-level domain name into the preset alias domain name tree, and inserting the request domain name into the father tree of the alias domain name entry represented by the multi-level domain name; updating the survival time of the request domain name to the survival time of the father domain name of the multi-level domain name; or in the case that the multi-level domain name is stored in the preset alias domain name tree, updating the survival time of the request domain name to the survival time of the father domain name of the multi-level domain name.

[0115] In the embodiment of the present application, when it is found that the domain name request message has an alias record (i.e. CNAME record, which records a multi-level domain name), (i.e. in the case that the resolution result also includes an alias record), it can be determined whether the request domain name is matched from the preset configuration domain name tree. If the matching is successful, it can be determined whether the multi-level domain name is stored in the preset alias domain name tree. If the multi-level domain name is not stored in the preset alias domain name tree, the multi-level domain name is inserted into the preset alias domain name tree, and the request domain name is inserted into the father tree of the alias domain name entry represented by the multi-level domain name (i.e. when the request domain name of the message can be matched to the configuration domain name (exact domain name or wildcard domain name), the multi-level domain name is added to the CNAME domain name table, and the request domain name is inserted into the father tree of the multi-level domain name), and then the time to live (TTL) of the request domain name is updated to the TTL of the father domain name of the multi-level domain name. In the case that the multi-level domain name is stored in the preset alias domain name tree, the TTL of the request domain name is updated to the TTL of the father domain name of the multi-level domain name.

[0116] In the embodiment, when the request domain name already exists in the father tree of the multi-level domain name, it can be determined whether the TTL value of the request domain name needs to be increased according to the TTL value (Time To Live, i.e. time to live value) of the CNAME record in the message.

[0117] In the embodiment, it is assumed that the IP address of www.h**s**.com is requested, and the DNS response message has the following CNAME records: host.h**s**.com and hostcdn.h**s**.com, and host.h**s**.com and hostcdn.h**s**.com are called RR domain names (i.e. multi-level domain names). That is,

[0118] www.hh**s**.com CNAME host.h**s**.com;

[0119] host.h**s**.com CNAME hostcdn.h**s**.com.

[0120] Optionally, after determining whether the request domain name is matched from the preset configuration domain name tree, it further includes: in the case that the matching is unsuccessful, determining whether the request domain name is matched from the preset alias domain name tree; in the case that the matching is successful, determining whether the multi-level domain name exists in the preset alias domain name tree; in the case that the multi-level domain name does not exist in the preset alias domain name tree, inserting the multi-level domain name into the preset alias domain name tree, and querying all father domain names of the request domain name from the preset alias domain name tree; adding all father domain names of the request domain name to the father tree of the multi-level domain name; in the case that any target father domain name of the request domain name already exists in the father tree of the multi-level domain name, updating the TTL of the target father domain name based on the TTL of the alias record.

[0121] In the embodiment of the present application, if the request domain name is not matched from the preset configuration domain name tree, it is judged whether the request domain name is matched from the preset alias domain name tree. If the matching is successful, it is judged whether the multi-level domain name exists in the preset alias domain name tree. If the multi-level domain name does not exist in the preset alias domain name tree, the multi-level domain name is inserted into the preset alias domain name tree, and all parent domain names of the request domain name are queried from the preset alias domain name tree. Then, all parent domain names of the request domain name are added to the parent tree of the multi-level domain name (i.e. if the configured domain name exists in the DNS system in the case of CNAME cascade, the multi-level domain name is added to the CNAME domain name table, and all parents of the request domain name are added to the parent tree of the multi-level domain name). Moreover, in the case that any target parent domain name of the request domain name already exists in the parent tree of the multi-level domain name, the time to live of the target parent domain name is updated based on the time to live of the alias record (i.e. if a parent domain name already exists in the parent tree of the multi-level domain name, whether to increase the time to live of the parent domain name is determined according to the time to live of the current CNAME record of the message).

[0122] Optionally, after the domain name request message is parsed to obtain the parsing result, it further includes: in the case that the parsing result further includes the preset record, judging whether the request domain name is matched from the preset configuration domain name tree; in the case that the matching is successful, updating the IP tree of the domain name entry matched with the request domain name; in the case that the matching is not successful, judging whether the request domain name is matched from the preset alias domain name tree; in the case that the request domain name is matched from the preset alias domain name tree, querying all parent domain names of the request domain name from the preset alias domain name tree; traversing all parent domain names, and updating the IP tree of each parent domain name.

[0123] In the embodiment of the present application, if the domain name request message includes the preset record (i.e. A / AAAA record), it is first judged whether the request domain name is matched from the preset configuration domain name tree. When the request domain name is in the configuration domain name tree, the IP tree of the request domain name entry is updated (i.e. in the case that the matching is successful, the IP tree of the domain name entry matched with the request domain name is updated). When the request domain name is in the CNAME domain name tree, the parent tree of the request domain name entry is traversed, and the IP tree of each parent is updated (i.e. in the case that the matching is not successful, it is judged whether the request domain name is matched from the preset alias domain name tree. In the case that the request domain name is matched from the preset alias domain name tree, all parent domain names of the request domain name are queried from the preset alias domain name tree. All parent domain names are traversed, and the IP tree of each parent domain name is updated).

[0124] Optionally, the step of updating the IP tree of the domain name entry matched with the request domain name comprises: judging whether the IP tree exists the current IP address; in the case that the IP tree does not exist the current IP address, inserting the current IP address into the IP tree; in the case that the IP tree exists the current IP address, updating the time to live of the IP address consistent with the current IP address in the IP tree.

[0125] In the embodiment of the present application, the step of updating the IP tree comprises: firstly judging whether the IP tree exists the current IP address; if the IP tree does not exist the current IP address, inserting the current IP address into the IP tree; if the IP tree exists the current IP address, updating the time to live of the IP address consistent with the current IP address in the IP tree.

[0126] Figure 7 is a schematic diagram of an optional updating IP tree process according to the embodiment of the present application, as shown in Figure 7 finding the entry of the request domain name, judging whether the corresponding IP tree exists the current IP address, if yes, updating the time to live of the IP address consistent with the current IP address in the IP tree; otherwise, creating the IP and inserting into the IP tree.

[0127] Figure 8 is a schematic diagram of an optional configuration domain name IP updating module and CNAME domain name father updating module processing process according to the embodiment of the present application, as shown in Figure 8 parsing the request domain name in the domain name request message, judging whether the request domain name matches the configuration domain name / CNAME domain name, if the matching is successful, entering the processing process of the message with A / AAAA record, otherwise, directly ending.

[0128] The processing process of the message with A / AAAA record is as follows: judging whether the response part contains A / AAAA record, if not, directly entering the processing process of the message with CNAME record and the request domain name matching the configuration domain name; otherwise, judging whether the request domain name successfully matches the configuration domain name, if yes, updating the IP tree of the domain name entry matched with the request domain name; if not, judging whether the request domain name successfully matches the CNAME domain name, if the request domain name successfully matches the CNAME domain name, querying all father domain names of the request domain name from the alias domain name tree, traversing all the father domain names, and updating the IP tree of each father domain name; if the request domain name does not successfully match the CNAME domain name, directly entering the processing process of the message with CNAME record and the request domain name matching the configuration domain name.

[0129] If the packet has a CNAME record and the request domain name matches the configuration domain name, the following processing procedure is performed: it is determined whether the response part contains a CNAME record; if not, the processing is ended; otherwise, it is determined whether the request domain name successfully matches the configuration domain name; if the request domain name does not successfully match the configuration domain name, the processing procedure of the packet having a CNAME record and the request domain name matching a CNAME domain name is directly entered; if the request domain name successfully matches the configuration domain name, it is determined whether the multi-level domain name is stored in the alias domain name tree; if the multi-level domain name is stored in the alias domain name tree, the time to live of the request domain name is updated to the time to live of the parent domain name of the multi-level domain name; if the multi-level domain name is not stored in the alias domain name tree, the multi-level domain name is inserted into the alias domain name tree, the request domain name is inserted into the parent tree of the alias domain name entry represented by the multi-level domain name, the time to live of the request domain name is updated to the time to live of the parent domain name of the multi-level domain name, and then the processing procedure of the packet having a CNAME record and the request domain name matching a CNAME domain name is directly entered.

[0130] If the packet has a CNAME record and the request domain name matches a CNAME domain name, the following processing procedure is performed: it is determined whether the request domain name successfully matches the CNAME domain name; if the request domain name successfully matches the CNAME domain name, it is determined whether the multi-level domain name is stored in the alias domain name tree; if the multi-level domain name is stored in the alias domain name tree, all parent domain names of the request domain name are queried from the alias domain name tree, the found parent domain names are traversed, it is determined whether the parent domain name already exists in the parent tree of the multi-level domain name, the time to live of the parent domain name is updated based on the time to live of the alias record if the parent domain name already exists in the parent tree of the multi-level domain name, or the parent domain name is inserted into the parent tree of the multi-level domain name; if the multi-level domain name is not stored in the alias domain name tree, the multi-level domain name is inserted into the alias domain name tree, and then the subsequent flow of querying all parent domain names of the request domain name from the alias domain name tree is performed; if the request domain name does not successfully match the CNAME domain name, the processing is directly ended.

[0131] In step S502, in a case where the request domain name is matched from the preset configuration domain name tree, an IP tree of a domain name entry matched with the request domain name in the preset configuration domain name tree is updated to obtain a first update result.

[0132] In the embodiment of the present application, if the request domain name can be matched to the configuration domain name in the preset configuration domain name tree, the IP address resolved by the DNS server can be updated to the IP tree of the domain name entry matched with the request domain name in the preset configuration domain name tree to obtain a first update result.

[0133] In step S503, in a case where the request domain name is matched from the preset alias domain name tree, a parent tree of an alias domain name entry matched with the request domain name in the preset alias domain name tree is updated, and an IP tree of each parent domain name in the parent tree is updated to obtain a second update result.

[0134] In the embodiment of the present application, if the request domain name can be matched to the alias domain name in the preset alias domain name tree, the request domain name can be updated to the father tree of the matched alias domain name entry, and the IP address resolved by the DNS server can be updated to the IP tree of each father domain name in the father tree, to obtain a second update result. In this way, the resolved IP address corresponding to the request domain name can also correspond to the alias domain name of the request domain name.

[0135] In step S504, in the case that the first update result or the second update result indicates that the IP address corresponding to the request domain name is added in the IP tree, the IP address is returned to the target terminal, wherein the target terminal accesses the server indicated by the request domain name through the IP address.

[0136] In the embodiment of the present application, if the first update result or the second update result indicates that the IP address corresponding to the request domain name is added in the IP tree, the IP address can be returned to the target terminal, and then the target terminal can access the server indicated by the request domain name through the IP address. If the first update result or the second update result indicates that the resolved IP address already exists in the IP tree, the target terminal can directly access the server indicated by the request domain name through the IP address.

[0137] In the embodiment of the present application, in order to reduce the communication amount from the data plane to the control plane, only when the number of IP addresses of the request domain name is newly added, the newly added IP address is notified to the DNSsnpd module through the IP address reporting module, and in order to ensure that the communication amount does not burst, the newly added notification message can be added to a linked list and sent at a limited rate in daily tasks.

[0138] Optionally, in the case that the life time of the IP address of the domain name entry in the preset configuration domain name tree exceeds a first preset threshold, the IP address is aged; in the case that the domain name entry is a derived domain name and all IP addresses in the IP tree corresponding to the derived domain name are aged, the derived domain name is deleted from the preset configuration domain name tree; in the case that the life time of the father domain name of the alias domain name entry in the preset alias domain name tree exceeds a second preset threshold, the father domain name is aged; in the case that all father domain names in the father tree corresponding to the alias domain name entry are aged, the alias domain name entry is deleted from the preset alias domain name tree.

[0139] In the embodiment of the present application, the aging of the configuration domain name tree and the aging of the father in the CNAME domain name tree can be performed through the aging module.

[0140] For the aging of the configuration domain name tree, in the daily task, the IP address of each entry in the configuration domain name tree can be aged, and the aging time depends on the TTL value of the IP address (i.e. in the case that the survival time of the IP address of the domain name entry in the preset configuration domain name tree exceeds a first preset threshold, the IP address is aged), when the IP address is aged, an aging message is reported to the DNSsnpd module, and the DNSsnpd module notifies the upper-layer registration module concerned after receiving the message.

[0141] In the embodiment, when all IP addresses of a derivative domain name have been aged, the derivative domain name is deleted from the configuration domain name tree (i.e. in the case that the domain name entry is a derivative domain name, and all IP addresses in the IP tree corresponding to the derivative domain name have been aged, the derivative domain name is deleted from the preset configuration domain name tree), in addition, the accurate domain name entry will not be aged.

[0142] For the aging of the father in the CNAME domain name tree, in the daily task, the father of each entry in the CNAME domain name tree can be aged, and the aging time depends on the TTL value of the father (i.e. in the case that the survival time of the father domain name of the alias domain name entry in the preset alias domain name tree exceeds a second preset threshold, the father domain name is aged), when all fathers of an entry have been aged, the entry is deleted from the CNAME domain name tree (i.e. in the case that all father domain names in the father tree corresponding to the alias domain name entry have been aged, the alias domain name entry is deleted from the preset alias domain name tree).

[0143] The gateway device proposed in the embodiment can also be used for distributed processing, Figure 9 is a schematic diagram of an optional distributed processing flow according to an embodiment of the present application, as shown, comprising a plurality of service cards and a master control card, wherein the service card comprises DNS snooping, and the master control card comprises an upper-layer module, DNSsnpd and DNS snooping. Figure 9

[0144] When the gateway device has a plurality of service cards, the service card is only responsible for resolving the passing DNS response message (such as 1 w.a.com IP? in Figure 9 , and reporting the IP address and CNAME domain name of the request domain name that can be matched to the wildcard domain name existing in the configuration domain name table / CNAME domain name table to the master control card (such as 2 w.a.com CNAME w.c.com and 4 w.c.com 1.2.3.4 in Figure 9 ); the master control card completes the update of the IP tree in the configuration domain name table, the update of the father tree in the CNAME domain name table, and the message reporting to the DNSsnpd. ​

[0145] In addition, in order to enable all service cards to focus on the CNAME domain name, when the master card first receives the CNAME domain name reported by a single service card, the CNAME domain name (carrying a TTL value) is sent to all service cards, so as to inform all service cards to focus on the IP address of the CNAME domain name, the CNAME domain name (such as 3 w.c.com parent w.a.com in the above table), and when the master card finds that the TTL of the CNAME domain name is changed, a broadcast message is sent to all service cards. In addition, in order to reduce unnecessary messages between the master card and the service card, each service card ages the entry in the CNAME domain name tree according to the TTL value of the CNAME domain name. Figure 9

[0146] In the embodiment, when one domain name exists in the following three CNAME cases, the gateway device in the embodiment can solve the cases.

[0147] (1) Multiple configured domain names are CNAME pointed to the same CNAME domain name.

[0148] When the mapping relationship between the domain name 1 and the CNAME domain name is parsed through the DNS response message, the domain name 1 is added to the parent tree of the CNAME domain name, and when the mapping relationship between the domain name 2 and the CNAME domain name is parsed, the domain name 2 is also added to the parent tree of the CNAME domain name. When the CNAME domain name finds the IP address, the IP address is notified to the domain names 1 and 2 by traversing the parent tree.

[0149] (2) The configured domain name exists CNAME cascade.

[0150] When the domain name exists CNAME cascade, for example:

[0151] A CNAME C1; C1 CNAME C2; C2 A IP1;

[0152] C1 and C2 are added to the CNAME domain name tree, and the parent tree of C1 and C2 has A, and when C1 or C2 finds the IP address, the IP address is notified to A.

[0153] (3) The configured domain name corresponds to multiple CNAMEs. For example:

[0154] A CNAME C1; A CNAME C2;

[0155] C1 and C2 are added to the CNAME domain name tree, and the parent tree of C1 and C2 has A, and when C1 or C2 finds the IP address, the IP address is notified to A.

[0156] The following is described in combination with an application scenario.​

[0157] Figure 10 is a schematic diagram of an optional application scenario according to an embodiment of the application, as shown in Figure 10 When a user accesses a service server through a firewall, multiple links (for example, link1, link2, etc.) can be selected, and the user wants to access traffic of *.test.com through link1. The firewall is configured with a policy-based routing (namely, a PBR module), and the purpose is to guide traffic to *.test.com to link1. When the user initiates access to *.test.com, DNS traffic passes through the firewall, a DNS server detects a DNS response message, obtains an IP of *.test.com and saves a mapping relationship, and returns the IP to the PBR module. After the user obtains the IP, when the user accesses the service server using the IP, the policy-based routing is matched, and the traffic is guided to link1.

[0158] In the embodiment of the application, a method for processing traffic of configured domain names for a gateway device is provided. When a network administrator wants to process traffic of certain domain names, the network administrator does not need to care about domain name mapping relationships inside a DNS system, and only needs to configure domain names exposed to the outside by the DNS system. Furthermore, by analyzing a DNS response message, a CNAME of a configured domain name is learned, and when an IP address is obtained by the CNAME, the mapping relationship between the IP address and the configured domain name is notified to a service module. Meanwhile, when multiple configured domain names are pointed to a same CNAME domain name, the configured domain names have CNAME cascades, or the configured domain names correspond to multiple CNAMES, the method can also work well. In addition, the method can also support a distributed system.

[0159] The following will be described in detail with reference to another embodiment. Embodiment

[0160] The domain name resolution device based on a gateway device provided in the embodiment includes a plurality of implementation units, and each implementation unit corresponds to each implementation step in the above-described embodiment one.

[0161] Figure 11 is a schematic diagram of an optional domain name resolution device based on a gateway device according to an embodiment of the application, as shown in Figure 11 The resolution device can include a resolution unit 110, a first updating unit 111, a second updating unit 112, and a returning unit 113, wherein

[0162] The resolution unit 110 is configured to receive a domain name request message sent by a target terminal, and analyze the domain name request message to obtain a resolution result, wherein the resolution result at least includes a request domain name.

[0163] The first updating unit 111 is configured to update an IP tree of a domain name entry matched with the request domain name in the preset configuration domain name tree to obtain a first updating result in a case that the request domain name is matched from the preset configuration domain name tree.

[0164] The second updating unit 112 is configured to update a father tree of an alias domain name entry matched with the request domain name in the preset alias domain name tree and update an IP tree of each father domain name in the father tree to obtain a second updating result in a case that the request domain name is matched from the preset alias domain name tree.

[0165] The returning unit 113 is configured to return the IP address to the target terminal in a case that the first updating result or the second updating result indicates that the IP address corresponding to the request domain name is added on the IP tree, where the target terminal accesses a server indicated by the request domain name through the IP address.

[0166] The above analysis device can receive a domain name request message sent by a target terminal through the analysis unit 110 and analyze the domain name request message to obtain an analysis result. The first updating unit 111 updates an IP tree of a domain name entry matched with the request domain name in the preset configuration domain name tree to obtain a first updating result in a case that the request domain name is matched from the preset configuration domain name tree. Alternatively, the second updating unit 112 updates a father tree of an alias domain name entry matched with the request domain name in the preset alias domain name tree and updates an IP tree of each father domain name in the father tree to obtain a second updating result in a case that the request domain name is matched from the preset alias domain name tree. The returning unit 113 returns the IP address to the target terminal in a case that the first updating result or the second updating result indicates that the IP address corresponding to the request domain name is added on the IP tree. In the embodiment of the present application, the analyzed request domain name can be matched with domain names in the preset configuration domain name tree first. After the matching succeeds, the IP address resolved by the DNS server can be updated to the IP tree of the domain name entry matched with the request domain name in the preset configuration domain name tree. If the request domain name is matched with domain names in the preset alias domain name tree successfully, the request domain name is updated to the father tree of the matched alias domain name entry, and the IP address resolved by the DNS server is updated to the IP tree of each father domain name in the father tree. The IP address corresponding to the request domain name can also correspond to the alias domain name of the request domain name, so that the target terminal can automatically access the corresponding server by using the added IP address, thereby solving the technical problem that the corresponding server cannot be automatically accessed by the gateway device when the request domain name has the alias domain name in the related art.

[0167] Optionally, the resolving apparatus further comprises: a first receiving module, configured to receive a domain name registration request sent by the target terminal before receiving the domain name request message sent by the target terminal, wherein the domain name registration request comprises: a domain name to be registered, an IP address type, and a terminal identifier; a first responding module, configured to respond to the domain name registration request and register the domain name to be registered; and a first representing module, configured to represent the domain name to be registered as a request domain name in a case where the domain name to be registered is successfully registered.

[0168] Optionally, the resolving apparatus further comprises: a first configuring module, configured to configure a first type of domain name and a second type of domain name before receiving the domain name request message sent by the target terminal; a first generating module, configured to generate a preset configuration domain name tree based on the first type of domain name and the second type of domain name, wherein a domain name entry in the preset configuration domain name tree is the first type of domain name or a derivative domain name matched with the second type of domain name, and each domain name entry corresponds to an IP tree used for storing an IP address of a domain name indicated by the domain name entry; a first obtaining module, configured to obtain a historical domain name request message, wherein the historical domain name request message carries an alias domain name of the first type of domain name or an alias domain name of a derivative domain name matched with the second type of domain name; and a second generating module, configured to generate a preset alias domain name tree based on the alias domain name, wherein an alias domain name entry in the preset alias domain name tree corresponds to a father tree used for recording a father domain name corresponding to the alias domain name indicated by the alias domain name entry, and each father domain name in the father tree corresponds to an IP tree.

[0169] Optionally, the resolving apparatus further comprises: a first judging module, configured to judge whether the request domain name is matched from the preset configuration domain name tree in a case where the resolving result further comprises an alias record after resolving the domain name request message and obtaining the resolving result, wherein the alias record at least comprises: a multi-level domain name; a second judging module, configured to judge whether the multi-level domain name is stored in the preset alias domain name tree in a case where the matching is successful; a first inserting module, configured to insert the multi-level domain name into the preset alias domain name tree and insert the request domain name into a father tree of an alias domain name entry represented by the multi-level domain name in a case where the multi-level domain name is not stored in the preset alias domain name tree; a first updating module, configured to update a time to live of the request domain name to a time to live of a father domain name of the multi-level domain name; and a second updating module, configured to update the time to live of the request domain name to the time to live of the father domain name of the multi-level domain name in a case where the multi-level domain name is stored in the preset alias domain name tree.

[0170] Optionally, the resolving device further comprises: a third judging module, configured to, after judging whether the request domain name is matched from the preset configuration domain name tree, judge whether the request domain name is matched from the preset alias domain name tree in case of unsuccessful matching; a fourth judging module, configured to, in case of successful matching, judge whether the multi-level domain name exists in the preset alias domain name tree; a second inserting module, configured to, in case that the multi-level domain name does not exist in the preset alias domain name tree, insert the multi-level domain name into the preset alias domain name tree, and query all parent domain names of the request domain name from the preset alias domain name tree; a first adding module, configured to add all parent domain names of the request domain name to the parent tree of the multi-level domain name; and a third updating module, configured to, in case that any target parent domain name of the request domain name already exists in the parent tree of the multi-level domain name, update the time to live of the target parent domain name based on the time to live of the alias record.

[0171] Optionally, the resolving device further comprises: a fifth judging module, configured to, after resolving the domain name request message and obtaining the resolving result, judge whether the request domain name is matched from the preset configuration domain name tree in case that the resolving result further comprises a preset record; a fourth updating module, configured to, in case of successful matching, update the IP tree of the domain name entry matched with the request domain name; a sixth judging module, configured to, in case of unsuccessful matching, judge whether the request domain name is matched from the preset alias domain name tree; a first querying module, configured to, in case that the request domain name is matched from the preset alias domain name tree, query all parent domain names of the request domain name from the preset alias domain name tree; and a fifth updating module, configured to traverse all the parent domain names and update the IP tree of each parent domain name.

[0172] Optionally, the fourth updating module comprises: a first judging submodule, configured to judge whether the IP tree exists the current IP address; a first inserting submodule, configured to, in case that the IP tree does not exist the current IP address, insert the current IP address into the IP tree; and a first updating submodule, configured to, in case that the IP tree exists the current IP address, update the time to live of the IP address consistent with the current IP address in the IP tree.

[0173] Optionally, the resolving device further comprises: a first processing module, configured to, in case that the time to live of the IP address of the domain name entry in the preset configuration domain name tree exceeds a first preset threshold, perform aging processing on the IP address; a first deleting module, configured to, in case that the domain name entry is a derivative domain name and all IP addresses in the IP tree corresponding to the derivative domain name are aged, delete the derivative domain name from the preset configuration domain name tree; a second processing module, configured to, in case that the time to live of the parent domain name of the alias domain name entry in the preset alias domain name tree exceeds a second preset threshold, perform aging processing on the parent domain name; and a second deleting module, configured to, in case that all parent domain names in the parent tree corresponding to the alias domain name entry are aged, delete the alias domain name entry from the preset alias domain name tree.

[0174] The analysis device can further include a processor and a memory, and the analysis unit 110, the first updating unit 111, the second updating unit 112, and the returning unit 113 are stored in the memory as program units, and the corresponding functions are realized by the processor executing the program units stored in the memory.

[0175] The processor includes a core, and the core calls the corresponding program units in the memory. The core can be one or more, and the IP address is returned to the target terminal by adjusting the core parameters in the case that the first updating result or the second updating result indicates that the IP address corresponding to the request domain name is added on the IP tree.

[0176] The memory can include a non-permanent memory in a computer readable medium, a random access memory (RAM), and / or a non-volatile memory such as a read-only memory (ROM) or a flash memory (flash RAM), and the memory includes at least one memory chip.

[0177] The application also provides a computer program product adapted to execute the program of the following method steps when executed on a data processing device: receiving a domain name request message sent by a target terminal, and analyzing the domain name request message to obtain an analysis result, updating an IP tree of a domain name entry matched with the request domain name in a preset configuration domain name tree to obtain a first updating result in the case that the request domain name is matched from the preset configuration domain name tree, or updating a father tree of an alias domain name entry matched with the request domain name in a preset alias domain name tree and updating an IP tree of each father domain name in the father tree to obtain a second updating result in the case that the request domain name is matched from the preset alias domain name tree, and returning an IP address to the target terminal in the case that the first updating result or the second updating result indicates that the IP address corresponding to the request domain name is added on the IP tree.

[0178] According to another aspect of the embodiments of the application, an electronic device is also provided, which includes one or more processors and a memory, and the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned gateway device-based domain name analysis method.

[0179] The above-mentioned serial numbers of the embodiments of the application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0180] In the above-mentioned embodiments of the application, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0181] In several embodiments provided in the present application, it should be understood that the disclosed technology can be implemented by other means. Among them, the above-mentioned device embodiments are only schematic, for example, the division of the units can be a logical function division, and actual implementation can have another division mode, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be through some interface, indirect coupling or communication connection between units or modules, which can be electrical or other forms.

[0182] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or they can be distributed to multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0183] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically, or two or more units can be integrated into one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0184] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0185] The above is only the preferred embodiment of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.

Claims

1. A gateway device-based domain name resolution method, characterized by, The method comprises the following steps: receiving a domain name request message sent by a target terminal, and parsing the domain name request message to obtain a parsing result, wherein the parsing result at least comprises a request domain name; in a case where the request domain name is matched from a preset configuration domain name tree, updating an IP tree of a domain name entry in the preset configuration domain name tree matched with the request domain name to obtain a first update result; or in a case where the request domain name is matched from a preset alias domain name tree, updating a father tree of an alias domain name entry in the preset alias domain name tree matched with the request domain name, and updating an IP tree of each father domain name in the father tree to obtain a second update result; in a case where the first update result or the second update result indicates that an IP address corresponding to the request domain name is added on the IP tree, returning the IP address to the target terminal, wherein the target terminal accesses a server indicated by the request domain name through the IP address.

2. The resolution method according to claim 1, wherein, Before receiving the domain name request message sent by the target terminal, the method further comprises the following steps: receiving a domain name registration request sent by the target terminal, wherein the domain name registration request comprises a to-be-registered domain name, an IP address type and a terminal identifier; in response to the domain name registration request, registering the to-be-registered domain name; in a case where the to-be-registered domain name is successfully registered, representing the to-be-registered domain name as the request domain name.

3. The resolution method according to claim 1, wherein, Before receiving the domain name request message sent by the target terminal, the method further comprises the following steps: configuring a first type of domain name and a second type of domain name; generating a preset configuration domain name tree based on the first type of domain name and the second type of domain name, wherein a domain name entry in the preset configuration domain name tree is the first type of domain name or a derived domain name matched with the second type of domain name, each domain name entry corresponds to an IP tree, and the IP tree is used to save an IP address of a domain name indicated by the domain name entry; obtaining a historical domain name request message, wherein the historical domain name request message carries an alias domain name of the first type of domain name or a derived domain name matched with the second type of domain name; generating a preset alias domain name tree based on the alias domain name, wherein an alias domain name entry in the preset alias domain name tree corresponds to a father tree, the father tree is used to record a father domain name corresponding to the alias domain name indicated by the alias domain name entry, and each father domain name in the father tree corresponds to an IP tree.

4. The resolution method according to claim 1, wherein, After parsing the domain name request message to obtain a parsing result, the method further comprises the following steps: in a case where the parsing result further comprises an alias record, judging whether the request domain name is matched from the preset configuration domain name tree, wherein the alias record at least comprises a multi-level domain name; in a case where the multi-level domain name is stored in the preset alias domain name tree, inserting the multi-level domain name into the preset alias domain name tree, and inserting the request domain name into a father tree of an alias domain name entry represented by the multi-level domain name; updating a time to live of the request domain name to a time to live of a father domain name of the multi-level domain name; or ​ In the case that the multi-level domain name is stored in the preset alias domain name tree, the time to live of the request domain name is updated as the time to live of the parent domain name of the multi-level domain name.

5. The resolution method according to claim 4, wherein, After judging whether the request domain name is matched from the preset configuration domain name tree, further comprising: In the case that the matching is unsuccessful, judging whether the request domain name is matched from the preset alias domain name tree; In the case that the matching is successful, judging whether the multi-level domain name exists in the preset alias domain name tree; In the case that the multi-level domain name does not exist in the preset alias domain name tree, inserting the multi-level domain name into the preset alias domain name tree, and querying all parent domain names of the request domain name from the preset alias domain name tree; Adding all the parent domain names of the request domain name to the parent tree of the multi-level domain name; In the case that any target parent domain name of the request domain name already exists in the parent tree of the multi-level domain name, updating the time to live of the target parent domain name based on the time to live of the alias record.

6. The resolution method of claim 1, wherein, After parsing the domain name request message to obtain a parsing result, further comprising: In the case that the parsing result further comprises a preset record, judging whether the request domain name is matched from the preset configuration domain name tree; In the case that the matching is successful, updating the IP tree of the domain name entry matched with the request domain name; In the case that the matching is unsuccessful, judging whether the request domain name is matched from the preset alias domain name tree; In the case that the request domain name is matched from the preset alias domain name tree, querying all parent domain names of the request domain name from the preset alias domain name tree; Traversing the all parent domain names, and updating the IP tree of each parent domain name.

7. The resolution method according to claim 6, wherein, The step of updating the IP tree of the domain name entry matched with the request domain name comprises: Judging whether the IP tree exists a current IP address; In the case that the IP tree does not exist the current IP address, inserting the current IP address into the IP tree; In the case that the IP tree exists the current IP address, updating the time to live of the IP address consistent with the current IP address in the IP tree.

8. The resolution method according to claim 3, wherein, Further comprising: In the case that the time to live of the IP address of the domain name entry in the preset configuration domain name tree exceeds a first preset threshold, performing aging processing on the IP address; In the case that the domain name entry is the derivative domain name, and all IP addresses in the IP tree corresponding to the derivative domain name are all aged, deleting the derivative domain name from the preset configuration domain name tree; In the case that the time to live of the parent domain name of the alias domain name entry in the preset alias domain name tree exceeds a second preset threshold, performing aging processing on the parent domain name; In the case that all parent domain names in the parent tree corresponding to the alias domain name entry are all aged, deleting the alias domain name entry from the preset alias domain name tree.

9. A gateway device based domain name resolution apparatus, characterized by, Comprising: A parsing unit, configured to receive a domain name request message sent by a target terminal, and parse the domain name request message to obtain a parsing result, wherein the parsing result at least comprises a request domain name; The first updating unit is configured to, in a case where the request domain name is matched from the preset configuration domain name tree, update an IP tree of a domain name entry matched with the request domain name in the preset configuration domain name tree to obtain a first updating result; or The second updating unit is configured to, in a case where the request domain name is matched from the preset alias domain name tree, update a father tree of an alias domain name entry matched with the request domain name in the preset alias domain name tree, and update an IP tree of each father domain name in the father tree to obtain a second updating result. The returning unit is configured to, in a case where the first updating result or the second updating result indicates that an IP address corresponding to the request domain name is added on the IP tree, return the IP address to the target terminal, where the target terminal accesses a server indicated by the request domain name through the IP address.

10. An electronic device, comprising: The apparatus includes one or more processors and memory storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the gateway device-based domain name resolution method of any one of claims 1 to 8.

Citation Information

Patent Citations

  • Domain name hijacking protection processing method and device

    CN108243051A

  • Domain name resolution method and device

    CN110933156A