Score:0

why is ssh using cached dns record when dig reports updated version of cname record?

de flag

I have a Jenkins pipeline that will start my AWS Ubuntu EC2 instances. This Jenkins pipeline will also update a CNAME record I have for my EC2 instances in route53.

Sometimes there is a long delay in my ability to ssh to the instance via the CNAME. I figured it might be a cache issue, but if I execute dig the-cname.example.com I see the updated versions of the DNS records. Also I have no problem ssh'ing to the new IP and the value of the DNS A record that AWS gave my instance.

Is my ssh client using a cached version of the CNAME?

Patrick Mevzek avatar
cn flag
DNS entries have `TTL` or `Time To Live` which gives an upper bound of time during which the record is considered fresh and shouldn't trigger a new query by client. It seems in your case you might need to lower those values.
Score:2
gu flag

dig performs an actual DNS query, while ssh will simply ask your system (most likely through gethostbyname) to resolve a name.

dig will ask an actual DNS server while ssh will ask the local service in charge of DNS (nowadays, most likely systemd-resolve) which will cache results.

If using systemd, you can clear the cash using systemd-resolve flush-caches.

Red Cricket avatar
de flag
doh! I forgot to mention that my ssh client is executed from a mac laptop. I'm sure there is a equivalent command.
Red Cricket avatar
de flag
on a mac I can do `sudo killall -HUP mDNSResponde`
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.