Skip to content
Smarter by Design.Simpler for Business

gtm dns-record ​

The gtm dns-record command manages the DNS records of a domain name: the type and the name of the record, the addresses to be returned, the health state of the addresses, with which algorithm the answer will be produced and the fallback records that will come into play while all the addresses are unhealthy. Its panel equivalent is the Records screen.

The record is bound to two upper records

This command first asks in which DNS service (dnsId) and then in which domain name (domainId) it will run. Both of them are selected from the list with Tab. The domain name is created with gtm dns-domain.

Command Summary ​

TR7 WEB-CLI · gtm dns-record
admin@TR7LBWAF01> gtm dns-record list dnsId <service> # list them all
admin@TR7LBWAF01> gtm dns-record show dnsId <service> <id> # show one
admin@TR7LBWAF01> gtm dns-record add dnsId <service> domainId <domain> type <type> name <name> …
admin@TR7LBWAF01> gtm dns-record update dnsId <service> id <id> … # change
admin@TR7LBWAF01> gtm dns-record delete dnsId <service> <id> # delete
admin@TR7LBWAF01>  

Required Fields ​

OrderFieldStatusValue
1dnsIdRequiredThe DNS service to which the record will be added
2domainIdRequiredThe domain name to which the record will be added
3typeRequiredThe DNS record type (A, AAAA, CNAME, MX, TXT, SRV, NS, PTR, CAA, TLSA and the others; 35 types in total)
4nameRequiredThe record name, for example www
5dcSelectorConditionally requiredOnly if the mode of the domain name is Datacenter; the sorting criterion. Its options depend on the --dcSelectorSrc value; if there is a field that starts with -- on the line, it is written in the --dcSelector form, after the source

The list, show, update and delete commands also ask for dnsId first: in the show and delete commands the identifier is written after this without the field name, and in the update command it is in the id <id> form.

The --ttl field is optional and its default is 3600 seconds.

The Addresses and the Health State ​

The addresses the record will return are written inside the data center groups. Every group takes its own index, and every address its own index within the group.

FieldDefaultValue
--recordConfig.0.dcIdYerel veri merkeziGrubun veri merkezi
--recordConfig.0.records.0.content—The address to be returned; it is written according to the record type
--recordConfig.0.records.0.weight1The weight of the address; it is used only in the weighted algorithms
--recordConfig.0.records.0.condtrueThe health state of the address

The cond field takes one of three values:

ValueMeaning
trueThe address always counts as healthy and takes part in the answer; a health check is not done
falseThe address always counts as unhealthy and takes part in no answer
A health scenarioWhile the scenario is active the address takes part in the answer, while it is passive it does not

There has to be at least one address in every group. The scenarios are created with gtm scenario.

The Distribution Algorithm ​

FieldWhat it doesWhat is written after it
--balanceAlgorithmDetermines which of the healthy addresses will be returnedOne of the values below (the default is all)

The behavior of the values:

ValueBehavior
allIt returns all the healthy addresses (the default)
1 · 2 · 3It returns the first one, two or three healthy addresses
rrIt makes a sequential distribution among the healthy addresses
wrrIt makes a sequential distribution according to the weights
randomIt selects randomly from the healthy addresses
wRandomIt selects randomly according to the weights
closestIt returns the address geographically closest to the client; it is effective only in the A and AAAA records

When the weighted algorithms are selected, the weight values of the addresses are used.

The Fields That Change According to the Mode of the Domain Name ​

The fields the record command will ask for change according to the operating mode of the domain name it is bound to.

If the domain name is in the dr mode

FieldDefaultValue
--drCond—The health scenario that triggers the switch to the backup center
--drIfNoRecordstrueProvides that it is switched to the backup when no healthy record is left in the main center as well; it is seen only while a switch scenario is defined

If the domain name is in the dc mode

FieldDefaultValue
--dcSelectorSrcstaticThe source of the sorting criterion: static · dcHost · service · client
dcSelector—Conditionally required The sorting criterion; its options change according to the source
dcServiceName—Conditionally required Only while the source is service; the name of the service to be measured
--pickDcCount1From how many data centers the answer will be selected

The values of the dcSelector field according to the source are as follows:

dcSelectorSrcThe criteria that can be selected
dcHostcpu · mem · bw · status · packetLoss
servicecpu · mem · bw · request · connection · session_new · status · healthyBackends
clienthops · mos · packetLoss · ttl

The Fallback Records and the Topology ​

FieldDefaultValue
--fallbackRecords.0EmptyThe fallback addresses to be returned while all the addresses are unhealthy; they are returned under every condition, without a health check being done
--topologySelectionfalseTurns on the addresses being selected according to the source of the client

The topology rules are not defined on the command line

The --topologySelection only turns the feature on. The defining of the address-based rules (the network, the country, the continent, the autonomous system number) is done from the panel.

Examples ​

TR7 WEB-CLI · A) An A record with a single address
admin@TR7LBWAF01> gtm dns-record add dnsId <service> domainId <domain> type A name www \
--recordConfig.0.records.0.content 192.0.2.10
admin@TR7LBWAF01>  
TR7 WEB-CLI · B) Two addresses, weighted distribution and a fallback record
admin@TR7LBWAF01> gtm dns-record add dnsId <service> domainId <domain> type A name portal \
--recordConfig.0.records.0.content 192.0.2.10 --recordConfig.0.records.0.weight 3 \
--recordConfig.0.records.1.content 192.0.2.11 --recordConfig.0.records.1.weight 1 \
--balanceAlgorithm wrr --fallbackRecords.0 192.0.2.99 --ttl 300
admin@TR7LBWAF01>  
TR7 WEB-CLI · C) Binding an address to a scenario
# the address takes part in the answer only while the scenario is active
admin@TR7LBWAF01> gtm dns-record update dnsId <service> id <id> --recordConfig.0.records.0.cond <scenario>
# taking the address into maintenance
admin@TR7LBWAF01> gtm dns-record update dnsId <service> id <id> --recordConfig.0.records.0.cond false
admin@TR7LBWAF01>  
TR7 WEB-CLI · D) Selection according to a criterion in the Datacenter mode
admin@TR7LBWAF01> gtm dns-record add dnsId <service> domainId <domain> type A name api \
--dcSelectorSrc dcHost --dcSelector cpu --pickDcCount 2 \
--recordConfig.0.records.0.content 192.0.2.10
admin@TR7LBWAF01>  

Updating and Deleting ​

TR7 WEB-CLI · update and delete
admin@TR7LBWAF01> gtm dns-record update dnsId <service> id <id> --ttl 60 --balanceAlgorithm rr
admin@TR7LBWAF01> gtm dns-record update dnsId <service> id <id> --fallbackRecords.delete # remove the fallbacks
admin@TR7LBWAF01> gtm dns-record delete dnsId <service> <id>
admin@TR7LBWAF01>  

Things to Know ​

  • The mode of the record comes from the domain name. The record does not select its own mode; which fields will be asked for is determined by the operating mode of the domain name.
  • The fallback records are not checked. When all the normal addresses are unhealthy, they are returned unconditionally; this is suitable for a maintenance page or for the address of a backup load balancer.
  • The geographic selection works only in the address records. The closest algorithm behaves, in the types other than A and AAAA, like all.
  • The weight is effective only in the weighted algorithms. When wrr or wRandom is not selected, the weight value has no effect on the result.