Updated on 2024-10-17 GMT+08:00

Adding a TXT Record Set

Scenarios

A TXT record set provides description for a domain name. It is usually used in the following scenarios:

  • To record DKIM public keys to prevent email fraud.
  • To record the identity of domain name owners to facilitate domain name retrieval.

For more information about each type of record sets, see Record Set Types and Configuration Rules.

Procedure

  1. Go to the DNS console.
  2. In the navigation pane on the left, choose Public Zones or Private Zones.

    The zone list is displayed.

  3. (Optional) If you have selected Private Zones, click on the upper left corner to select the region and project.
  4. Locate the zone and click Manage Record Set in the Operation column.
  5. Click Add Record Set.

    The Add Record Set dialog box is displayed.

  6. Configure the parameters based on Table 1.
    Table 1 Parameters for adding a TXT record set

    Parameter

    Description

    Example Value

    Name

    Prefix of the domain name to be resolved.

    For example, if the domain name is example.com, the prefix can be as follows:

    • www: The domain name is www.example.com, which is usually used for a website.
    • Left blank: The domain name is example.com.

      To use an at sign (@) as the domain name prefix, just leave this parameter blank.

    • abc: The domain name is abc.example.com, a subdomain of example.com.
    • mail: The domain name is mail.example.com, which is usually used for email servers.
    • *: The domain name is *.example.com, which is a wildcard domain name, indicating all subdomains of example.com.

    Left blank

    Type

    Type of the record set

    A message may be displayed indicating that the record set you are trying to add conflicts with an existing record set.

    For details, see Why Is a Message Indicating Conflict with an Existing Record Set Displayed When I Add a Record Set?

    TXT – Specify text records

    Line

    Resolution line.

    The DNS server will return the IP address of the specific line, depending on where the visitors come from.

    This parameter is only configurable for public zone record sets.

    • Default: returns the default resolution result irrespective of where the visitors come from.
    • ISP: returns the resolution result based on visitors' carrier networks. For details, see Configuring ISP Lines.
    • Region: returns the resolution result based on visitors' geographical locations. For details, see Configuring Region Lines.

    Default

    TTL (s)

    Cache duration of the record set on a local DNS server, in seconds.

    The value ranges from 1 to 2147483647, and the default value is 300.

    If your service address changes frequently, set TTL to a smaller value.

    Learn more about TTL.

    300

    Value

    Text content

    Configuration rules:

    • Text record values must be enclosed in double quotation marks.
    • One or more text record values are supported, each on a separate line.

      A maximum of 50 text record values can be entered.

    • A single text record value can contain multiple character strings, each of which is double quoted and separated from others using a space.

      One character string cannot exceed 255 characters.

      A value must not exceed 4096 characters.

    • The value cannot be left blank.
    • The text cannot contain a backslash (\).
    • Single text record:

      "aaa"

    • Multiple text records:

      "bbb"

      "ccc"

    • A text record that contains multiple strings:

      "ddd" "eee" "fff"

    • Text record in SPF format:

      "v=spf1 a mx -all"

      This value indicates that only IP addresses in the A and MX record sets are allowed to send emails using this domain name.

    Weight

    (Optional) Weight for the record set. The value ranges from 0 to 1000, and the default value is 1.

    This parameter is only configurable for public zone record sets.

    If a resolution line in a zone contains multiple record sets of the same type, you can set different weights to each record set. For details, see Configuring Weighted Routing.

    1

    Tag

    (Optional) Identifier of the record set. Each tag contains a key and a value. You can add up to 20 tags to a record set.

    For details about tag key and value requirements, see Table 2.

    NOTE:

    If you have configured tag policies for DNS, you need to add tags to your record sets based on the tag policies. If you add a tag that does not comply with the tag policies, record sets may fail to be created. Contact the administrator to learn more about tag policies.

    example_key1

    example_value1

    Description

    (Optional) Supplementary information about the record set.

    The description can contain no more than 255 characters.

    -

    Table 2 Tag key and value requirements

    Parameter

    Requirements

    Example Value

    Key

    • Cannot be left blank.
    • Must be unique for each resource.
    • Can contain no more than 36 characters.
    • Cannot start or end with a space nor contain special characters =*<>\,|/

    example_key1

    Value

    • Cannot be left blank.
    • Can contain no more than 43 characters.
    • Cannot start or end with a space nor contain special characters =*<>\,|/

    example_value1

  7. Click OK.
  8. Switch back to the Record Sets tab.

    The added record set is in the Normal state.

Related Operations

For more information about TXT record sets, see Reclaiming a Public Zone.