So for better understand the +trace command, you can use the dnstracer.
Install it and run the dnstracer command like the example below
the -s . is to request a full trace from the root servers
the -4 to query just ipv4 (usefull if you do not have ipv6 enabled)
and -o to output the query results too
dnstracer -s . -4 -o b.org
Tracing to b.org[a] via A.ROOT-SERVERS.NET, maximum of 3 retries
A.ROOT-SERVERS.NET [.] (198.41.0.4)
|\___ b2.org.afilias-nst.org [org] (2001:0500:0048:0000:0000:0000:0000:0001) Not queried
|\___ b2.org.afilias-nst.org [org] (199.249.120.1)
| |\___ ns2.dan.com [b.org] (173.201.66.67) Got authoritative answer
| |\___ ns2.dan.com [b.org] (2603:0005:2225:0000:0000:0000:0000:0043) Not queried
| \___ ns1.dan.com [b.org] (97.74.98.67) Got authoritative answer
| \___ ns1.dan.com [b.org] (2603:0005:2125:0000:0000:0000:0000:0043) Not queried
|\___ b0.org.afilias-nst.org [org] (2001:0500:000c:0000:0000:0000:0000:0001) Not queried
|\___ b0.org.afilias-nst.org [org] (199.19.54.1)
| |\___ ns1.dan.com [b.org] (97.74.98.67) (cached)
| |\___ ns1.dan.com [b.org] (2603:0005:2125:0000:0000:0000:0000:0043) Not queried
| \___ ns2.dan.com [b.org] (173.201.66.67) (cached)
| \___ ns2.dan.com [b.org] (2603:0005:2225:0000:0000:0000:0000:0043) Not queried
|\___ a2.org.afilias-nst.info [org] (2001:0500:0040:0000:0000:0000:0000:0001) Not queried
|\___ a2.org.afilias-nst.info [org] (199.249.112.1)
| |\___ ns2.dan.com [b.org] (173.201.66.67) (cached)
| |\___ ns2.dan.com [b.org] (2603:0005:2225:0000:0000:0000:0000:0043) Not queried
| \___ ns1.dan.com [b.org] (97.74.98.67) (cached)
| \___ ns1.dan.com [b.org] (2603:0005:2125:0000:0000:0000:0000:0043) Not queried
|\___ c0.org.afilias-nst.info [org] (2001:0500:000b:0000:0000:0000:0000:0001) Not queried
|\___ c0.org.afilias-nst.info [org] (199.19.53.1)
| |\___ ns1.dan.com [b.org] (97.74.98.67) (cached)
| |\___ ns1.dan.com [b.org] (2603:0005:2125:0000:0000:0000:0000:0043) Not queried
| \___ ns2.dan.com [b.org] (173.201.66.67) (cached)
| \___ ns2.dan.com [b.org] (2603:0005:2225:0000:0000:0000:0000:0043) Not queried
|\___ a0.org.afilias-nst.info [org] (2001:0500:000e:0000:0000:0000:0000:0001) Not queried
|\___ a0.org.afilias-nst.info [org] (199.19.56.1)
| |\___ ns2.dan.com [b.org] (173.201.66.67) (cached)
| |\___ ns2.dan.com [b.org] (2603:0005:2225:0000:0000:0000:0000:0043) Not queried
| \___ ns1.dan.com [b.org] (97.74.98.67) (cached)
| \___ ns1.dan.com [b.org] (2603:0005:2125:0000:0000:0000:0000:0043) Not queried
|\___ d0.org.afilias-nst.org [org] (2001:0500:000f:0000:0000:0000:0000:0001) Not queried
\___ d0.org.afilias-nst.org [org] (199.19.57.1)
|\___ ns1.dan.com [b.org] (97.74.98.67) (cached)
|\___ ns1.dan.com [b.org] (2603:0005:2125:0000:0000:0000:0000:0043) Not queried
\___ ns2.dan.com [b.org] (173.201.66.67) (cached)
\___ ns2.dan.com [b.org] (2603:0005:2225:0000:0000:0000:0000:0043) Not queried
ns1.dan.com (97.74.98.67) b.org -> 3.64.163.50
ns2.dan.com (173.201.66.67) b.org -> 3.64.163.50
This will show that the . is taken care by the root DNS servers, then the org is taken care by the *.afilias-nst.org DNS servers and finally the b is taken care by the dan.com servers.
It will detect broken dns servers in the path and even some miss-configs
a normal query will choose any of the above paths, will not query all servers, just one server in each level, bypassing ones that may already have in cache.
If you want to find what DNS server is replying to your query, that is harder and depends a lot from your setup... but at least in big setups, this sometimes work
May not work in most places, but the DNS EDNS protocol allow the remote server to send a NSID, to help identify the origin server.
Use the +edns +nsid in the dig and it MAY return a NSID line with the id:
dig +edns +nsid google.com @8.8.8.8
; <<>> DiG 9.10.3-P4-Debian <<>> +edns +nsid google.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11816
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
; NSID: 67 70 64 6e 73 2d 6c 68 72 ("gpdns-lhr")
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 300 IN A 74.125.193.102
google.com. 300 IN A 74.125.193.138
google.com. 300 IN A 74.125.193.139
google.com. 300 IN A 74.125.193.113
google.com. 300 IN A 74.125.193.100
google.com. 300 IN A 74.125.193.101
;; Query time: 20 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Oct 05 23:17:15 UTC 2023
;; MSG SIZE rcvd: 148
If the NSID line is empty, the remote server is not configured to send that info.
In bind, you can configure your server to return the NSID by setting up the server-id option : https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-server-id