Whenever I try to connect to my server from Azure VM it takes a lot of time due to failing reverse DNS lookup.
I can disable lookups with
UseDNS no and completely bypass the problem but this makes logs less useful so I'd rather not do it that way.
I'm also running local BIND server for caching and serving local zones.
What I've noticed is that whenever SSH client sends username, named emits multiple warnings like:
Mar 10 22:56:04 ghost named: DNS format error from 18.104.22.168#53 resolving 22.214.171.124.in-addr.arpa/PTR for client 127.0.0.1#37839: invalid response
This is repeated for every server configured as forwarder as well as for microsoft servers serving that zone. Then there is a 1s pause and the whole thing repeats 4 times.
If I execute
nslookup -type=ptr -nosearch -d2 126.96.36.199.in-addr.arpa 188.8.131.52 similar warnings happen but they are not repeated 4 times.
So my questions are:
- Why is this response not cached ?
- Why does sshd retry it 3 times ?
- Can I do something about it ?
UPDATE I know my client machine has no PTR record but it's perfectly valid for client to not have one. Besides I have no control over DNS records of client machines.