CN108924274B - Domain name system DNS processing method and device, storage medium and electronic equipment - Google Patents

Domain name system DNS processing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN108924274B
CN108924274B CN201811075473.2A CN201811075473A CN108924274B CN 108924274 B CN108924274 B CN 108924274B CN 201811075473 A CN201811075473 A CN 201811075473A CN 108924274 B CN108924274 B CN 108924274B
Authority
CN
China
Prior art keywords
network
dns
address
domain name
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811075473.2A
Other languages
Chinese (zh)
Other versions
CN108924274A (en
Inventor
雷辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201811075473.2A priority Critical patent/CN108924274B/en
Publication of CN108924274A publication Critical patent/CN108924274A/en
Application granted granted Critical
Publication of CN108924274B publication Critical patent/CN108924274B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4552Lookup mechanisms between a plurality of directories; Synchronisation of directories, e.g. metadirectories

Abstract

The embodiment of the application discloses a domain name system DNS processing method, a domain name system DNS processing device, a storage medium and electronic equipment. According to the embodiment of the application, when a DNS query request aiming at a target domain name is detected in a state that electronic equipment is accessed to a wireless network, first power forming for DNS query through the wireless network is obtained; if the first forming power does not reach the preset threshold value, sending a DNS query request to a corresponding DNS server through an accessed data network; receiving a query result returned by the DNS server according to the DNS query request, wherein the query result comprises at least one target IP address corresponding to a target domain name; the destination IP address is stored in the electronic device. According to the scheme, when the DNS query cannot be performed in a wireless network state, the data network is pulled up to execute the DNS query operation, so that the overall success rate of the DNS query is improved, the electronic equipment can surf the internet normally, and the network access efficiency is improved.

Description

Domain name system DNS processing method and device, storage medium and electronic equipment
Technical Field
The present application relates to the field of communications technologies, and in particular, to a domain name system DNS processing method and apparatus, a storage medium, and an electronic device.
Background
The DNS (Domain Name System) is a distributed database on the Internet as a mapping between a Domain Name and an IP address, and a process of mapping a Domain Name to an IP address is called "Domain Name resolution". The domain name resolution needs to be completed by a special domain name resolution server, and the DNS is a server for domain name resolution. When a user inputs a DNS domain name in an application, the DNS server can resolve the domain name into an IP address corresponding to the domain name, and the user can finally surf the internet only through the IP address pointed by the domain name.
However, in the related art, DNS resolution is inefficient. For example, in a Wireless Fidelity (Wi-Fi) network, because a DNS server of the Wi-Fi network is configured incorrectly or stops working, DNS query of the Wi-Fi network fails, and normal internet access through the Wi-Fi network is not possible.
Disclosure of Invention
The embodiment of the application provides a domain name system DNS processing method, a domain name system DNS processing device, a storage medium and electronic equipment, and the efficiency of network access can be improved.
In a first aspect, an embodiment of the present application provides a domain name system DNS processing method, including:
when detecting a DNS query request aiming at a target domain name in a state that an electronic device is accessed to a wireless network, acquiring first success power for DNS query through the wireless network, wherein the first success power is obtained based on information about success or failure of DNS query through the wireless network in a historical time period;
if the first forming power does not reach a preset threshold value, sending the DNS query request to a corresponding DNS server through an accessed data network;
receiving a query result returned by the DNS server according to the DNS query request, wherein the query result comprises at least one target IP address corresponding to the target domain name;
storing the target IP address in the electronic device.
In a second aspect, an embodiment of the present application provides a domain name system DNS processing apparatus, including:
the detection module is used for acquiring first success power of DNS query through the wireless network when a DNS query request aiming at a target domain name is detected in the state that the electronic equipment is accessed to the wireless network, wherein the first success power is obtained based on the information of success or failure of DNS query through the wireless network in a historical time period;
the first sending module is used for sending the DNS query request to a corresponding DNS server through an accessed data network if the first success rate does not reach a preset threshold value;
a receiving module, configured to receive a query result returned by the DNS server according to the DNS query request, where the query result includes at least one target IP address corresponding to the target domain name;
and the storage module is used for storing the target IP address in the electronic equipment.
In a third aspect, a storage medium provided in an embodiment of the present application has a computer program stored thereon, and when the computer program runs on a computer, the computer is caused to execute a domain name system DNS processing method provided in any embodiment of the present application.
In a fourth aspect, an electronic device provided in an embodiment of the present application includes a processor and a memory, where the memory has a computer program, and the processor is configured to execute the domain name system DNS processing method provided in any embodiment of the present application by calling the computer program.
According to the scheme, when the DNS query cannot be performed in a wireless network state, the data network is pulled up to perform the DNS query operation so as to improve the overall success rate of the DNS query, and the network access can be performed based on the IP address information in the DNS query result, so that the electronic equipment can surf the internet normally, and the network access efficiency is improved.
Drawings
The technical solution and other advantages of the present application will become apparent from the detailed description of the embodiments of the present application with reference to the accompanying drawings.
Fig. 1 is a flowchart illustrating a domain name system DNS processing method according to an embodiment of the present application.
Fig. 2 is another schematic flow chart of a domain name system DNS processing method according to an embodiment of the present application.
Fig. 3 is a schematic structural diagram of a domain name system DNS processing apparatus according to an embodiment of the present application.
Fig. 4 is another schematic structural diagram of a domain name system DNS processing apparatus according to an embodiment of the present application.
Fig. 5 is a schematic structural diagram of a domain name system DNS processing apparatus according to an embodiment of the present application.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Fig. 7 is another schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description is based on illustrated embodiments of the application and should not be taken as limiting the application with respect to other embodiments that are not detailed herein. The term "module" as used herein may be considered a software object executing on the computing system. The various modules, engines, and services herein may be considered as objects of implementation on the computing system.
An execution main body of the domain name system DNS processing method may be the domain name system DNS processing apparatus provided in the embodiment of the present application, or an electronic device integrated with the domain name system DNS processing apparatus, where the domain name system DNS processing apparatus may be implemented in a hardware or software manner. The electronic device may be a smart phone, a tablet computer, a Personal Digital Assistant (PDA), or the like.
The following is a detailed description of the analysis.
An embodiment of the present application provides a domain name system DNS processing method, as shown in fig. 1, fig. 1 is a schematic flow diagram of the domain name system DNS processing method provided in the embodiment of the present application, and the domain name system DNS processing method may include the following steps:
101. when a DNS query request aiming at a target domain name is detected in a state that electronic equipment is accessed to a wireless network, first success power of DNS query through the wireless network is obtained, wherein the first success power is obtained based on information about success or failure of DNS query through the wireless network in a historical time period.
The Domain Name (Domain Name), abbreviated as Domain Name or network Domain, is a Name of a computer or a group of computers on the internet, which is composed of a string of names separated by points, and is used for identifying the electronic position or geographical location of the computer during data transmission. For example, the domain name may be www.1234567.com.cn. The DNS is a distributed database on the world wide web as a mapping between a domain name and an IP address, which enables a user to access the internet more conveniently, and is a server for converting the domain name and the IP address corresponding to the domain name. The DNS stores a table of domain names and IP addresses corresponding thereto to resolve the domain name of the message. The process of finally obtaining the IP address corresponding to the domain name through the domain name is called domain name resolution (or host name resolution).
Specifically, the DNS query request may be a query instruction initiated by an application installed in the electronic device to a corresponding DNS server for a target domain name, so as to obtain a DNS resolution result including an IP address of the target domain name.
In the embodiment of the application, the first success rate can be obtained based on the information about whether the DNS query is successful or not through a wireless network (e.g., a Wi-Fi network) within the historical time period. For example, taking an example that a system installed in the electronic device is an android system, the android system itself has a module for counting a DNS query success rate. Specifically, the module may be a module specially used for sending a DNS message, and if a DNS response message is not received within 5s, the DNS query is considered to be failed at this time, and if 10 consecutive DNS messages within a preset time have no response, the success rate of the DNS query is considered to be 0, so that it is determined that the DNS server has a problem and cannot normally resolve the DNS.
102. And if the first power does not reach the preset threshold value, sending a DNS query request to a corresponding DNS server through the accessed data network.
It should be noted that the preset threshold may be set by a person skilled in the art or a product manufacturer according to actual requirements, for example, the preset threshold may be 0%, 5%, 10%, etc., and this is not specifically limited in this application.
In a specific implementation process, when the first success rate does not reach the preset threshold, the data network may be pulled up (at this time, the wireless network is not disconnected), and an IP packet filtering system (such as an Iptables command) is used to control all DNS query requests to be sent out from the data network, so as to execute DNS query operation for a target domain name through a DNS server corresponding to the data network.
It should be noted that, in the embodiment of the present application, the wireless network and the data network are both in a connected state, and only one path of data is selectively selected from the wireless network and the data network to be sent.
In some embodiments, the DNS query request includes a DNS message, and the step "sending the DNS query request to a corresponding DNS server through an accessed data network" may include the following steps:
acquiring a network identifier of an accessed data network and a matched IP address of a DNS server matched with the network identifier;
modifying the network configuration parameters of the DNS message into the network identifier;
modifying the address of the receiving end of the DNS message into the matched IP address;
and sending the DNS message to the corresponding DNS server based on the network identifier and the matched IP address.
The DNS message is divided into five segments, which are a header (header), a question to be queried (query), a response of the server (answer), an authority response (authority), and additional information (additional). The header section defines whether the message is a request or a response, and also defines whether other sections need to exist, and whether the sections need to be subjected to standard query or other conditions; the query section describes the question of the query, including the query type, the query class, and the domain name of the query.
Taking an iptables command as an example, the iptables command configuration is used, the DNS message (the message with the destination port of 53) is matched, and the DNS message is set to the network identifier netid of the data network (after each network is pulled up, one netid is in the android system, and when the data message is set to the netid of a certain network, the external network can be accessed from the network). Assuming that the network identifier netid of the data network is 0x064 and the DNS server allocated to the data network is 10.10.10.1, the following rule may be configured to let the DNS packet go out of the data network and access the DNS server of the data network:
the DNS packet is marked as a network identity netid of the data network, so that the DNS query is forwarded from the data network, which is set as follows:
iptables-mangle-A OUTPUT-p udp--dport 53-j MARK--set-mark 0x064
the destination IP addresses of the DNS messages are all converted into DNS servers (10.10.10.1) allocated by the data network, so that the DNS server inquired by the data network becomes a DNS server of the data network matched in advance. Because the DNS servers of the wireless network and the data network are not shared, the wireless network uses the DNS server of the wireless network, the data network uses the DNS server of the data network, and the DNS server of the wireless network may not be accessible from the data network because the DNS server of the system by default is the DNS server of the wireless network, the DNS server on the side of the data network needs to be queried. The settings were as follows:
iptables-t nat-A OUTPUT-p udp--dport 53-j DNAT--to-destination10.10.10.1
in some embodiments, the data network is pulled up for DNS query access only when the DNS query success rate of the data network is greater than the DNS query success rate of the wireless network. That is, before sending the DNS query request to the corresponding DNS server through the accessed data network, the following process may be further included:
acquiring second power consumption for performing DNS query through the data network, wherein the second power consumption is obtained based on information about success or failure of DNS query through the data network in historical time periods;
judging whether the second power forming rate is larger than the first power forming rate;
and if so, executing a step of sending a DNS query request to a corresponding DNS server through the accessed data network.
The second power generation may refer to the above calculation method of the first power generation, which is not described again.
103. And receiving a query result returned by the DNS server according to the DNS query request, wherein the query result comprises at least one target IP address corresponding to the target domain name.
Specifically, the DNS server is a DNS server matched to the data network. The DNS server may analyze a DNS request packet in the received DNS query request, thereby obtaining an IP address corresponding to the target domain name.
104. The destination IP address is stored in the electronic device.
Specifically, a target IP address corresponding to a target domain name obtained through DNS query is stored in the electronic device. Although the user does not access the target domain name at this time, the IP address corresponding to the target domain name (for example, a website that the user often needs to access) can be stored, so that the user can directly use the IP address when needing to access, and the user does not need to acquire the IP address when sending an access instruction, which greatly increases the response time of the user.
In some embodiments, after the target IP address is stored in the electronic device, a target network corresponding to the target IP address may also be accessed through the wireless network. At this time, if the wireless network is closed, all network accesses use the data network, and the consumed flow is very large, so that only the DNS message is queried through the data network, and other internet access requests are executed by using the wireless network, which can save the data flow and reduce the user cost.
In some embodiments, if a target network corresponding to a target IP address needs to be accessed through a line network, it needs to be determined that a wireless network is in a connected state, and only a corresponding DNS configuration or DNS server has a problem. That is, before accessing the target network corresponding to the target IP address through the wireless network, the following process may be further included:
sending a first data packet with a preset size to a network corresponding to a preset IP address through a wireless network;
judging whether a second data packet with a preset size returned by the network corresponding to the preset IP address is received or not;
and if so, executing a step of accessing a target network corresponding to the target IP address through the wireless network.
The preset IP address may be an IP address of a public network.
Specifically, when it is determined that the DNS query success rate corresponding to the wireless network is lower than the preset threshold, several ping messages for testing network connectivity are sent by the ping module of the wireless network to ping the IP address of the external network (e.g., 8.8.8.8, 114.114.114.114, etc.). If the ping server is up, the wireless network is considered to be problematic only for DNS queries.
For example, an Internet Control Message Protocol (ICMP) message is sent by an application ping, and is mainly used for testing the connectivity of the network, and if the network is unblocked, the returned information is Request from. However, there is a special case that: if the machine of the counterpart server turns off the ping service (including ping input and ping output), and the counterpart server is disconnected from the external network, the machine cannot ping it even if the machine is connected to the network.
In some embodiments, if a second data packet with a preset size returned by the network corresponding to the preset IP address is not received, it is determined that the wireless network connectivity is failed. At this time, the process may be ended, and information of network connectivity failure may be fed back to the electronic device.
In some embodiments, when it is determined that the wireless network connectivity fails, the target network corresponding to the target IP address may also be accessed through the data network. That is, when the connection of the wireless network fails to be smooth, the data network is selected to access the network server corresponding to the target IP address.
As can be seen from the above, in the domain name system DNS processing method provided in this embodiment, when detecting a DNS query request for a target domain name in a state where an electronic device is accessed to a wireless network, first success power for performing DNS query through the wireless network is obtained; if the first forming power does not reach the preset threshold value, sending a DNS query request to a corresponding DNS server through an accessed data network; receiving a query result returned by the DNS server according to the DNS query request, wherein the query result comprises at least one target IP address corresponding to a target domain name; the destination IP address is stored in the electronic device. According to the scheme, when the DNS query cannot be performed in a wireless network state, the data network is pulled up to execute the DNS query operation, so that the overall success rate of the DNS query is improved, the electronic equipment can surf the internet normally, and the network access efficiency is improved.
The method described in the above embodiments is further illustrated in detail by way of example.
Referring to fig. 2, fig. 2 is another schematic flow chart of a domain name system DNS processing method according to an embodiment of the present application.
Specifically, the domain name system DNS processing method may include the following steps:
201. when a DNS query request aiming at a target domain name is detected in a state that the electronic equipment is accessed to a wireless network, first success power for DNS query through the wireless network is obtained.
Specifically, the DNS query request may be a query instruction initiated by an application installed in the electronic device to a corresponding DNS server for a target domain name, so as to obtain a DNS resolution result including an IP address of the target domain name.
In the embodiment of the application, the first success rate can be obtained based on the information about whether the DNS query is successful or not through a wireless network (e.g., a Wi-Fi network) within the historical time period. For example, taking an example that a system installed in the electronic device is an android system, the android system has a module for counting a DNS query success rate, so as to count the success rate.
202. If the first success rate does not reach the preset threshold value, the electronic equipment obtains a second success rate for performing DNS query through a data network, and judges whether the second success rate is greater than the first success rate or not; if yes, go to step 203, otherwise, end the process.
It should be noted that the preset threshold may be set by a person skilled in the art or a product manufacturer according to actual requirements, for example, the preset threshold may be 0%, 5%, 10%, etc., and this is not specifically limited in this application.
In the embodiment of the present application, the second power consumption may be obtained based on information about whether DNS query is successful or not through a data network (including networks of 5G, 4G, 3G, and the like of different systems and other data networks) in a historical time period.
203. And the electronic equipment receives a query result returned by the DNS server according to the DNS query request, wherein the query result comprises at least one target IP address corresponding to the target domain name.
Specifically, the DNS server is a DNS server matched to the data network. The DNS server may analyze a DNS request packet in the received DNS query request, thereby obtaining an IP address corresponding to the target domain name.
204. The electronic device stores the target IP address in a corresponding storage area.
Specifically, a target IP address corresponding to a target domain name obtained through DNS query is stored in the electronic device.
205. The electronic equipment detects the connectivity of the wireless network and determines whether the wireless network is connected or not; if yes, go to step 206; if not, go to step 207.
Specifically, whether the network is connected or not can be tested through the data packet. That is, the step of "detecting connectivity of a wireless network, determining whether connected"
Sending a first data packet with a preset size to a network corresponding to a preset IP address through a wireless network;
judging whether a second data packet with a preset size returned by the network corresponding to the preset IP address is received or not;
if yes, determining to be in a connected state;
if not, determining that the communication is in an unconnected state.
The preset IP address may be an IP address of a public network.
Specifically, when it is determined that the DNS query success rate corresponding to the wireless network is lower than a preset threshold, several ping messages for testing network connectivity are sent to ping an IP address of an external network (i.e., a public network) through a ping module of the wireless network. If the ping server is up, the wireless network is considered to be problematic only for DNS queries.
For example, an ICMP message sent by an application ping is mainly used for testing the connectivity of a network, and if the network is unblocked, the returned message is Request from.
206. And the electronic equipment accesses a target network corresponding to the target IP address through the wireless network.
Specifically, when the wireless network is in a connected state, the data network is selected to access the network server corresponding to the target IP address. Because only the DNS message is inquired through the data network, and other internet access requests are executed by using the wireless network, the data flow can be saved, and the user cost is reduced.
207. The electronic device accesses a target network corresponding to the target IP address through a data network.
Specifically, when the wireless network is in a connection failure state, the data network is selected to access the network server corresponding to the target IP address.
As can be seen from the above, in the domain name system DNS processing method provided in this embodiment, when the DNS query cannot be performed in the wireless network state, the data network is pulled up to perform the DNS query operation, so as to improve the overall success rate of the DNS query, enable the electronic device to surf the internet normally, and improve the network access efficiency.
In order to better implement the domain name system DNS processing method provided in the embodiments of the present application, an embodiment of the present application further provides a device based on the domain name system DNS processing method. The meanings of the nouns are the same as those in the domain name system DNS processing method, and specific implementation details can refer to the description in the method embodiment.
Referring to fig. 3, fig. 3 is a block diagram illustrating a domain name system DNS processing apparatus according to an embodiment of the present disclosure. Specifically, the domain name system DNS processing device 300 includes: a detection module 31, a first sending module 32, a receiving module 33 and a storage module 34.
The detection module 31 is configured to, when detecting a DNS query request for a target domain name in a state where the electronic device is accessed to a wireless network, obtain first success power for performing DNS query through the wireless network, where the first success power is obtained based on information on whether DNS query through the wireless network is successful or not within a historical time period;
a first sending module 32, configured to send the DNS query request to a corresponding DNS server through an accessed data network if the first power factor does not reach a preset threshold;
a receiving module 33, configured to receive a query result returned by the DNS server according to the DNS query request, where the query result includes at least one target IP address corresponding to the target domain name;
a storage module 34, configured to store the target IP address in the electronic device.
In some embodiments, the first sending module 32 may be further configured to:
acquiring a network identifier of an accessed data network and a matched IP address of a DNS server matched with the network identifier;
modifying the network configuration parameters of the DNS message into the network identifier;
modifying the address of the receiving end of the DNS message into the matched IP address;
and sending the DNS message to a corresponding DNS server based on the network identifier and the matched IP address.
In some embodiments, referring to fig. 4, the domain name system DNS processing apparatus 300 may further include:
and the accessing module 35 is configured to, after the target IP address is stored in the electronic device, access a target network corresponding to the target IP address through the wireless network.
In some embodiments, referring to fig. 5, the domain name system DNS processing apparatus 300 may further include:
a second sending module 36, configured to send a first data packet with a preset size to a network corresponding to a preset IP address through the wireless network before accessing a target network corresponding to the target IP address through the wireless network;
the judging module 37 is configured to judge whether a second data packet with the preset size returned by the network corresponding to the preset IP address is received;
the accessing module 35 is further configured to access the target network corresponding to the target IP address through the wireless network when the determining module 37 determines that the IP address is the target IP address.
As can be seen from the above, in the domain name system DNS processing apparatus provided in this embodiment, when detecting, by the detection module 31, a DNS query request for a target domain name in a state where an electronic device is accessed to a wireless network, first success power for performing DNS query through the wireless network is obtained; the first sending module 32 is configured to send a DNS query request to a corresponding DNS server through an accessed data network if the first power factor does not reach the preset threshold; the receiving module 33 is configured to receive a query result returned by the DNS server according to the DNS query request, where the query result includes at least one target IP address corresponding to a target domain name; the storage module 34 is used for storing the target IP address in the electronic device. According to the scheme, when the DNS query cannot be performed in a wireless network state, the data network is pulled up to execute the DNS query operation, so that the overall success rate of the DNS query is improved, the electronic equipment can surf the internet normally, and the network access efficiency is improved.
The embodiment of the application also provides the electronic equipment. Referring to fig. 6, an electronic device 500 includes a processor 501 and a memory 502. The processor 501 is electrically connected to the memory 502.
The processor 500 is a control center of the electronic device 500, connects various parts of the whole electronic device using various interfaces and lines, performs various functions of the electronic device 500 by running or loading a computer program stored in the memory 502, and calls data stored in the memory 502, and processes the data, thereby performing overall monitoring of the electronic device 500.
The memory 502 may be used to store software programs and modules, and the processor 501 executes various functional applications and data processing by running the computer programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.
In this embodiment, the processor 501 in the electronic device 500 loads instructions corresponding to one or more processes of the computer program into the memory 502, and the processor 501 runs the computer program stored in the memory 502, so as to implement various functions as follows:
when detecting a DNS query request aiming at a target domain name in a state that an electronic device is accessed to a wireless network, acquiring first success power for DNS query through the wireless network, wherein the first success power is obtained based on information about success or failure of DNS query through the wireless network in a historical time period;
if the first forming power does not reach a preset threshold value, sending the DNS query request to a corresponding DNS server through an accessed data network;
receiving a query result returned by the DNS server according to the DNS query request, wherein the query result comprises at least one target IP address corresponding to the target domain name;
storing the target IP address in the electronic device.
In some embodiments, when the DNS query request is sent to a corresponding DNS server through an accessed data network, the processor 501 may specifically perform the following steps:
acquiring a network identifier of an accessed data network and a matched IP address of a DNS server matched with the network identifier;
modifying the network configuration parameters of the DNS message into the network identifier;
modifying the address of the receiving end of the DNS message into the matched IP address;
and sending the DNS message to a corresponding DNS server based on the network identifier and the matched IP address.
In some embodiments, after storing the target IP address in the electronic device, processor 501 may further perform the following steps:
and accessing a target network corresponding to the target IP address through the wireless network.
In some embodiments, before accessing a target network corresponding to the target IP address through the wireless network, the processor 501 may further perform the following steps:
sending a first data packet with a preset size to a network corresponding to a preset IP address through the wireless network;
judging whether a second data packet with the preset size returned by the network corresponding to the preset IP address is received or not;
and if so, executing the step of accessing the target network corresponding to the target IP address through the wireless network.
In some embodiments, if a second packet with the preset size returned by the network corresponding to the preset IP address is not received, the processor 501 may further perform the following steps:
and accessing the target network corresponding to the target IP address through the data network.
In some embodiments, before sending the DNS query request to the corresponding DNS server through the accessed data network, the processor 501 may further perform the following steps:
acquiring second power consumption for performing DNS query through the data network, wherein the second power consumption is obtained based on the information about whether DNS query through the data network is successful or not in the historical time period;
judging whether the second power forming rate is larger than the first power forming rate;
and if so, executing a step of sending the DNS query request to a corresponding DNS server through an accessed data network.
As can be seen from the above, in the state that the electronic device is accessed to the wireless network, when a DNS query request for a target domain name is detected, the electronic device of the embodiment of the present application obtains the first success rate for performing DNS query through the wireless network; if the first forming power does not reach the preset threshold value, sending a DNS query request to a corresponding DNS server through an accessed data network; receiving a query result returned by the DNS server according to the DNS query request, wherein the query result comprises at least one target IP address corresponding to a target domain name; the destination IP address is stored in the electronic device. According to the scheme, when the DNS query cannot be performed in a wireless network state, the data network is pulled up to execute the DNS query operation, so that the overall success rate of the DNS query is improved, the electronic equipment can surf the internet normally, and the network access efficiency is improved.
Referring to fig. 7, in some embodiments, the electronic device 500 may further include: a display 503, radio frequency circuitry 504, audio circuitry 505, and a power supply 506. The display 503, the rf circuit 504, the audio circuit 505, and the power source 506 are electrically connected to the processor 501.
The display 503 may be used to display information entered by or provided to the user as well as various graphical user interfaces, which may be made up of graphics, text, icons, video, and any combination thereof.
The rf circuit 504 may be used for transceiving rf signals to establish wireless communication with a network device or other electronic devices via wireless communication, and for transceiving signals with the network device or other electronic devices.
The audio circuit 505 may be used to provide an audio interface between a user and an electronic device through a speaker, microphone.
The power source 506 may be used to power various components of the electronic device 500. In some embodiments, power supply 506 may be logically coupled to processor 501 through a power management system, such that functions of managing charging, discharging, and power consumption are performed through the power management system.
Although not shown in fig. 7, the electronic device 500 may further include a camera, a bluetooth module, and the like, which are not described in detail herein.
An embodiment of the present application further provides a storage medium, where the storage medium stores a computer program, and when the computer program runs on a computer, the computer is caused to execute the domain name system DNS processing method in any one of the embodiments, for example: when detecting a DNS query request aiming at a target domain name in a state that an electronic device is accessed to a wireless network, acquiring first success power for DNS query through the wireless network; if the first forming power does not reach the preset threshold value, sending a DNS query request to a corresponding DNS server through an accessed data network; receiving a query result returned by the DNS server according to the DNS query request, wherein the query result comprises at least one target IP address corresponding to a target domain name; the destination IP address is stored in the electronic device.
In the embodiment of the present application, the storage medium may be a magnetic disk, an optical disk, a Read Only Memory (ROM), a Random Access Memory (RAM), or the like.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It should be noted that, for the domain name system DNS processing method in the embodiment of the present application, it can be understood by a person skilled in the art that all or part of the process of implementing the domain name system DNS processing method in the embodiment of the present application can be completed by controlling related hardware through a computer program, where the computer program can be stored in a computer readable storage medium, such as a memory of an electronic device, and executed by at least one processor in the electronic device, and the process of executing the process can include the process of the embodiment of the domain name system DNS processing method. The storage medium may be a magnetic disk, an optical disk, a read-only memory, a random access memory, etc.
For the domain name system DNS processing apparatus in the embodiment of the present application, each functional module may be integrated in one processing chip, or each module may exist alone physically, or two or more modules are integrated in one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented as a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium such as a read-only memory, a magnetic or optical disk, or the like.
The foregoing describes in detail a domain name system DNS processing method, device, storage medium, and electronic device provided in an embodiment of the present application, and a specific example is applied in the present application to explain the principle and implementation manner of the present application, and the description of the foregoing embodiment is only used to help understand the method and core ideas of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (6)

1. A Domain Name System (DNS) processing method is characterized by comprising the following steps:
when the electronic equipment is in a state of accessing a Wi-Fi network and a DNS query request aiming at a target domain name is detected, acquiring first success power of DNS query through the Wi-Fi network, wherein the first success power is obtained based on information about success or failure of DNS query through the Wi-Fi network in a historical time period;
if the first success rate does not reach the preset threshold value, obtaining a second success rate for performing DNS query through the mobile data network, and if the second success rate is judged to be smaller than the first success rate, ending the process;
if the second power forming rate is larger than the first power forming rate, sending the DNS query request to a corresponding DNS server through an accessed mobile data network, wherein the Wi-Fi network and the mobile data network are both in a connection state;
receiving a query result returned by the DNS server according to the DNS query request, wherein the query result comprises at least one target IP address corresponding to the target domain name;
storing the target IP address in the electronic device;
sending a first data packet with a preset size to a network corresponding to a plurality of preset IP addresses through a ping module of the Wi-Fi network, wherein the first data packet is used for testing network connectivity and judging whether a second data packet with the preset size returned by the network corresponding to the preset IP addresses is received or not;
if yes, determining that the Wi-Fi network is in a connected state, only corresponding DNS configuration or DNS server is in a problem, and accessing a target network corresponding to a target IP address through the Wi-Fi network;
if not, determining that the Wi-Fi network is in a connection failure state, and accessing a target network corresponding to the target IP address through the mobile data network.
2. The domain name system DNS processing method according to claim 1, wherein the DNS query request includes a DNS packet, and the sending of the DNS query request to a corresponding DNS server via an accessed mobile data network includes:
acquiring a network identifier of an accessed mobile data network and a matched IP address of a DNS server matched with the network identifier;
modifying the network configuration parameters of the DNS message into the network identifier;
modifying the address of the receiving end of the DNS message into the matched IP address;
and sending the DNS message to a corresponding DNS server based on the network identifier and the matched IP address.
3. A domain name system DNS processing apparatus, comprising:
the device comprises a detection module and a processing module, wherein the detection module is used for acquiring first success power for performing DNS query through a Wi-Fi network when a DNS query request aiming at a target domain name is detected in a state that electronic equipment is accessed to the Wi-Fi network, and the first success power is obtained based on information about success or failure of DNS query through the Wi-Fi network in a historical time period;
the first sending module is used for acquiring second power generation rate for performing DNS query through a mobile data network if the first power generation rate does not reach a preset threshold value, and ending the flow if the second power generation rate is judged to be smaller than the first power generation rate; if the second power forming rate is larger than the first power forming rate, sending the DNS query request to a corresponding DNS server through an accessed mobile data network, wherein the Wi-Fi network and the mobile data network are both in a connection state;
a receiving module, configured to receive a query result returned by the DNS server according to the DNS query request, where the query result includes at least one target IP address corresponding to the target domain name;
a storage module for storing the target IP address in the electronic device;
the second sending module is used for sending first data packets with preset sizes to networks corresponding to a plurality of preset IP addresses through a ping module of the Wi-Fi network, and the first data packets are used for testing network connectivity;
the judging module is used for judging whether a second data packet with the preset size returned by the network corresponding to the preset IP address is received or not;
the access module is used for determining that the Wi-Fi network is in a connected state and only corresponding DNS configuration or a DNS server has a problem when the judgment module judges that the Wi-Fi network is in a connected state, and accessing a target network corresponding to a target IP address through the Wi-Fi network; if not, determining that the Wi-Fi network is in a connection failure state, and accessing a target network corresponding to the target IP address through the mobile data network.
4. The Domain Name System (DNS) processing apparatus according to claim 3, wherein the first sending module is configured to:
acquiring a network identifier of an accessed mobile data network and a matched IP address of a DNS server matched with the network identifier;
modifying the network configuration parameters of the DNS message into the network identifier;
modifying the address of the receiving end of the DNS message into the matched IP address;
and sending the DNS message to a corresponding DNS server based on the network identifier and the matched IP address.
5. A storage medium having stored thereon a computer program, characterized in that, when the computer program is run on a computer, it causes the computer to execute the domain name system DNS processing method according to any one of claims 1 to 2.
6. An electronic device comprising a processor and a memory, said memory having a computer program, wherein said processor is adapted to perform the domain name system, DNS, processing method according to any of claims 1 to 2 by invoking said computer program.
CN201811075473.2A 2018-09-14 2018-09-14 Domain name system DNS processing method and device, storage medium and electronic equipment Active CN108924274B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811075473.2A CN108924274B (en) 2018-09-14 2018-09-14 Domain name system DNS processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811075473.2A CN108924274B (en) 2018-09-14 2018-09-14 Domain name system DNS processing method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN108924274A CN108924274A (en) 2018-11-30
CN108924274B true CN108924274B (en) 2021-10-26

Family

ID=64408228

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811075473.2A Active CN108924274B (en) 2018-09-14 2018-09-14 Domain name system DNS processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN108924274B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111447291B (en) * 2018-12-29 2024-04-05 三六零科技集团有限公司 DNS-based scheduling method and system and electronic equipment
WO2020228038A1 (en) * 2019-05-16 2020-11-19 深圳市欢太科技有限公司 Domain name processing method, apparatus, electronic device, and storage medium
CN111556552B (en) * 2020-03-26 2023-01-31 维沃移动通信有限公司 Data transmission method and electronic equipment
CN111726797B (en) * 2020-06-23 2023-09-26 Oppo广东移动通信有限公司 User identification card switching method and device, storage medium and electronic equipment
CN112737894B (en) * 2021-01-06 2022-02-08 北京字节跳动网络技术有限公司 Network quality monitoring method and device, storage medium and electronic equipment
CN113472607B (en) * 2021-06-29 2023-05-02 未鲲(上海)科技服务有限公司 Application program network environment detection method, device, equipment and storage medium
CN113810510A (en) * 2021-07-30 2021-12-17 绿盟科技集团股份有限公司 Domain name access method and device and electronic equipment
CN115665009B (en) * 2022-12-29 2023-05-09 鹏城实验室 DNS root server state monitoring method and device, electronic equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102685832A (en) * 2011-03-11 2012-09-19 西安龙飞软件有限公司 Method for dynamically switching networks for 3G (The Third Generation Telecommunication) and WIMAX (Worldwide Interoperability for Microwave Access) dual-mode router
CN103491653A (en) * 2013-05-13 2014-01-01 上海盛本通讯科技有限公司 WiFi and 3G coexisting method based on Android intelligent terminal
CN104170460A (en) * 2013-12-03 2014-11-26 华为终端有限公司 Network switching method and terminal
CN106331213A (en) * 2016-08-29 2017-01-11 广东欧珀移动通信有限公司 Domain name system DNS processing method and apparatus
CN106790743A (en) * 2016-11-28 2017-05-31 北京小米移动软件有限公司 Information transferring method, device and mobile terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102685832A (en) * 2011-03-11 2012-09-19 西安龙飞软件有限公司 Method for dynamically switching networks for 3G (The Third Generation Telecommunication) and WIMAX (Worldwide Interoperability for Microwave Access) dual-mode router
CN103491653A (en) * 2013-05-13 2014-01-01 上海盛本通讯科技有限公司 WiFi and 3G coexisting method based on Android intelligent terminal
CN104170460A (en) * 2013-12-03 2014-11-26 华为终端有限公司 Network switching method and terminal
CN106331213A (en) * 2016-08-29 2017-01-11 广东欧珀移动通信有限公司 Domain name system DNS processing method and apparatus
CN106790743A (en) * 2016-11-28 2017-05-31 北京小米移动软件有限公司 Information transferring method, device and mobile terminal

Also Published As

Publication number Publication date
CN108924274A (en) 2018-11-30

Similar Documents

Publication Publication Date Title
CN108924274B (en) Domain name system DNS processing method and device, storage medium and electronic equipment
CN106686070B (en) Database data migration method, device, terminal and system
US11151010B2 (en) Resource configuration method, mobile terminal and storage medium
US11075880B2 (en) Data service implementation method and apparatus, and terminal
CN108347351B (en) Method, device and system for compatibility of dual Ethernet cards of equipment
CN109981493B (en) Method and device for configuring virtual machine network
CN112040030B (en) Message transmission method and device, computer equipment and storage medium
CN114025021B (en) Communication method, system, medium and electronic equipment crossing Kubernetes cluster
WO2022116848A1 (en) Packet transmission method and apparatus, computer device, and storage medium
CN113141405B (en) Service access method, middleware system, electronic device, and storage medium
CN107835089B (en) Method and device for managing resources
US20170289243A1 (en) Domain name resolution method and electronic device
CN109428839B (en) CDN scheduling method, device and system
WO2020228038A1 (en) Domain name processing method, apparatus, electronic device, and storage medium
US20230161541A1 (en) Screen projection method and system
CN114338594A (en) ARP (Address resolution protocol) response-substituting method, device, equipment and storage medium in Kubernetes environment
CN108924043A (en) System monitoring method, gateway communication, gateway apparatus, service processing equipment
CN114244654B (en) URL forwarding method, device, equipment and computer storage medium
CN109347994B (en) Internet protocol IP address obtaining method and device, storage medium and electronic equipment
CN113268308B (en) Information processing method, device and storage medium
US20200162419A1 (en) Address assignment method and related device
CN111107178B (en) Method and equipment for designating local address used by message
CN117032905B (en) Method and system for associating container cluster with block storage and virtual machine
CN117640363B (en) Micro-service configuration and management and control method and system
CN114785753B (en) Domain name resolution method, system, medium and electronic equipment of container cloud platform

Legal Events

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