Q0023 - Exim/exim GitHub Wiki
Why is Exim refusing to relay, saying failed to find host name from IP address when I have the sender's IP address in an ACL condition? My configuration contains this ACL statement:
accept hosts = lsearch;/etc/mail/relaydomains:192.168.96.0/24
When checking a host list, the items are tested in left-to-right order. The first item in your list is a lookup on the incoming host's name, so Exim has to determine the name from the incoming IP address in order to perform the test. If it can't find the host name, it can't do the check, so it gives up. You would have discovered what was going on if you had run a test such as
exim -bh 192.168.96.131
The solution is to put all explicit IP addresses first in the list. Alternatively, you can split the ACL statement into two like this:
accept hosts = lsearch;/etc/mail/relaydomains
accept hosts = 192.168.96.0/24
If the host lookup fails, the first accept
fails, but then the second
one is considered.