The same query send to DNS 9.9.9.9 or directly to my router finish correctly like
nslookup -type=ANY google.com 9.9.9.9
Server: dns9.quad9.net
Address: 9.9.9.9
First, I will mention that the very same command works for me just fine.
What are the related lines in your /var/log/pihole.log lines?
I do see
May 14 17:13:47 dnsmasq[2532791]: 50418 127.0.0.1/54775 query[ANY] google.com from 127.0.0.1
May 14 17:13:47 dnsmasq[2532791]: 50418 127.0.0.1/54775 forwarded google.com to 127.0.0.1
May 14 17:13:47 dnsmasq[2532791]: 50418 127.0.0.1/54775 validation result is INSECURE
Note that ANY queries are not guaranteed to deliver consistent results.
If your motivation for manually requesting them would be to retrieve multiple protocol answers in one go, you should be prepared to handle incomplete results (see also proposed RFC 8482)
The result you'll get for an ANY request will depend on quite a few factors, including current caching state and any upstream DNS server used.
As ANY queries are "frequently used to exploit the amplification potential of DNS servers" (quoting the RFC linked above), some public DNS providers have disabled support for ANY queries altogether, e.g. Cloudflare did say goodbye to ANY in 2015.
Consequently, an ANY DNS request for domains via Cloudflare's 1.1.1.1 results in NOTIMP:
The NOTIMP status from above dig means "not implemented".
Selecting Google or Quad9 upstream in Pi-hole allows ANY queries though results differ slightly:
pi@ph5b:~ $ dig google.com ANY @8.8.8.8
[..]
;; ANSWER SECTION:
google.com. 299 IN A 108.177.119.102
google.com. 299 IN A 108.177.119.138
google.com. 299 IN A 108.177.119.113
google.com. 299 IN A 108.177.119.101
google.com. 299 IN A 108.177.119.100
google.com. 299 IN A 108.177.119.139
google.com. 299 IN AAAA 2a00:1450:4013:c00::71
google.com. 299 IN AAAA 2a00:1450:4013:c00::8b
google.com. 299 IN AAAA 2a00:1450:4013:c00::8a
google.com. 299 IN AAAA 2a00:1450:4013:c00::65
google.com. 59 IN SOA ns1.google.com. dns-admin.google.com. 373544068 900 900 1800 60
google.com. 21599 IN NS ns2.google.com.
google.com. 21599 IN NS ns3.google.com.
google.com. 3599 IN TXT "docusign=1b0a6754-49b1-4db5-8540-d2c12664b289"
google.com. 599 IN MX 10 aspmx.l.google.com.
google.com. 3599 IN TXT "google-site-verification=wD8N7i1JTNTkezJ49swvWW48f8_9xveREV4oB-0Hf5o"
google.com. 599 IN MX 20 alt1.aspmx.l.google.com.
google.com. 3599 IN TXT "v=spf1 include:_spf.google.com ~all"
google.com. 3599 IN TXT "docusign=05958488-4752-4ef2-95eb-aa7ba8a3bd0e"
google.com. 3599 IN TXT "facebook-domain-verification=22rm551cu4k0ab0bxsw536tlds4h95"
google.com. 599 IN MX 40 alt3.aspmx.l.google.com.
google.com. 21599 IN NS ns4.google.com.
google.com. 3599 IN TXT "apple-domain-verification=30afIBcvSuDV2PLX"
google.com. 21599 IN NS ns1.google.com.
google.com. 3599 IN TXT "globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8="
google.com. 599 IN MX 50 alt4.aspmx.l.google.com.
google.com. 3599 IN TXT "google-site-verification=TV9-DBe4R80X4v0M4U_bd_J9cpOJM0nikft0jAgjmsQ"
google.com. 21599 IN CAA 0 issue "pki.goog"
google.com. 599 IN MX 30 alt2.aspmx.l.google.com.
google.com. 3599 IN TXT "MS=E4A68B9AB2BB9670BCE1541
pi@ph5b:~ $ dig google.com ANY @9.9.9.9
[..]
;; ANSWER SECTION:
google.com. 34 IN A 142.250.187.238
google.com. 224 IN AAAA 2a00:1450:4009:820::200e
google.com. 327 IN MX 40 alt3.aspmx.l.google.com.
google.com. 327 IN MX 20 alt1.aspmx.l.google.com.
google.com. 327 IN MX 50 alt4.aspmx.l.google.com.
google.com. 327 IN MX 30 alt2.aspmx.l.google.com.
google.com. 327 IN MX 10 aspmx.l.google.com.
google.com. 27 IN SOA ns1.google.com. dns-admin.google.com. 373752905 900 900 1800 60
google.com. 28757 IN NS ns3.google.com.
google.com. 28757 IN NS ns2.google.com.
google.com. 28757 IN NS ns4.google.com.
google.com. 28757 IN NS ns1.google.com.
Website google.com is only example the same problem I got for ebay.com or yahoo.com or any other domain
May 17 16:45:34 dnsmasq[14281]: query[ANY] ebay.com from 192.168.25.2
May 17 16:45:34 dnsmasq[14281]: forwarded ebay.com to 9.9.9.9
...
May 17 16:45:36 dnsmasq[14281]: query[ANY] ebay.com from 192.168.25.2
May 17 16:45:36 dnsmasq[14281]: forwarded ebay.com to 9.9.9.9
...
May 17 16:49:59 dnsmasq[14281]: /etc/pihole/local.list 172.16.25.2 is pihole
May 17 16:49:59 dnsmasq[14281]: query[ANY] yahoo.com from 192.168.25.2
May 17 16:49:59 dnsmasq[14281]: forwarded yahoo.com to 149.112.112.112
May 17 16:49:59 dnsmasq[14281]: query[ANY] yahoo.com from 192.168.25.2
May 17 16:49:59 dnsmasq[14281]: forwarded yahoo.com to 149.112.112.112
...
May 17 16:50:01 dnsmasq[14281]: query[ANY] yahoo.com from 192.168.25.2
May 17 16:50:01 dnsmasq[14281]: forwarded yahoo.com to 149.112.112.112
Because there is no reason to and as has been pointed out to you, other global DNS resolvers are blocking ANY queries now as they are useless and are used for targeted attacks.
Unbound even has the option of specifically blocking ANY types:
deny-any: <yes or no>
If yes, deny queries of type ANY with an empty response. De-
fault is no. If disabled, unbound responds with a short list of
resource records if some can be found in the cache and makes the
upstream type ANY query if there are none.
As you see, either the queries are denied completely or you get what is in unbounds cache first before it will even make an upstream query.