Skip to content

Latest commit

 

History

History
128 lines (101 loc) · 4.99 KB

File metadata and controls

128 lines (101 loc) · 4.99 KB
title description meta_tags namespace menu_namespace permalink
How to perform a load balance between DNS records
Perform a DNS load balance by assigning different weights to records configured in Edge DNS.
dns, Edge DNS, load balance, records
docs_secure_load_balance_dns
secureMenu
/documentation/products/guides/secure/load-balance-dns/

import ContributorList from '~/components/ContributorList.astro'

You can use an Edge DNS zone to create multiple records and perform a DNS load balance. Assigning different weights to each record for the same zone helps distribute incoming network traffic, ensuring optimal resource utilization and preventing overload on a single server.

In this guide, you'll learn an example using a record type A, which accepts values of IPv4 address format.


Via Azion Console

  1. Access Azion Console > Edge DNS.
  2. Choose the zone in which you want to add records from the list or create a zone.
  3. Select the Records tab.
  4. Click the Add Record button.
  5. In Name, provide the new record's name. Example: lbexample.
  6. In Type, select the type of record A.
  7. In Value, add the items for the DNS response to the registered record in IPv4 address format. Example: 192.111.0.1.
  8. In TTL (seconds), choose the time, in seconds, that a response can be cached on a resolver server. Maximum value: 2147483647.
  9. In Policy, select Weighted.
    • In Weight, specify the weight for the record, considering that you'll create other records for the same zone with different weights. Accepts values from 0 to 255.
    • In Description (optional), you can add a short text that differentiates the records you'll create for the load balance. Accepts up to 45 characters.
  10. Click the Save button.
  11. Repeat steps 4 to 10 to create the other balanced DNS records needed while observing Edge DNS limits, always using the same Name and setting the desired addresses in Value and weights for each record in Weight.

If you add 3 records, you can, for example, specify a weight of 50 for the first record, 20 for the second record, and 30 for the third record.


Via API

  1. Run the following GET request in your terminal, replacing [TOKEN VALUE] with your personal token to retrieve your <hosted_zone_id>:
curl --location 'https://api.azionapi.net/intelligent_dns' \
--header 'Authorization: Token [TOKEN VALUE]' \
--header 'Accept: application/json; version=3'
  1. You'll receive a response with all your existing zones. Copy the value of the <id> that you want to use.
  2. Run the following POST request, replacing [TOKEN VALUE] with your personal token and the <hosted_zone_id> value you copied:
curl --location 'https://api.azionapi.net/intelligent_dns/<hosted_zone_id>/records' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token [TOKEN VALUE]' \
--header 'Accept: application/json; version=3' \
--data-raw '{
    "record_type": "A",
    "entry": "lbexample",
    "answers_list": [
        "192.111.0.1",
        "192.111.0.2"
    ],
    "ttl": 20,
    "policy": "weighted",
    "weight": 50,
    "description": "policy weight 50"
}'
  1. You'll receive a response similar to this:
{
  "results": {
    "answers_list": [
      "192.111.0.1",
      "192.111.0.2"
    ],
    "zone_id": 3600,
    "weight": 50,
    "record_type": "A",
    "ttl": 20,
    "policy": "weighted",
    "entry": "lbexample",
    "id": 61752,
    "description": "policy weight 50"
  },
  "schema_version": 3
}

Wait a few minutes for the changes to propagate and your records will be created in the hosted zone you chose.

  1. Repeat the steps to create the other balanced DNS records needed while observing Edge DNS limits, always using the same entry and setting the desired addresses in the answers_list parameter and weights for each record in the weight parameter.

:::tip Check the Azion API documentation and the OpenAPI specification to know more about what the Azion API can offer. :::


Testing your balanced record

After configuring your balanced record, you can test and see if it's working via terminal commands:

  1. Run dig +short [your balanced hostname] a couple of times in a row.
    • You'll see the address list vary based on the record selected by the Edge DNS load balancer each time.
  2. The response will be similar to:
dig +short lbexample @ns1.aziondns.net
192.111.0.1
dig +short lbexample @ns1.aziondns.net
192.111.0.2
dig +short lbexample @ns1.aziondns.net
192.111.0.3



Contributors Contributor