Apache httpd won't stop doing reverse DNS requests for clients' IPs

9,288

Solution 1

It seems the standard Ubuntu 8.04 Apache httpd install comes with a LogFormat that starts with %h and that does a client IP's RDNS lookup. Why oh why?? Replacing it with %a (remote IP address, see custom log formats) reduces this problem by ca. 90%. Some remain...

Solution 2

Have you verified HostnameLookups is not set in any other directive? Have you activated the module mod_authz_host?

Solution 3

I stumbled over the same problem and I discovered another source of reverse lookups: the applications themselves! PHP has the gethostbyaddr() function:

http://php.net/manual/en/function.gethostbyaddr.php

Share:
9,288
Paul
Author by

Paul

Updated on September 17, 2022

Comments

  • Paul
    Paul almost 2 years

    Obviously my Apache httpd instance is doing reverse DNS (RDNS, give me the hostname for this IP address) lookups for each incoming client connection's IP address. This is bad. Especially since sometimes resolution fails with a missing PTR record - after 28secs.

    Diagnostics: I added %D to my "combined" log style and looked at the response times this way: Clearly <1s for all those that are logged with their hostname and 20+s for those that get their IP logged.

    This is what I tried:

    • Turn off the server-status extension.
    • Check that HostnameLookups Off is in the config.
    • Check that mod_access is not given any hostname in an Allow/Deny rule.
    • Check that reverse proxied servers follow the same rules.

    What have I missed?

    • Paul
      Paul over 14 years
      Yes I did, though force-reload was enough.
  • Paul
    Paul over 14 years
    Yes I grep -ri-ed it all over. mod_authz_host is active and no hostnames are used in the Allow/Deny-rules. Now not even with localhost.