Method for sending DNS message, terminal, and network-side device
A method for sending a DNS message includes obtaining, by a terminal, a to-be-sent message; and sending the to-be-sent message to a target DNS server specified by an operator in case of determining that the to-be-sent message is a DNS query.
1 . A method for sending a DNS message, comprising:
obtaining, by a terminal, a to-be-sent message; and
sending the to-be-sent message to a target domain name system (DNS) server specified by an operator in case of determining that the to-be-sent message is a DNS query;
wherein
before the obtaining, by a terminal, a to-be-sent message, the method further comprises:
receiving address information of the target DNS server from a network-side device; wherein before receiving the address information of the target DNS server from the network-side device, the method further comprises:
sending, by the terminal, indication information to the network-side device, wherein the indication information is used to indicate that the terminal has a target capability, the target capability comprising at least one of the following:
the terminal is deployed with a first functional entity, wherein the first functional entity is capable of sending a DNS query request to the DNS server specified by the operator;
the terminal supports obtaining the address information of the DNS server specified by the operator from the network-side device through a PDU session and configuring the obtained address information of the DNS server to the PDU session;
the terminal supports not modifying a DNS configuration specified by the operator after the DNS configuration is obtained;
the terminal supports forwarding the DNS configuration specified by the operator to applications with a target permission, wherein the target permission is a permission to receive the address information of the DNS server specified by the operator; or
the terminal supports forwarding a DNS response received from the DNS server specified by the operator to an application.
2 . The method according to claim 1 , wherein after receiving the address information of the target DNS server from the network-side device, the method further comprises:
setting the address information of the target DNS server as a highest-priority DNS server address on an operating system of the terminal.
3 . The method according to claim 1 , wherein the receiving address information of the target DNS server from a network-side device comprises:
receiving, by the terminal, the address information of the target DNS server from the network-side device through a protocol data unit (PDU) session.
4 . The method according to claim 3 , wherein after the receiving address information of the target DNS server from a network-side device, the method further comprises:
binding the address information of the target DNS server with the PDU session.
5 . The method according to claim 4 , wherein the obtaining, by a terminal, a to-be-sent message comprises:
obtaining the to-be-sent message from a first application and determining that the to-be-sent message is to be sent over the PDU session; and
the sending the to-be-sent message to a target DNS server specified by an operator comprises at least one of the following:
sending the to-be-sent message by using the address information of the target DNS server as a destination address of the to-be-sent message; or
using the address information of the target DNS server for DNS query and/or resolution.
6 . The method according to claim 1 , wherein after receiving the address information of the target DNS server from the network-side device, the method further comprises:
forwarding the address information of the target DNS server to a second application on the application layer.
7 . The method according to claim 6 , wherein the second application is an application with a target permission, wherein the target permission is a permission to receive the address information of the DNS server specified by the operator.
8 . The method according to claim 7 , wherein before the obtaining, by a terminal, a to-be-sent message, the method further comprises:
obtaining identification information of applications with the target permission from the network-side device.
9 . The method according to claim 1 , wherein after the sending the to-be-sent message to a target DNS server specified by an operator, the method further comprises:
receiving the DNS response returned by the target DNS server, wherein the DNS response carries the address information of the target server, and the target server is a server with a closest topological distance to the terminal obtained by resolving the to-be-sent message.
10 . The method according to claim 9 , wherein after the receiving the DNS response returned by the target DNS server, the method further comprises:
forwarding the DNS response to the first application on the application layer, wherein the first application is an application that is to send the to-be-sent message.
11 . A method for configuring a DNS server, comprising:
receiving, by a network-side device, indication information sent by a terminal, wherein the indication information indicates that the terminal has a target capability;
obtaining, by the network-side device, address information of a target domain name system (DNS) server specified by an operator; and
sending, by the network-side device, the address information of the target DNS server to the terminal; wherein the target capability comprises at least one of the following:
the terminal is deployed with a first functional entity, wherein the first functional entity is capable of sending a DNS query request to the DNS server specified by the operator;
the terminal supports obtaining the address information of the DNS server specified by the operator from the network-side device through a PDU session and configuring the obtained address information of the DNS server to the PDU session;
the terminal supports not modifying a DNS configuration specified by the operator after the DNS configuration is obtained;
the terminal supports forwarding the DNS configuration specified by the operator to applications with a target permission, wherein the target permission is a permission to receive the address information of the DNS server specified by the operator; or the terminal supports forwarding a DNS response received from the DNS server specified by the operator to an application.
12 . The method according to claim 11 , wherein the obtaining, by the network-side device, address information of a target DNS server specified by an operator comprises:
obtaining, by the network-side device, the address information of the target DNS server based on subscription information of the terminal, location information of the terminal, and a user plane protocol data unit (PDU) session anchor (PSA) to which the terminal is anchored.
13 . The method according to claim 11 , wherein the sending, by the network-side device, the address information of the target DNS server to the terminal comprises:
sending, by the network-side device, the address information of the target DNS server to the terminal using protocol configuration options (PCOs).
14 . The method according to claim 13 , wherein after the obtaining, by the network-side device, address information of a target DNS server specified by an operator, the method further comprises at least one of the following:
indicating, by the network-side device, a functional identifier to the terminal, wherein the functional identifier is used to indicate a functional entity, corresponding to the functional identifier, to which an operating system or a chip sends the address information after receiving the address information of the target DNS server; or
indicating, by the network-side device, an application identifier to the terminal, wherein the application identifier is used to indicate an application capable of obtaining the address information of the target DNS server.
15 . The method according to claim 14 , wherein before the indicating, by the network-side device, an application identifier to the terminal, the method further comprises at least one of the following:
receiving, by the network-side device, first indication information sent by the terminal, wherein the first indication information indicates applications on the terminal; determining, based on the first indication information, an application in the applications on the terminal that is capable of obtaining the address information of the target DNS server; or
obtaining, by the network-side device, an identifier of an application contracted with the operator from a unified data management entity (UDM) or a unified data repository (UDR).
16 . A terminal, comprising a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, cause the terminal to perform:
obtaining a to-be-sent message; and
sending the to-be-sent message to a target domain name system (DNS) server specified by an operator in case of determining that the to-be-sent message is a DNS query;
wherein the computer program, when executed by the processor, causes the terminal to perform:
receiving address information of the target DNS server from a network-side device;
wherein the computer program, when executed by the processor, causes the terminal to perform:
sending, by the terminal, indication information to the network-side device, wherein the indication information is used to indicate that the terminal has a target capability, the target capability comprising at least one of the following:
the terminal is deployed with a first functional entity, wherein the first functional entity is capable of sending a DNS query request to the DNS server specified by the operator;
the terminal supports obtaining the address information of the DNS server specified by the operator from the network-side device through a PDU session and configuring the obtained address information of the DNS server to the PDU session;
the terminal supports not modifying a DNS configuration specified by the operator after the DNS configuration is obtained;
the terminal supports forwarding the DNS configuration specified by the operator to applications with a target permission, wherein the target permission is a permission to receive the address information of the DNS server specified by the operator; or
the terminal supports forwarding a DNS response received from the DNS server specified by the operator to an application.
17 . The method according to claim 1 , wherein the network-side device comprises session management function (SMF).
18 . The method according to claim 11 , wherein the network-side device comprises session management function (SMF).
19 . The terminal according to claim 16 , wherein the network-side device comprises session management function (SMF).
20 . The terminal according to claim 16 , wherein the computer program, when executed by the processor, causes the terminal to perform:
receiving, by the terminal, the address information of the target DNS server from the network-side device through a protocol data unit (PDU) session.