DNS

DNS service requires the user to define and activate a connection profile, either PSD or CSD.
If not specified, the <cid> and the <preferred_protocol_type> parameters set by means of the +UDCONF=19 AT command are used.
See +CGACT AT command for activating a PDP context.

Resolve name / IP number through DNS +UDNSRN

+UDNSRN
Modules
All products
Attributes
Syntax
PIN required
Settings saved
Can be aborted
Response time
Error reference
full
No
No
No

Description

Translates a domain name to an IP address or an IP address to a domain name by using an available DNS. There are two available DNSs, primary and secondary. The network usually provides them after a GPRS activation or a CSD establishment. They are automatically used in the resolution process if available. The resolver will use first the primary DNS, otherwise if there is no answer, the second DNS will be involved.
The user can replace each network provided DNS by setting its own DNS for a PSD context by means of the +UDNSCFG AT command.
The DNS resolution timeout depends on the number of DNS servers available to the DNS resolution system. The response time for the DNS resolution is estimated if 8 servers are used to perform this task.

Syntax

TypeSyntaxResponseExample
Set
AT+UDNSRN=<resolution_type>,<domain_ip_string>[,<async>[,<cid>[,<preferred_protocol_type>]]]
+UDNSRN: <resolved_ip_address>
OK
or
+UDNSRN: <resolved_domain_name>
OK
or
OK
AT+UDNSRN=0,"www.google.com"
+UDNSRN: "216.239.59.147"
OK
AT+UDNSRN=0,"www.dau.dau",1,1,0
OK
+UUDNSRN: 0,"172.22.1.201"
AT+UDNSRN=0,"www.rs-ipv6-test.com",1,1,1
OK
+UUDNSRN: 0,"FC01:CAFE::1"
AT+UDNSRN=0,"www.google.com",1
OK
+UUDNSRN: "216.239.59.147"
AT+UDNSRN=0,"www.google.com",0
+UDNSRN: "216.239.59.147"
OK
Test
AT+UDNSRN=?
+UDNSRN: (list of supported <resolution_type>s),"remote_host",(list of supported <async>s),(list of supported <cid>s),(list of supported <preferred_protocol_type>s)
OK
+UDNSRN: (0),"remote_host",(1),(1-15),(0,1)
OK
URC
+UUDNSRN: <result_code>[,<resolved_ip_address>[,<ttl>]]
+UUDNSRN: 0,"216.239.59.147,60"
+UUDNSRN: <result_code>[,<resolved_domain_name>]
+UUDNSRN: 0,"somedomain.com"
+UUDNSRN: -1
+UUDNSRN: -1

Defined values

ParameterTypeDescription
<resolution_type>
Number
Type of resolution operation:
  • 0: domain name to IP address
  • 1: IP address to domain name (host by name)
<domain_ip_string>
String
Domain name (<resolution_type>=0) or the IP address in (<resolution_type>=1) to be resolved. The maximum string length is 128 characters.
<async>
Number
Asynchronous DNS resolution flag. Allowed values:
  • 0 (default value): the final result code is returned only once the DNS response is available, locking the AT interface until the DNS activity is running
  • 1: a final result code (OK or an error result code) is returned immediately unlocking the AT interface and making it available for the execution of other AT commands. Once the result of DNS resolution becomes available, it is notified to the AT interface through the +UUDNSRN URC
<cid>
Number
See <cid>. For more details on the default value of the parameter (where supported), see DNS.
<preferred_protocol_type>
Number
Select the specific IP type between IPv4 and IPv6. Allowed values:
  • 0: IPv4
  • 1: IPv6
For more details on the default value of the parameter (where supported), see DNS.
<resolved_ip_address>
String
Resolved IP address corresponding to the specified domain name
<resolved_domain_name>
String
Resolved domain name corresponding to the provided IP address
<result_code>
Number
Result code of DNS resolution:
  • 0: no error
  • -1: DNS resolution failed. In this case the <resolved_ip_address> or the <resolved_domain_name> fields are not present
<ttl>
Number
The value of TTL received in the incoming packet.

Notes

  • <resolution_type>=1 is not supported.
  • <async> =1 is the default and the only supported value.
  • +USOER error codes are not supported.
  • The oldest of the five possible DNS cache entries persists at Hibernate or Sleep-2 deep-sleep cycle. Refer to +UPSV for more details on the deep-sleep states.

Override DNS configuration +UDNSCFG

+UDNSCFG
Modules
All products
Attributes
Syntax
PIN required
Settings saved
Can be aborted
Response time
Error reference
full
No
No
No
-

Description

Overrides the primary and/or the secondary DNS defined for a selected context identifier.
It is also possible to delete an overridden DNS or list all overridden DNS, the list is empty in case no overridden DNSs are defined.
DNS configuration is only effective if followed by the corresponding <cid> activation by means of +CGACT AT command.
<cid> deactivation and activation is required, if the corresponding <cid> is already activated.

Syntax

TypeSyntaxResponseExample
Generic syntax
Set
AT+UDNSCFG=<cid>[,<index>,<ip_type>[,<ipv4_or_ipv6_address>]]
OK
AT+UDNSCFG=1,1,0,"8.8.8.8"
OK
Read all the overridden DNS for a selected <cid>
Set
AT+UDNSCFG=<cid>
+UDNSCFG: <cid>,<index>,<ip_type>,<ipv4_or_ipv6_address>
[[…​]
+UDNSCFG: <cid>,<index>,<ip_type>,<ipv4_or_ipv6_address>]
OK
AT+UDNSCFG=2
+UDNSCFG: 2,1,0,"8.8.8.8"
+UDNSCFG: 2,2,0,"9.9.9.9"
OK
Delete an overridden DNS
Set
AT+UDNSCFG=<cid>,<index>,<ip_type>
OK
AT+UDNSCFG=1,1,0
OK
Override a DNS
Set
AT+UDNSCFG=<cid>,<index>,<ip_type>,<ipv4_or_ipv6_address>
OK
AT+UDNSCFG=2,2,0,"8.8.8.8"
OK
Read all overridden DNS
Read
AT+UDNSCFG?
+UDNSCFG: <cid>,<index>,<ip_type>,<ipv4_or_ipv6_address>
[[…​]
+UDNSCFG: <cid>,<index>,<ip_type>,<ipv4_or_ipv6_address>]
OK
+UDNSCFG: 1,1,0,"8.8.8.8"
+UDNSCFG: 2,1,0,"8.8.8.8"
OK
Test
AT+UDNSCFG=?
+UDNSCFG: (list of supported <cid>),(list of supported <index>),(0,1),<ipv4_or_ipv6_address>
OK
+UDNSCFG: (1-24),(1-2),(0-1),"ipv4_or_ipv6_address"
OK

Defined values

ParameterTypeDescription
<cid>
Number
PDP context identifier used for the DNS communication. The allowed range is product specific, see <cid>.
The allowed values goes from 1 to 3.
<index>
Number
Index of the DNS to be overridden:
  • 1: primary DNS
  • 2: secondary DNS
  • 3: tertiary DNS
Allowed values:
  • 1, 2
<ip_type>
Number
Allowed values:
  • 0: IPv4
  • 1: IPv6
<ipv4_or_ipv6_address>
String
DNS IP address, see IPv4/IPv6 addressing.
Last updated: 13 January 2025
Need help?Contact Support
Questions?Contact us