Temos vários servidores no AWS EC2 que não estão obedecendo aos valores de TTL do DNS. Tabelas de rotas são configuradas para nós "AmazonProvidedDNS" Parece que o "AmazonProvidedDNS" limita o TTL a 60 segundos.
P: Isso é causado pelo servidor DNS da AWS ajustando o TTL em trânsito e há algo que possamos fazer sobre isso?
Notas: - Já empregamos dnsmasq por enquanto com um limite mínimo de 300 ttl; isso não é ideal, pois preferimos obedecer às regras do TTL - Correndo Centos7, oficial AMI - mas eu não acho que seja relevante.
Evidência para fazer backup da pergunta.
Esses testes foram executados em um domínio que temos no Route 53, temos um CNAME TTL como 300 segundos. (As saídas abaixo foram pesquisadas e substituídas por example
; os testes foram executados em um domínio real que controlamos.)
TemcincoresultadosabaixoqueprovamqueéoDNSdaAWS:
1)ExecutandooCentos7AMIoficial,semmodificações.
IssomostraumTTLincorretode60segundos:
digwww.example.com;<<>>DiG9.9.4-RedHat-9.9.4-61.el7<<>>www.example.com;;globaloptions:+cmd;;Gotanswer:;;->>HEADER<<-opcode:QUERY,status:NOERROR,id:9532;;flags:qrrdra;QUERY:1,ANSWER:3,AUTHORITY:0,ADDITIONAL:1;;OPTPSEUDOSECTION:;EDNS:version:0,flags:;udp:4096;;QUESTIONSECTION:;www.example.com.INA;;ANSWERSECTION:www.example.com.60INCNAMEexample-645584916.us-east-1.elb.amazonaws.com.example-645584916.us-east-1.elb.amazonaws.com.60INA52.0.228.53example-645584916.us-east-1.elb.amazonaws.com.60INA18.232.11.127;;Querytime:391msec;;SERVER:10.131.0.2#53(10.131.0.2);;WHEN:WedJul2501:04:00UTC2018;;MSGSIZErcvd:140
2)ExecutandoamesmaAMI,comodnsmasqconfigurado,masusandoapontandoparaoDNSdaAWScomopai.
IssomostraumTTLincorretode60segundos:
digwww.example.com;<<>>DiG9.9.4-RedHat-9.9.4-61.el7<<>>www.example.com;;globaloptions:+cmd;;Gotanswer:;;->>HEADER<<-opcode:QUERY,status:NOERROR,id:57290;;flags:qrrdra;QUERY:1,ANSWER:3,AUTHORITY:0,ADDITIONAL:1;;OPTPSEUDOSECTION:;EDNS:version:0,flags:;udp:4096;;QUESTIONSECTION:;www.example.com.INA;;ANSWERSECTION:www.example.com.60INCNAMEexample-645584916.us-east-1.elb.amazonaws.com.example-645584916.us-east-1.elb.amazonaws.com.60INA52.0.228.53example-645584916.us-east-1.elb.amazonaws.com.60INA18.232.11.127;;Querytime:276msec;;SERVER:127.0.0.1#53(127.0.0.1);;WHEN:WedJul2501:03:07UTC2018;;MSGSIZErcvd:140
3)ExecutandoamesmaAMI,comodnsmasqconfigurado,masusandoapontandoparaoAWSDNScomopai,commin-cache-ttl.
AprimeirasolicitaçãomostraumTTLincorretode60segundos(jáqueissoterávindodaAWS),asegundasolicitaçãomostra"min-cache-ttl" de 300 segundos:
dig www.example.com
; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7 <<>> www.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26595
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.example.com. IN A
;; ANSWER SECTION:
www.example.com. 60 IN CNAME example-645584916.us-east-1 .elb.amazonaws.com.
example-645584916.us-east-1.elb.amazonaws.com. 60 IN A 52.0.228.53
example-645584916.us-east-1.elb.amazonaws.com. 60 IN A 18.232.11.127
;; Query time: 280 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jul 25 01:25:31 UTC 2018
;; MSG SIZE rcvd: 140
dig www.example.com
; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7 <<>> www.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50913
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.example.com. IN A
;; ANSWER SECTION:
www.example.com. 289 IN CNAME example-645584916.us-east-1.elb.amazonaws.com.
example-645584916.us-east-1.elb.amazonaws.com. 289 IN A 18.232.11.127
example-645584916.us-east-1.elb.amazonaws.com. 289 IN A 52.0.228.53
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jul 25 01:29:02 UTC 2018
;; MSG SIZE rcvd: 143
4) Executando a mesma AMI, com o dnsmasq configurado (mas usando apontando para o DNS do Google como pai).
Isso mostra o TTL correto de 300 segundos:
dig www.example.com
; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7 <<>> www.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36048
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.example.com. IN A
;; ANSWER SECTION:
www.example.com. 299 IN CNAME example-645584916.us-east-1 .elb.amazonaws.com.
example-645584916.us-east-1.elb.amazonaws.com. 59 IN A 18.232.11.127
example-645584916.us-east-1.elb.amazonaws.com. 59 IN A 52.0.228.53
;; Query time: 295 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jul 25 01:07:15 UTC 2018
;; MSG SIZE rcvd: 140
5) Executando um Centos7 local apontando para o nosso próprio DNS.
Isso mostra o TTL correto de 300 segundos:
dig www.example.com
; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7 <<>> www.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7307
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 13, ADDITIONAL: 27
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.example.com. IN A
;; ANSWER SECTION:
www.example.com. 300 IN CNAME example-645584916.us-east-1.elb.amazonaws.com.
example-645584916.us-east-1.elb.amazonaws.com. 60 IN A 52.0.228.53
example-645584916.us-east-1.elb.amazonaws.com. 60 IN A 18.232.11.127
;; Query time: 343 msec
;; SERVER: 10.72.73.31#53(10.72.73.31)
;; WHEN: Wed Jul 25 10:41:02 AEST 2018
;; MSG SIZE rcvd: 936