Our DNS server can provide different DNS responses to different users. For example, you can specify that particular records will be delivered to users from Asia verses Europe, or choose the weight for the records, i.e. the probability with which they will be shown in the responses.
This is called dynamic record selection. Depending on which parameter is used to select which record will be shown, it may also be referred to as weight balancing, traffic steering, GeoDNS, or failover.
At Gcore, we offer two kinds of balancing: weight balancing and Geobalancing; the latter is a specific kind of balancing by location. This article will show how to configure weight balancing and Geobalancing by coordinates and other parameters.
Balancing is controlled by the metadata that you add to each record in your RRSet. You can add nine types of data: ip, asn, continents, countries, latlong, fallback, backup, notes, and weight.
The system will check if a requestor’s IP (usually a recursive DNS) correlates to the specified meta parameters for the records in RRset and our geodatabase. If they do, the system will pick those records for the response. For example, you can add metadata of the “continent” type with the value “Africa” to a record, which will only be given to users from Africa.
Three types of balancing are available:
Note: Balancing (Geobalancing and weight balancing) is a paid option, mind your tariff plan limits.
Move the slider in the Records selection using section to enable balancing.
Tick the balancing type you wish to select. More details below.
Specify the maximum number of records in one response in the right field. The default value is one record per response.
Configure Health Checks if needed. Learn more about them in our article.
Specify the record’s value.
Select appropriate metadata and specify the value. You can add several metadata fields for one value. To do this, click +.
Click Add record if needed and repeat steps 6-7.
Click Create.
For each type of balancing, we will break down the principle of operation, look at its features, and consider an example.
With weight balancing, you can manage the probability of having a particular record in the answer by specifying its weight.
Note: If the metadata field “weight” is left empty, the default value 50 is used. So you can expect the same probability for each record.
Probability is calculated only if the value of max records per answer exceeds the number of resource records. For a record R1 from RRset with weight W1, its probability(P1) is calculated as its weight divided by the sum of the weights of all other records.
Example. You have weight balancing enabled, specified max one record per response, and added three records with these weight metadata:
With non-coordinates meta balancing, you can add metadata of different types to each record.
Note: The latlong and weight will be ignored when using non-coordinate metadata.
When a DNS request is made, the answer will be formed using the chosen Records selection option and metadata specified for records. The following metadata can be used to be checked against the source of the DNS query:
Our system will check if a user matches the criteria from the metadata in the following order: IP, ASN, country, and continent. The processing logic works like this:
Our DNS server receives a request to the domain.
If Health Checks are configured, we filter off all “non-healthy” records.
The DNS server compares the requestor user’s IP (respecting EDNS(0)) with the IP from the metadata. The server uses records with matched metadata to form an answer if there is a match.
If no matches are found, the ASN meta is considered as in step 3.
If no matches are found, the country meta is considered as in step 3.
If no matches are found, the continent meta is considered as in step 3.
If no matches are found, the records with “fallback=true” metadata are considered.
If no matches are found, all records are used in the answer (respecting max answers value).
Example: You have non-coordinates balancing enabled, specified max one record per response, and you add two records with IP metadata:
Here’s how it looks when you add these records:
If a user with the IP from the subnet 192.168.1.0/24 requests the domain, the record with the value 10.0.0.0 will be returned. If the requestor’s subnet is 192.0.2.0/24, the 10.0.0.1 record will be returned.
With coordinates balancing, you can assign coordinates to each record and add the latlong (latitude and longitude) type metadata. Users will receive the record with the nearest coordinates when they request your domain. You can use the map icon to check you’ve entered the correct coordinates—simplyclick on the icon to see the location corresponding to your parameters.
Example. A user closer to the coordinate 40.43733088856228/-3.566434349995511 (the center of Madrid) will receive an A record with the value 127.0.0.1, while a user nearer to 52.20328569593686/21.081144277439293 (the center of Warsaw) will receive an A record with the value 127.0.0.2.
The configuration is complete. As soon as you finish creating records, balancing will be enabled.
Was this article helpful?
Learn more about our DNS hosting